tutuca 0.9.44 → 0.9.46

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.
@@ -17,6 +17,3296 @@ var __export = (target, all) => {
17
17
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
18
18
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
19
19
 
20
+ // node_modules/chai/index.js
21
+ function isErrorInstance(obj) {
22
+ return obj instanceof Error || Object.prototype.toString.call(obj) === "[object Error]";
23
+ }
24
+ function isRegExp(obj) {
25
+ return Object.prototype.toString.call(obj) === "[object RegExp]";
26
+ }
27
+ function compatibleInstance(thrown, errorLike) {
28
+ return isErrorInstance(errorLike) && thrown === errorLike;
29
+ }
30
+ function compatibleConstructor(thrown, errorLike) {
31
+ if (isErrorInstance(errorLike)) {
32
+ return thrown.constructor === errorLike.constructor || thrown instanceof errorLike.constructor;
33
+ } else if ((typeof errorLike === "object" || typeof errorLike === "function") && errorLike.prototype) {
34
+ return thrown.constructor === errorLike || thrown instanceof errorLike;
35
+ }
36
+ return false;
37
+ }
38
+ function compatibleMessage(thrown, errMatcher) {
39
+ const comparisonString = typeof thrown === "string" ? thrown : thrown.message;
40
+ if (isRegExp(errMatcher)) {
41
+ return errMatcher.test(comparisonString);
42
+ } else if (typeof errMatcher === "string") {
43
+ return comparisonString.indexOf(errMatcher) !== -1;
44
+ }
45
+ return false;
46
+ }
47
+ function getConstructorName(errorLike) {
48
+ let constructorName = errorLike;
49
+ if (isErrorInstance(errorLike)) {
50
+ constructorName = errorLike.constructor.name;
51
+ } else if (typeof errorLike === "function") {
52
+ constructorName = errorLike.name;
53
+ if (constructorName === "") {
54
+ const newConstructorName = new errorLike().name;
55
+ constructorName = newConstructorName || constructorName;
56
+ }
57
+ }
58
+ return constructorName;
59
+ }
60
+ function getMessage(errorLike) {
61
+ let msg = "";
62
+ if (errorLike && errorLike.message) {
63
+ msg = errorLike.message;
64
+ } else if (typeof errorLike === "string") {
65
+ msg = errorLike;
66
+ }
67
+ return msg;
68
+ }
69
+ function flag(obj, key, value) {
70
+ let flags = obj.__flags || (obj.__flags = /* @__PURE__ */ Object.create(null));
71
+ if (arguments.length === 3) {
72
+ flags[key] = value;
73
+ } else {
74
+ return flags[key];
75
+ }
76
+ }
77
+ function test(obj, args) {
78
+ let negate = flag(obj, "negate"), expr = args[0];
79
+ return negate ? !expr : expr;
80
+ }
81
+ function type(obj) {
82
+ if (typeof obj === "undefined") {
83
+ return "undefined";
84
+ }
85
+ if (obj === null) {
86
+ return "null";
87
+ }
88
+ const stringTag = obj[Symbol.toStringTag];
89
+ if (typeof stringTag === "string") {
90
+ return stringTag;
91
+ }
92
+ const type3 = Object.prototype.toString.call(obj).slice(8, -1);
93
+ return type3;
94
+ }
95
+ function expectTypes(obj, types) {
96
+ let flagMsg = flag(obj, "message");
97
+ let ssfi = flag(obj, "ssfi");
98
+ flagMsg = flagMsg ? flagMsg + ": " : "";
99
+ obj = flag(obj, "object");
100
+ types = types.map(function(t) {
101
+ return t.toLowerCase();
102
+ });
103
+ types.sort();
104
+ let str = types.map(function(t, index) {
105
+ let art = ~["a", "e", "i", "o", "u"].indexOf(t.charAt(0)) ? "an" : "a";
106
+ let or = types.length > 1 && index === types.length - 1 ? "or " : "";
107
+ return or + art + " " + t;
108
+ }).join(", ");
109
+ let objType = type(obj).toLowerCase();
110
+ if (!types.some(function(expected) {
111
+ return objType === expected;
112
+ })) {
113
+ throw new AssertionError(flagMsg + "object tested must be " + str + ", but " + objType + " given", undefined, ssfi);
114
+ }
115
+ }
116
+ function getActual(obj, args) {
117
+ return args.length > 4 ? args[4] : obj._obj;
118
+ }
119
+ function colorise(value, styleType) {
120
+ const color = ansiColors[styles[styleType]] || ansiColors[styleType] || "";
121
+ if (!color) {
122
+ return String(value);
123
+ }
124
+ return `\x1B[${color[0]}m${String(value)}\x1B[${color[1]}m`;
125
+ }
126
+ function normaliseOptions({
127
+ showHidden = false,
128
+ depth = 2,
129
+ colors = false,
130
+ customInspect = true,
131
+ showProxy = false,
132
+ maxArrayLength = Infinity,
133
+ breakLength = Infinity,
134
+ seen = [],
135
+ truncate: truncate2 = Infinity,
136
+ stylize = String
137
+ } = {}, inspect3) {
138
+ const options = {
139
+ showHidden: Boolean(showHidden),
140
+ depth: Number(depth),
141
+ colors: Boolean(colors),
142
+ customInspect: Boolean(customInspect),
143
+ showProxy: Boolean(showProxy),
144
+ maxArrayLength: Number(maxArrayLength),
145
+ breakLength: Number(breakLength),
146
+ truncate: Number(truncate2),
147
+ seen,
148
+ inspect: inspect3,
149
+ stylize
150
+ };
151
+ if (options.colors) {
152
+ options.stylize = colorise;
153
+ }
154
+ return options;
155
+ }
156
+ function isHighSurrogate(char) {
157
+ return char >= "\uD800" && char <= "\uDBFF";
158
+ }
159
+ function truncate(string, length, tail = truncator) {
160
+ string = String(string);
161
+ const tailLength = tail.length;
162
+ const stringLength = string.length;
163
+ if (tailLength > length && stringLength > tailLength) {
164
+ return tail;
165
+ }
166
+ if (stringLength > length && stringLength > tailLength) {
167
+ let end = length - tailLength;
168
+ if (end > 0 && isHighSurrogate(string[end - 1])) {
169
+ end = end - 1;
170
+ }
171
+ return `${string.slice(0, end)}${tail}`;
172
+ }
173
+ return string;
174
+ }
175
+ function inspectList(list, options, inspectItem, separator = ", ") {
176
+ inspectItem = inspectItem || options.inspect;
177
+ const size = list.length;
178
+ if (size === 0)
179
+ return "";
180
+ const originalLength = options.truncate;
181
+ let output = "";
182
+ let peek = "";
183
+ let truncated = "";
184
+ for (let i = 0;i < size; i += 1) {
185
+ const last = i + 1 === list.length;
186
+ const secondToLast = i + 2 === list.length;
187
+ truncated = `${truncator}(${list.length - i})`;
188
+ const value = list[i];
189
+ options.truncate = originalLength - output.length - (last ? 0 : separator.length);
190
+ const string = peek || inspectItem(value, options) + (last ? "" : separator);
191
+ const nextLength = output.length + string.length;
192
+ const truncatedLength = nextLength + truncated.length;
193
+ if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) {
194
+ break;
195
+ }
196
+ if (!last && !secondToLast && truncatedLength > originalLength) {
197
+ break;
198
+ }
199
+ peek = last ? "" : inspectItem(list[i + 1], options) + (secondToLast ? "" : separator);
200
+ if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) {
201
+ break;
202
+ }
203
+ output += string;
204
+ if (!last && !secondToLast && nextLength + peek.length >= originalLength) {
205
+ truncated = `${truncator}(${list.length - i - 1})`;
206
+ break;
207
+ }
208
+ truncated = "";
209
+ }
210
+ return `${output}${truncated}`;
211
+ }
212
+ function quoteComplexKey(key) {
213
+ if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) {
214
+ return key;
215
+ }
216
+ return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
217
+ }
218
+ function inspectProperty([key, value], options) {
219
+ options.truncate -= 2;
220
+ if (typeof key === "string") {
221
+ key = quoteComplexKey(key);
222
+ } else if (typeof key !== "number") {
223
+ key = `[${options.inspect(key, options)}]`;
224
+ }
225
+ options.truncate -= key.length;
226
+ value = options.inspect(value, options);
227
+ return `${key}: ${value}`;
228
+ }
229
+ function inspectArray(array, options) {
230
+ const nonIndexProperties = Object.keys(array).slice(array.length);
231
+ if (!array.length && !nonIndexProperties.length)
232
+ return "[]";
233
+ options.truncate -= 4;
234
+ const listContents = inspectList(array, options);
235
+ options.truncate -= listContents.length;
236
+ let propertyContents = "";
237
+ if (nonIndexProperties.length) {
238
+ propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
239
+ }
240
+ return `[ ${listContents}${propertyContents ? `, ${propertyContents}` : ""} ]`;
241
+ }
242
+ function inspectTypedArray(array, options) {
243
+ const name = getArrayName(array);
244
+ options.truncate -= name.length + 4;
245
+ const nonIndexProperties = Object.keys(array).slice(array.length);
246
+ if (!array.length && !nonIndexProperties.length)
247
+ return `${name}[]`;
248
+ let output = "";
249
+ for (let i = 0;i < array.length; i++) {
250
+ const string = `${options.stylize(truncate(array[i], options.truncate), "number")}${i === array.length - 1 ? "" : ", "}`;
251
+ options.truncate -= string.length;
252
+ if (array[i] !== array.length && options.truncate <= 3) {
253
+ output += `${truncator}(${array.length - array[i] + 1})`;
254
+ break;
255
+ }
256
+ output += string;
257
+ }
258
+ let propertyContents = "";
259
+ if (nonIndexProperties.length) {
260
+ propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
261
+ }
262
+ return `${name}[ ${output}${propertyContents ? `, ${propertyContents}` : ""} ]`;
263
+ }
264
+ function inspectDate(dateObject, options) {
265
+ const stringRepresentation = dateObject.toJSON();
266
+ if (stringRepresentation === null) {
267
+ return "Invalid Date";
268
+ }
269
+ const split = stringRepresentation.split("T");
270
+ const date = split[0];
271
+ return options.stylize(`${date}T${truncate(split[1], options.truncate - date.length - 1)}`, "date");
272
+ }
273
+ function inspectFunction(func, options) {
274
+ const functionType = func[Symbol.toStringTag] || "Function";
275
+ const name = func.name;
276
+ if (!name) {
277
+ return options.stylize(`[${functionType}]`, "special");
278
+ }
279
+ return options.stylize(`[${functionType} ${truncate(name, options.truncate - 11)}]`, "special");
280
+ }
281
+ function inspectMapEntry([key, value], options) {
282
+ options.truncate -= 4;
283
+ key = options.inspect(key, options);
284
+ options.truncate -= key.length;
285
+ value = options.inspect(value, options);
286
+ return `${key} => ${value}`;
287
+ }
288
+ function mapToEntries(map) {
289
+ const entries = [];
290
+ map.forEach((value, key) => {
291
+ entries.push([key, value]);
292
+ });
293
+ return entries;
294
+ }
295
+ function inspectMap(map, options) {
296
+ if (map.size === 0)
297
+ return "Map{}";
298
+ options.truncate -= 7;
299
+ return `Map{ ${inspectList(mapToEntries(map), options, inspectMapEntry)} }`;
300
+ }
301
+ function inspectNumber(number, options) {
302
+ if (isNaN(number)) {
303
+ return options.stylize("NaN", "number");
304
+ }
305
+ if (number === Infinity) {
306
+ return options.stylize("Infinity", "number");
307
+ }
308
+ if (number === -Infinity) {
309
+ return options.stylize("-Infinity", "number");
310
+ }
311
+ if (number === 0) {
312
+ return options.stylize(1 / number === Infinity ? "+0" : "-0", "number");
313
+ }
314
+ return options.stylize(truncate(String(number), options.truncate), "number");
315
+ }
316
+ function inspectBigInt(number, options) {
317
+ let nums = truncate(number.toString(), options.truncate - 1);
318
+ if (nums !== truncator)
319
+ nums += "n";
320
+ return options.stylize(nums, "bigint");
321
+ }
322
+ function inspectRegExp(value, options) {
323
+ const flags = value.toString().split("/")[2];
324
+ const sourceLength = options.truncate - (2 + flags.length);
325
+ const source = value.source;
326
+ return options.stylize(`/${truncate(source, sourceLength)}/${flags}`, "regexp");
327
+ }
328
+ function arrayFromSet(set2) {
329
+ const values = [];
330
+ set2.forEach((value) => {
331
+ values.push(value);
332
+ });
333
+ return values;
334
+ }
335
+ function inspectSet(set2, options) {
336
+ if (set2.size === 0)
337
+ return "Set{}";
338
+ options.truncate -= 7;
339
+ return `Set{ ${inspectList(arrayFromSet(set2), options)} }`;
340
+ }
341
+ function escape(char) {
342
+ return escapeCharacters[char] || `\\u${`0000${char.charCodeAt(0).toString(hex)}`.slice(-unicodeLength)}`;
343
+ }
344
+ function inspectString(string, options) {
345
+ if (stringEscapeChars.test(string)) {
346
+ string = string.replace(stringEscapeChars, escape);
347
+ }
348
+ return options.stylize(`'${truncate(string, options.truncate - 2)}'`, "string");
349
+ }
350
+ function inspectSymbol(value) {
351
+ if ("description" in Symbol.prototype) {
352
+ return value.description ? `Symbol(${value.description})` : "Symbol()";
353
+ }
354
+ return value.toString();
355
+ }
356
+ function inspectObject(object, options) {
357
+ const properties = Object.getOwnPropertyNames(object);
358
+ const symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : [];
359
+ if (properties.length === 0 && symbols.length === 0) {
360
+ return "{}";
361
+ }
362
+ options.truncate -= 4;
363
+ options.seen = options.seen || [];
364
+ if (options.seen.includes(object)) {
365
+ return "[Circular]";
366
+ }
367
+ options.seen.push(object);
368
+ const propertyContents = inspectList(properties.map((key) => [key, object[key]]), options, inspectProperty);
369
+ const symbolContents = inspectList(symbols.map((key) => [key, object[key]]), options, inspectProperty);
370
+ options.seen.pop();
371
+ let sep = "";
372
+ if (propertyContents && symbolContents) {
373
+ sep = ", ";
374
+ }
375
+ return `{ ${propertyContents}${sep}${symbolContents} }`;
376
+ }
377
+ function inspectClass(value, options) {
378
+ let name = "";
379
+ if (toStringTag && toStringTag in value) {
380
+ name = value[toStringTag];
381
+ }
382
+ name = name || value.constructor.name;
383
+ if (!name || name === "_class") {
384
+ name = "<Anonymous Class>";
385
+ }
386
+ options.truncate -= name.length;
387
+ return `${name}${inspectObject(value, options)}`;
388
+ }
389
+ function inspectArguments(args, options) {
390
+ if (args.length === 0)
391
+ return "Arguments[]";
392
+ options.truncate -= 13;
393
+ return `Arguments[ ${inspectList(args, options)} ]`;
394
+ }
395
+ function inspectObject2(error, options) {
396
+ const properties = Object.getOwnPropertyNames(error).filter((key) => errorKeys.indexOf(key) === -1);
397
+ const name = error.name;
398
+ options.truncate -= name.length;
399
+ let message = "";
400
+ if (typeof error.message === "string") {
401
+ message = truncate(error.message, options.truncate);
402
+ } else {
403
+ properties.unshift("message");
404
+ }
405
+ message = message ? `: ${message}` : "";
406
+ options.truncate -= message.length + 5;
407
+ options.seen = options.seen || [];
408
+ if (options.seen.includes(error)) {
409
+ return "[Circular]";
410
+ }
411
+ options.seen.push(error);
412
+ const propertyContents = inspectList(properties.map((key) => [key, error[key]]), options, inspectProperty);
413
+ return `${name}${message}${propertyContents ? ` { ${propertyContents} }` : ""}`;
414
+ }
415
+ function inspectAttribute([key, value], options) {
416
+ options.truncate -= 3;
417
+ if (!value) {
418
+ return `${options.stylize(String(key), "yellow")}`;
419
+ }
420
+ return `${options.stylize(String(key), "yellow")}=${options.stylize(`"${value}"`, "string")}`;
421
+ }
422
+ function inspectNodeCollection(collection, options) {
423
+ return inspectList(collection, options, inspectNode, `
424
+ `);
425
+ }
426
+ function inspectNode(node, options) {
427
+ switch (node.nodeType) {
428
+ case 1:
429
+ return inspectHTML(node, options);
430
+ case 3:
431
+ return options.inspect(node.data, options);
432
+ default:
433
+ return options.inspect(node, options);
434
+ }
435
+ }
436
+ function inspectHTML(element, options) {
437
+ const properties = element.getAttributeNames();
438
+ const name = element.tagName.toLowerCase();
439
+ const head = options.stylize(`<${name}`, "special");
440
+ const headClose = options.stylize(`>`, "special");
441
+ const tail = options.stylize(`</${name}>`, "special");
442
+ options.truncate -= name.length * 2 + 5;
443
+ let propertyContents = "";
444
+ if (properties.length > 0) {
445
+ propertyContents += " ";
446
+ propertyContents += inspectList(properties.map((key) => [key, element.getAttribute(key)]), options, inspectAttribute, " ");
447
+ }
448
+ options.truncate -= propertyContents.length;
449
+ const truncate2 = options.truncate;
450
+ let children = inspectNodeCollection(element.children, options);
451
+ if (children && children.length > truncate2) {
452
+ children = `${truncator}(${element.children.length})`;
453
+ }
454
+ return `${head}${propertyContents}${headClose}${children}${tail}`;
455
+ }
456
+ function inspect(value, opts = {}) {
457
+ const options = normaliseOptions(opts, inspect);
458
+ const { customInspect } = options;
459
+ let type3 = value === null ? "null" : typeof value;
460
+ if (type3 === "object") {
461
+ type3 = toString.call(value).slice(8, -1);
462
+ }
463
+ if (type3 in baseTypesMap) {
464
+ return baseTypesMap[type3](value, options);
465
+ }
466
+ if (customInspect && value) {
467
+ const output = inspectCustom(value, options, type3, inspect);
468
+ if (output) {
469
+ if (typeof output === "string")
470
+ return output;
471
+ return inspect(output, options);
472
+ }
473
+ }
474
+ const proto = value ? Object.getPrototypeOf(value) : false;
475
+ if (proto === Object.prototype || proto === null) {
476
+ return inspectObject(value, options);
477
+ }
478
+ if (value && typeof HTMLElement === "function" && value instanceof HTMLElement) {
479
+ return inspectHTML(value, options);
480
+ }
481
+ if ("constructor" in value) {
482
+ if (value.constructor !== Object) {
483
+ return inspectClass(value, options);
484
+ }
485
+ return inspectObject(value, options);
486
+ }
487
+ if (value === Object(value)) {
488
+ return inspectObject(value, options);
489
+ }
490
+ return options.stylize(String(value), type3);
491
+ }
492
+ function inspect2(obj, showHidden, depth, colors) {
493
+ let options = {
494
+ colors,
495
+ depth: typeof depth === "undefined" ? 2 : depth,
496
+ showHidden,
497
+ truncate: config.truncateThreshold ? config.truncateThreshold : Infinity
498
+ };
499
+ return inspect(obj, options);
500
+ }
501
+ function objDisplay(obj) {
502
+ let str = inspect2(obj), type3 = Object.prototype.toString.call(obj);
503
+ if (config.truncateThreshold && str.length >= config.truncateThreshold) {
504
+ if (type3 === "[object Function]") {
505
+ return !obj.name || obj.name === "" ? "[Function]" : "[Function: " + obj.name + "]";
506
+ } else if (type3 === "[object Array]") {
507
+ return "[ Array(" + obj.length + ") ]";
508
+ } else if (type3 === "[object Object]") {
509
+ let keys = Object.keys(obj), kstr = keys.length > 2 ? keys.splice(0, 2).join(", ") + ", ..." : keys.join(", ");
510
+ return "{ Object (" + kstr + ") }";
511
+ } else {
512
+ return str;
513
+ }
514
+ } else {
515
+ return str;
516
+ }
517
+ }
518
+ function getMessage2(obj, args) {
519
+ let negate = flag(obj, "negate");
520
+ let val = flag(obj, "object");
521
+ let expected = args[3];
522
+ let actual = getActual(obj, args);
523
+ let msg = negate ? args[2] : args[1];
524
+ let flagMsg = flag(obj, "message");
525
+ if (typeof msg === "function")
526
+ msg = msg();
527
+ msg = msg || "";
528
+ msg = msg.replace(/#\{this\}/g, function() {
529
+ return objDisplay(val);
530
+ }).replace(/#\{act\}/g, function() {
531
+ return objDisplay(actual);
532
+ }).replace(/#\{exp\}/g, function() {
533
+ return objDisplay(expected);
534
+ });
535
+ return flagMsg ? flagMsg + ": " + msg : msg;
536
+ }
537
+ function transferFlags(assertion, object, includeAll) {
538
+ let flags = assertion.__flags || (assertion.__flags = /* @__PURE__ */ Object.create(null));
539
+ if (!object.__flags) {
540
+ object.__flags = /* @__PURE__ */ Object.create(null);
541
+ }
542
+ includeAll = arguments.length === 3 ? includeAll : true;
543
+ for (let flag3 in flags) {
544
+ if (includeAll || flag3 !== "object" && flag3 !== "ssfi" && flag3 !== "lockSsfi" && flag3 != "message") {
545
+ object.__flags[flag3] = flags[flag3];
546
+ }
547
+ }
548
+ }
549
+ function type2(obj) {
550
+ if (typeof obj === "undefined") {
551
+ return "undefined";
552
+ }
553
+ if (obj === null) {
554
+ return "null";
555
+ }
556
+ const stringTag = obj[Symbol.toStringTag];
557
+ if (typeof stringTag === "string") {
558
+ return stringTag;
559
+ }
560
+ const sliceStart = 8;
561
+ const sliceEnd = -1;
562
+ return Object.prototype.toString.call(obj).slice(sliceStart, sliceEnd);
563
+ }
564
+ function FakeMap() {
565
+ this._key = "chai/deep-eql__" + Math.random() + Date.now();
566
+ }
567
+ function memoizeCompare(leftHandOperand, rightHandOperand, memoizeMap) {
568
+ if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
569
+ return null;
570
+ }
571
+ var leftHandMap = memoizeMap.get(leftHandOperand);
572
+ if (leftHandMap) {
573
+ var result = leftHandMap.get(rightHandOperand);
574
+ if (typeof result === "boolean") {
575
+ return result;
576
+ }
577
+ }
578
+ return null;
579
+ }
580
+ function memoizeSet(leftHandOperand, rightHandOperand, memoizeMap, result) {
581
+ if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
582
+ return;
583
+ }
584
+ var leftHandMap = memoizeMap.get(leftHandOperand);
585
+ if (leftHandMap) {
586
+ leftHandMap.set(rightHandOperand, result);
587
+ } else {
588
+ leftHandMap = new MemoizeMap;
589
+ leftHandMap.set(rightHandOperand, result);
590
+ memoizeMap.set(leftHandOperand, leftHandMap);
591
+ }
592
+ }
593
+ function deepEqual(leftHandOperand, rightHandOperand, options) {
594
+ if (options && options.comparator) {
595
+ return extensiveDeepEqual(leftHandOperand, rightHandOperand, options);
596
+ }
597
+ var simpleResult = simpleEqual(leftHandOperand, rightHandOperand);
598
+ if (simpleResult !== null) {
599
+ return simpleResult;
600
+ }
601
+ return extensiveDeepEqual(leftHandOperand, rightHandOperand, options);
602
+ }
603
+ function simpleEqual(leftHandOperand, rightHandOperand) {
604
+ if (leftHandOperand === rightHandOperand) {
605
+ return leftHandOperand !== 0 || 1 / leftHandOperand === 1 / rightHandOperand;
606
+ }
607
+ if (leftHandOperand !== leftHandOperand && rightHandOperand !== rightHandOperand) {
608
+ return true;
609
+ }
610
+ if (isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
611
+ return false;
612
+ }
613
+ return null;
614
+ }
615
+ function extensiveDeepEqual(leftHandOperand, rightHandOperand, options) {
616
+ options = options || {};
617
+ options.memoize = options.memoize === false ? false : options.memoize || new MemoizeMap;
618
+ var comparator = options && options.comparator;
619
+ var memoizeResultLeft = memoizeCompare(leftHandOperand, rightHandOperand, options.memoize);
620
+ if (memoizeResultLeft !== null) {
621
+ return memoizeResultLeft;
622
+ }
623
+ var memoizeResultRight = memoizeCompare(rightHandOperand, leftHandOperand, options.memoize);
624
+ if (memoizeResultRight !== null) {
625
+ return memoizeResultRight;
626
+ }
627
+ if (comparator) {
628
+ var comparatorResult = comparator(leftHandOperand, rightHandOperand);
629
+ if (comparatorResult === false || comparatorResult === true) {
630
+ memoizeSet(leftHandOperand, rightHandOperand, options.memoize, comparatorResult);
631
+ return comparatorResult;
632
+ }
633
+ var simpleResult = simpleEqual(leftHandOperand, rightHandOperand);
634
+ if (simpleResult !== null) {
635
+ return simpleResult;
636
+ }
637
+ }
638
+ var leftHandType = type2(leftHandOperand);
639
+ if (leftHandType !== type2(rightHandOperand)) {
640
+ memoizeSet(leftHandOperand, rightHandOperand, options.memoize, false);
641
+ return false;
642
+ }
643
+ memoizeSet(leftHandOperand, rightHandOperand, options.memoize, true);
644
+ var result = extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options);
645
+ memoizeSet(leftHandOperand, rightHandOperand, options.memoize, result);
646
+ return result;
647
+ }
648
+ function extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options) {
649
+ switch (leftHandType) {
650
+ case "String":
651
+ case "Number":
652
+ case "Boolean":
653
+ case "Date":
654
+ return deepEqual(leftHandOperand.valueOf(), rightHandOperand.valueOf());
655
+ case "Promise":
656
+ case "Symbol":
657
+ case "function":
658
+ case "WeakMap":
659
+ case "WeakSet":
660
+ return leftHandOperand === rightHandOperand;
661
+ case "Error":
662
+ return keysEqual(leftHandOperand, rightHandOperand, ["name", "message", "code"], options);
663
+ case "Arguments":
664
+ case "Int8Array":
665
+ case "Uint8Array":
666
+ case "Uint8ClampedArray":
667
+ case "Int16Array":
668
+ case "Uint16Array":
669
+ case "Int32Array":
670
+ case "Uint32Array":
671
+ case "Float32Array":
672
+ case "Float64Array":
673
+ case "Array":
674
+ return iterableEqual(leftHandOperand, rightHandOperand, options);
675
+ case "RegExp":
676
+ return regexpEqual(leftHandOperand, rightHandOperand);
677
+ case "Generator":
678
+ return generatorEqual(leftHandOperand, rightHandOperand, options);
679
+ case "DataView":
680
+ return iterableEqual(new Uint8Array(leftHandOperand.buffer), new Uint8Array(rightHandOperand.buffer), options);
681
+ case "ArrayBuffer":
682
+ return iterableEqual(new Uint8Array(leftHandOperand), new Uint8Array(rightHandOperand), options);
683
+ case "Set":
684
+ return entriesEqual(leftHandOperand, rightHandOperand, options);
685
+ case "Map":
686
+ return entriesEqual(leftHandOperand, rightHandOperand, options);
687
+ case "Temporal.PlainDate":
688
+ case "Temporal.PlainTime":
689
+ case "Temporal.PlainDateTime":
690
+ case "Temporal.Instant":
691
+ case "Temporal.ZonedDateTime":
692
+ case "Temporal.PlainYearMonth":
693
+ case "Temporal.PlainMonthDay":
694
+ return leftHandOperand.equals(rightHandOperand);
695
+ case "Temporal.Duration":
696
+ return leftHandOperand.total("nanoseconds") === rightHandOperand.total("nanoseconds");
697
+ case "Temporal.TimeZone":
698
+ case "Temporal.Calendar":
699
+ return leftHandOperand.toString() === rightHandOperand.toString();
700
+ default:
701
+ return objectEqual(leftHandOperand, rightHandOperand, options);
702
+ }
703
+ }
704
+ function regexpEqual(leftHandOperand, rightHandOperand) {
705
+ return leftHandOperand.toString() === rightHandOperand.toString();
706
+ }
707
+ function entriesEqual(leftHandOperand, rightHandOperand, options) {
708
+ try {
709
+ if (leftHandOperand.size !== rightHandOperand.size) {
710
+ return false;
711
+ }
712
+ if (leftHandOperand.size === 0) {
713
+ return true;
714
+ }
715
+ } catch (sizeError) {
716
+ return false;
717
+ }
718
+ var leftHandItems = [];
719
+ var rightHandItems = [];
720
+ leftHandOperand.forEach(/* @__PURE__ */ __name(function gatherEntries(key, value) {
721
+ leftHandItems.push([key, value]);
722
+ }, "gatherEntries"));
723
+ rightHandOperand.forEach(/* @__PURE__ */ __name(function gatherEntries(key, value) {
724
+ rightHandItems.push([key, value]);
725
+ }, "gatherEntries"));
726
+ return iterableEqual(leftHandItems.sort(), rightHandItems.sort(), options);
727
+ }
728
+ function iterableEqual(leftHandOperand, rightHandOperand, options) {
729
+ var length = leftHandOperand.length;
730
+ if (length !== rightHandOperand.length) {
731
+ return false;
732
+ }
733
+ if (length === 0) {
734
+ return true;
735
+ }
736
+ var index = -1;
737
+ while (++index < length) {
738
+ if (deepEqual(leftHandOperand[index], rightHandOperand[index], options) === false) {
739
+ return false;
740
+ }
741
+ }
742
+ return true;
743
+ }
744
+ function generatorEqual(leftHandOperand, rightHandOperand, options) {
745
+ return iterableEqual(getGeneratorEntries(leftHandOperand), getGeneratorEntries(rightHandOperand), options);
746
+ }
747
+ function hasIteratorFunction(target) {
748
+ return typeof Symbol !== "undefined" && typeof target === "object" && typeof Symbol.iterator !== "undefined" && typeof target[Symbol.iterator] === "function";
749
+ }
750
+ function getIteratorEntries(target) {
751
+ if (hasIteratorFunction(target)) {
752
+ try {
753
+ return getGeneratorEntries(target[Symbol.iterator]());
754
+ } catch (iteratorError) {
755
+ return [];
756
+ }
757
+ }
758
+ return [];
759
+ }
760
+ function getGeneratorEntries(generator) {
761
+ var generatorResult = generator.next();
762
+ var accumulator = [generatorResult.value];
763
+ while (generatorResult.done === false) {
764
+ generatorResult = generator.next();
765
+ accumulator.push(generatorResult.value);
766
+ }
767
+ return accumulator;
768
+ }
769
+ function getEnumerableKeys(target) {
770
+ var keys = [];
771
+ for (var key in target) {
772
+ keys.push(key);
773
+ }
774
+ return keys;
775
+ }
776
+ function getEnumerableSymbols(target) {
777
+ var keys = [];
778
+ var allKeys = Object.getOwnPropertySymbols(target);
779
+ for (var i = 0;i < allKeys.length; i += 1) {
780
+ var key = allKeys[i];
781
+ if (Object.getOwnPropertyDescriptor(target, key).enumerable) {
782
+ keys.push(key);
783
+ }
784
+ }
785
+ return keys;
786
+ }
787
+ function keysEqual(leftHandOperand, rightHandOperand, keys, options) {
788
+ var length = keys.length;
789
+ if (length === 0) {
790
+ return true;
791
+ }
792
+ for (var i = 0;i < length; i += 1) {
793
+ if (deepEqual(leftHandOperand[keys[i]], rightHandOperand[keys[i]], options) === false) {
794
+ return false;
795
+ }
796
+ }
797
+ return true;
798
+ }
799
+ function objectEqual(leftHandOperand, rightHandOperand, options) {
800
+ var leftHandKeys = getEnumerableKeys(leftHandOperand);
801
+ var rightHandKeys = getEnumerableKeys(rightHandOperand);
802
+ var leftHandSymbols = getEnumerableSymbols(leftHandOperand);
803
+ var rightHandSymbols = getEnumerableSymbols(rightHandOperand);
804
+ leftHandKeys = leftHandKeys.concat(leftHandSymbols);
805
+ rightHandKeys = rightHandKeys.concat(rightHandSymbols);
806
+ if (leftHandKeys.length && leftHandKeys.length === rightHandKeys.length) {
807
+ if (iterableEqual(mapSymbols(leftHandKeys).sort(), mapSymbols(rightHandKeys).sort()) === false) {
808
+ return false;
809
+ }
810
+ return keysEqual(leftHandOperand, rightHandOperand, leftHandKeys, options);
811
+ }
812
+ var leftHandEntries = getIteratorEntries(leftHandOperand);
813
+ var rightHandEntries = getIteratorEntries(rightHandOperand);
814
+ if (leftHandEntries.length && leftHandEntries.length === rightHandEntries.length) {
815
+ leftHandEntries.sort();
816
+ rightHandEntries.sort();
817
+ return iterableEqual(leftHandEntries, rightHandEntries, options);
818
+ }
819
+ if (leftHandKeys.length === 0 && leftHandEntries.length === 0 && rightHandKeys.length === 0 && rightHandEntries.length === 0) {
820
+ return true;
821
+ }
822
+ return false;
823
+ }
824
+ function isPrimitive(value) {
825
+ return value === null || typeof value !== "object";
826
+ }
827
+ function mapSymbols(arr) {
828
+ return arr.map(/* @__PURE__ */ __name(function mapSymbol(entry) {
829
+ if (typeof entry === "symbol") {
830
+ return entry.toString();
831
+ }
832
+ return entry;
833
+ }, "mapSymbol"));
834
+ }
835
+ function hasProperty(obj, name) {
836
+ if (typeof obj === "undefined" || obj === null) {
837
+ return false;
838
+ }
839
+ return name in Object(obj);
840
+ }
841
+ function parsePath(path) {
842
+ const str = path.replace(/([^\\])\[/g, "$1.[");
843
+ const parts = str.match(/(\\\.|[^.]+?)+/g);
844
+ return parts.map((value) => {
845
+ if (value === "constructor" || value === "__proto__" || value === "prototype") {
846
+ return {};
847
+ }
848
+ const regexp = /^\[(\d+)\]$/;
849
+ const mArr = regexp.exec(value);
850
+ let parsed = null;
851
+ if (mArr) {
852
+ parsed = { i: parseFloat(mArr[1]) };
853
+ } else {
854
+ parsed = { p: value.replace(/\\([.[\]])/g, "$1") };
855
+ }
856
+ return parsed;
857
+ });
858
+ }
859
+ function internalGetPathValue(obj, parsed, pathDepth) {
860
+ let temporaryValue = obj;
861
+ let res = null;
862
+ pathDepth = typeof pathDepth === "undefined" ? parsed.length : pathDepth;
863
+ for (let i = 0;i < pathDepth; i++) {
864
+ const part = parsed[i];
865
+ if (temporaryValue) {
866
+ if (typeof part.p === "undefined") {
867
+ temporaryValue = temporaryValue[part.i];
868
+ } else {
869
+ temporaryValue = temporaryValue[part.p];
870
+ }
871
+ if (i === pathDepth - 1) {
872
+ res = temporaryValue;
873
+ }
874
+ }
875
+ }
876
+ return res;
877
+ }
878
+ function getPathInfo(obj, path) {
879
+ const parsed = parsePath(path);
880
+ const last = parsed[parsed.length - 1];
881
+ const info = {
882
+ parent: parsed.length > 1 ? internalGetPathValue(obj, parsed, parsed.length - 1) : obj,
883
+ name: last.p || last.i,
884
+ value: internalGetPathValue(obj, parsed)
885
+ };
886
+ info.exists = hasProperty(info.parent, info.name);
887
+ return info;
888
+ }
889
+ function isProxyEnabled() {
890
+ return config.useProxy && typeof Proxy !== "undefined" && typeof Reflect !== "undefined";
891
+ }
892
+ function addProperty(ctx, name, getter) {
893
+ getter = getter === undefined ? function() {} : getter;
894
+ Object.defineProperty(ctx, name, {
895
+ get: /* @__PURE__ */ __name(function propertyGetter() {
896
+ if (!isProxyEnabled() && !flag(this, "lockSsfi")) {
897
+ flag(this, "ssfi", propertyGetter);
898
+ }
899
+ let result = getter.call(this);
900
+ if (result !== undefined)
901
+ return result;
902
+ let newAssertion = new Assertion;
903
+ transferFlags(this, newAssertion);
904
+ return newAssertion;
905
+ }, "propertyGetter"),
906
+ configurable: true
907
+ });
908
+ events.dispatchEvent(new PluginEvent("addProperty", name, getter));
909
+ }
910
+ function addLengthGuard(fn, assertionName, isChainable) {
911
+ if (!fnLengthDesc.configurable)
912
+ return fn;
913
+ Object.defineProperty(fn, "length", {
914
+ get: /* @__PURE__ */ __name(function() {
915
+ if (isChainable) {
916
+ throw Error("Invalid Chai property: " + assertionName + '.length. Due to a compatibility issue, "length" cannot directly follow "' + assertionName + '". Use "' + assertionName + '.lengthOf" instead.');
917
+ }
918
+ throw Error("Invalid Chai property: " + assertionName + '.length. See docs for proper usage of "' + assertionName + '".');
919
+ }, "get")
920
+ });
921
+ return fn;
922
+ }
923
+ function getProperties(object) {
924
+ let result = Object.getOwnPropertyNames(object);
925
+ function addProperty2(property) {
926
+ if (result.indexOf(property) === -1) {
927
+ result.push(property);
928
+ }
929
+ }
930
+ __name(addProperty2, "addProperty");
931
+ let proto = Object.getPrototypeOf(object);
932
+ while (proto !== null) {
933
+ Object.getOwnPropertyNames(proto).forEach(addProperty2);
934
+ proto = Object.getPrototypeOf(proto);
935
+ }
936
+ return result;
937
+ }
938
+ function proxify(obj, nonChainableMethodName) {
939
+ if (!isProxyEnabled())
940
+ return obj;
941
+ return new Proxy(obj, {
942
+ get: /* @__PURE__ */ __name(function proxyGetter(target, property) {
943
+ if (typeof property === "string" && config.proxyExcludedKeys.indexOf(property) === -1 && !Reflect.has(target, property)) {
944
+ if (nonChainableMethodName) {
945
+ throw Error("Invalid Chai property: " + nonChainableMethodName + "." + property + '. See docs for proper usage of "' + nonChainableMethodName + '".');
946
+ }
947
+ let suggestion = null;
948
+ let suggestionDistance = 4;
949
+ getProperties(target).forEach(function(prop) {
950
+ if (!Object.prototype.hasOwnProperty(prop) && builtins.indexOf(prop) === -1) {
951
+ let dist = stringDistanceCapped(property, prop, suggestionDistance);
952
+ if (dist < suggestionDistance) {
953
+ suggestion = prop;
954
+ suggestionDistance = dist;
955
+ }
956
+ }
957
+ });
958
+ if (suggestion !== null) {
959
+ throw Error("Invalid Chai property: " + property + '. Did you mean "' + suggestion + '"?');
960
+ } else {
961
+ throw Error("Invalid Chai property: " + property);
962
+ }
963
+ }
964
+ if (builtins.indexOf(property) === -1 && !flag(target, "lockSsfi")) {
965
+ flag(target, "ssfi", proxyGetter);
966
+ }
967
+ return Reflect.get(target, property);
968
+ }, "proxyGetter")
969
+ });
970
+ }
971
+ function stringDistanceCapped(strA, strB, cap) {
972
+ if (Math.abs(strA.length - strB.length) >= cap) {
973
+ return cap;
974
+ }
975
+ let memo = [];
976
+ for (let i = 0;i <= strA.length; i++) {
977
+ memo[i] = Array(strB.length + 1).fill(0);
978
+ memo[i][0] = i;
979
+ }
980
+ for (let j = 0;j < strB.length; j++) {
981
+ memo[0][j] = j;
982
+ }
983
+ for (let i = 1;i <= strA.length; i++) {
984
+ let ch = strA.charCodeAt(i - 1);
985
+ for (let j = 1;j <= strB.length; j++) {
986
+ if (Math.abs(i - j) >= cap) {
987
+ memo[i][j] = cap;
988
+ continue;
989
+ }
990
+ memo[i][j] = Math.min(memo[i - 1][j] + 1, memo[i][j - 1] + 1, memo[i - 1][j - 1] + (ch === strB.charCodeAt(j - 1) ? 0 : 1));
991
+ }
992
+ }
993
+ return memo[strA.length][strB.length];
994
+ }
995
+ function addMethod(ctx, name, method) {
996
+ let methodWrapper = /* @__PURE__ */ __name(function() {
997
+ if (!flag(this, "lockSsfi")) {
998
+ flag(this, "ssfi", methodWrapper);
999
+ }
1000
+ let result = method.apply(this, arguments);
1001
+ if (result !== undefined)
1002
+ return result;
1003
+ let newAssertion = new Assertion;
1004
+ transferFlags(this, newAssertion);
1005
+ return newAssertion;
1006
+ }, "methodWrapper");
1007
+ addLengthGuard(methodWrapper, name, false);
1008
+ ctx[name] = proxify(methodWrapper, name);
1009
+ events.dispatchEvent(new PluginEvent("addMethod", name, method));
1010
+ }
1011
+ function overwriteProperty(ctx, name, getter) {
1012
+ let _get = Object.getOwnPropertyDescriptor(ctx, name), _super = /* @__PURE__ */ __name(function() {}, "_super");
1013
+ if (_get && typeof _get.get === "function")
1014
+ _super = _get.get;
1015
+ Object.defineProperty(ctx, name, {
1016
+ get: /* @__PURE__ */ __name(function overwritingPropertyGetter() {
1017
+ if (!isProxyEnabled() && !flag(this, "lockSsfi")) {
1018
+ flag(this, "ssfi", overwritingPropertyGetter);
1019
+ }
1020
+ let origLockSsfi = flag(this, "lockSsfi");
1021
+ flag(this, "lockSsfi", true);
1022
+ let result = getter(_super).call(this);
1023
+ flag(this, "lockSsfi", origLockSsfi);
1024
+ if (result !== undefined) {
1025
+ return result;
1026
+ }
1027
+ let newAssertion = new Assertion;
1028
+ transferFlags(this, newAssertion);
1029
+ return newAssertion;
1030
+ }, "overwritingPropertyGetter"),
1031
+ configurable: true
1032
+ });
1033
+ }
1034
+ function overwriteMethod(ctx, name, method) {
1035
+ let _method = ctx[name], _super = /* @__PURE__ */ __name(function() {
1036
+ throw new Error(name + " is not a function");
1037
+ }, "_super");
1038
+ if (_method && typeof _method === "function")
1039
+ _super = _method;
1040
+ let overwritingMethodWrapper = /* @__PURE__ */ __name(function() {
1041
+ if (!flag(this, "lockSsfi")) {
1042
+ flag(this, "ssfi", overwritingMethodWrapper);
1043
+ }
1044
+ let origLockSsfi = flag(this, "lockSsfi");
1045
+ flag(this, "lockSsfi", true);
1046
+ let result = method(_super).apply(this, arguments);
1047
+ flag(this, "lockSsfi", origLockSsfi);
1048
+ if (result !== undefined) {
1049
+ return result;
1050
+ }
1051
+ let newAssertion = new Assertion;
1052
+ transferFlags(this, newAssertion);
1053
+ return newAssertion;
1054
+ }, "overwritingMethodWrapper");
1055
+ addLengthGuard(overwritingMethodWrapper, name, false);
1056
+ ctx[name] = proxify(overwritingMethodWrapper, name);
1057
+ }
1058
+ function addChainableMethod(ctx, name, method, chainingBehavior) {
1059
+ if (typeof chainingBehavior !== "function") {
1060
+ chainingBehavior = /* @__PURE__ */ __name(function() {}, "chainingBehavior");
1061
+ }
1062
+ let chainableBehavior = {
1063
+ method,
1064
+ chainingBehavior
1065
+ };
1066
+ if (!ctx.__methods) {
1067
+ ctx.__methods = {};
1068
+ }
1069
+ ctx.__methods[name] = chainableBehavior;
1070
+ Object.defineProperty(ctx, name, {
1071
+ get: /* @__PURE__ */ __name(function chainableMethodGetter() {
1072
+ chainableBehavior.chainingBehavior.call(this);
1073
+ let chainableMethodWrapper = /* @__PURE__ */ __name(function() {
1074
+ if (!flag(this, "lockSsfi")) {
1075
+ flag(this, "ssfi", chainableMethodWrapper);
1076
+ }
1077
+ let result = chainableBehavior.method.apply(this, arguments);
1078
+ if (result !== undefined) {
1079
+ return result;
1080
+ }
1081
+ let newAssertion = new Assertion;
1082
+ transferFlags(this, newAssertion);
1083
+ return newAssertion;
1084
+ }, "chainableMethodWrapper");
1085
+ addLengthGuard(chainableMethodWrapper, name, true);
1086
+ if (canSetPrototype) {
1087
+ let prototype = Object.create(this);
1088
+ prototype.call = call;
1089
+ prototype.apply = apply;
1090
+ Object.setPrototypeOf(chainableMethodWrapper, prototype);
1091
+ } else {
1092
+ let asserterNames = Object.getOwnPropertyNames(ctx);
1093
+ asserterNames.forEach(function(asserterName) {
1094
+ if (excludeNames.indexOf(asserterName) !== -1) {
1095
+ return;
1096
+ }
1097
+ let pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
1098
+ Object.defineProperty(chainableMethodWrapper, asserterName, pd);
1099
+ });
1100
+ }
1101
+ transferFlags(this, chainableMethodWrapper);
1102
+ return proxify(chainableMethodWrapper);
1103
+ }, "chainableMethodGetter"),
1104
+ configurable: true
1105
+ });
1106
+ events.dispatchEvent(new PluginAddChainableMethodEvent("addChainableMethod", name, method, chainingBehavior));
1107
+ }
1108
+ function overwriteChainableMethod(ctx, name, method, chainingBehavior) {
1109
+ let chainableBehavior = ctx.__methods[name];
1110
+ let _chainingBehavior = chainableBehavior.chainingBehavior;
1111
+ chainableBehavior.chainingBehavior = /* @__PURE__ */ __name(function overwritingChainableMethodGetter() {
1112
+ let result = chainingBehavior(_chainingBehavior).call(this);
1113
+ if (result !== undefined) {
1114
+ return result;
1115
+ }
1116
+ let newAssertion = new Assertion;
1117
+ transferFlags(this, newAssertion);
1118
+ return newAssertion;
1119
+ }, "overwritingChainableMethodGetter");
1120
+ let _method = chainableBehavior.method;
1121
+ chainableBehavior.method = /* @__PURE__ */ __name(function overwritingChainableMethodWrapper() {
1122
+ let result = method(_method).apply(this, arguments);
1123
+ if (result !== undefined) {
1124
+ return result;
1125
+ }
1126
+ let newAssertion = new Assertion;
1127
+ transferFlags(this, newAssertion);
1128
+ return newAssertion;
1129
+ }, "overwritingChainableMethodWrapper");
1130
+ }
1131
+ function compareByInspect(a, b) {
1132
+ return inspect2(a) < inspect2(b) ? -1 : 1;
1133
+ }
1134
+ function getOwnEnumerablePropertySymbols(obj) {
1135
+ if (typeof Object.getOwnPropertySymbols !== "function")
1136
+ return [];
1137
+ return Object.getOwnPropertySymbols(obj).filter(function(sym) {
1138
+ return Object.getOwnPropertyDescriptor(obj, sym).enumerable;
1139
+ });
1140
+ }
1141
+ function getOwnEnumerableProperties(obj) {
1142
+ return Object.keys(obj).concat(getOwnEnumerablePropertySymbols(obj));
1143
+ }
1144
+ function isObjectType(obj) {
1145
+ let objectType = type(obj);
1146
+ let objectTypes = ["Array", "Object", "Function"];
1147
+ return objectTypes.indexOf(objectType) !== -1;
1148
+ }
1149
+ function getOperator(obj, args) {
1150
+ let operator = flag(obj, "operator");
1151
+ let negate = flag(obj, "negate");
1152
+ let expected = args[3];
1153
+ let msg = negate ? args[2] : args[1];
1154
+ if (operator) {
1155
+ return operator;
1156
+ }
1157
+ if (typeof msg === "function")
1158
+ msg = msg();
1159
+ msg = msg || "";
1160
+ if (!msg) {
1161
+ return;
1162
+ }
1163
+ if (/\shave\s/.test(msg)) {
1164
+ return;
1165
+ }
1166
+ let isObject = isObjectType(expected);
1167
+ if (/\snot\s/.test(msg)) {
1168
+ return isObject ? "notDeepStrictEqual" : "notStrictEqual";
1169
+ }
1170
+ return isObject ? "deepStrictEqual" : "strictEqual";
1171
+ }
1172
+ function getName(fn) {
1173
+ return fn.name;
1174
+ }
1175
+ function isRegExp2(obj) {
1176
+ return Object.prototype.toString.call(obj) === "[object RegExp]";
1177
+ }
1178
+ function isNumeric(obj) {
1179
+ return ["Number", "BigInt"].includes(type(obj));
1180
+ }
1181
+ function an(type3, msg) {
1182
+ if (msg)
1183
+ flag2(this, "message", msg);
1184
+ type3 = type3.toLowerCase();
1185
+ let obj = flag2(this, "object"), article = ~["a", "e", "i", "o", "u"].indexOf(type3.charAt(0)) ? "an " : "a ";
1186
+ const detectedType = type(obj).toLowerCase();
1187
+ if (functionTypes["function"].includes(type3)) {
1188
+ this.assert(functionTypes[type3].includes(detectedType), "expected #{this} to be " + article + type3, "expected #{this} not to be " + article + type3);
1189
+ } else {
1190
+ this.assert(type3 === detectedType, "expected #{this} to be " + article + type3, "expected #{this} not to be " + article + type3);
1191
+ }
1192
+ }
1193
+ function SameValueZero(a, b) {
1194
+ return isNaN2(a) && isNaN2(b) || a === b;
1195
+ }
1196
+ function includeChainingBehavior() {
1197
+ flag2(this, "contains", true);
1198
+ }
1199
+ function include(val, msg) {
1200
+ if (msg)
1201
+ flag2(this, "message", msg);
1202
+ let obj = flag2(this, "object"), objType = type(obj).toLowerCase(), flagMsg = flag2(this, "message"), negate = flag2(this, "negate"), ssfi = flag2(this, "ssfi"), isDeep = flag2(this, "deep"), descriptor = isDeep ? "deep " : "", isEql = isDeep ? flag2(this, "eql") : SameValueZero;
1203
+ flagMsg = flagMsg ? flagMsg + ": " : "";
1204
+ let included = false;
1205
+ switch (objType) {
1206
+ case "string":
1207
+ included = obj.indexOf(val) !== -1;
1208
+ break;
1209
+ case "weakset":
1210
+ if (isDeep) {
1211
+ throw new AssertionError(flagMsg + "unable to use .deep.include with WeakSet", undefined, ssfi);
1212
+ }
1213
+ included = obj.has(val);
1214
+ break;
1215
+ case "map":
1216
+ obj.forEach(function(item) {
1217
+ included = included || isEql(item, val);
1218
+ });
1219
+ break;
1220
+ case "set":
1221
+ if (isDeep) {
1222
+ obj.forEach(function(item) {
1223
+ included = included || isEql(item, val);
1224
+ });
1225
+ } else {
1226
+ included = obj.has(val);
1227
+ }
1228
+ break;
1229
+ case "array":
1230
+ if (isDeep) {
1231
+ included = obj.some(function(item) {
1232
+ return isEql(item, val);
1233
+ });
1234
+ } else {
1235
+ included = obj.indexOf(val) !== -1;
1236
+ }
1237
+ break;
1238
+ default: {
1239
+ if (val !== Object(val)) {
1240
+ throw new AssertionError(flagMsg + "the given combination of arguments (" + objType + " and " + type(val).toLowerCase() + ") is invalid for this assertion. You can use an array, a map, an object, a set, a string, or a weakset instead of a " + type(val).toLowerCase(), undefined, ssfi);
1241
+ }
1242
+ let props = Object.keys(val);
1243
+ let firstErr = null;
1244
+ let numErrs = 0;
1245
+ props.forEach(function(prop) {
1246
+ let propAssertion = new Assertion(obj);
1247
+ transferFlags(this, propAssertion, true);
1248
+ flag2(propAssertion, "lockSsfi", true);
1249
+ if (!negate || props.length === 1) {
1250
+ propAssertion.property(prop, val[prop]);
1251
+ return;
1252
+ }
1253
+ try {
1254
+ propAssertion.property(prop, val[prop]);
1255
+ } catch (err) {
1256
+ if (!check_error_exports.compatibleConstructor(err, AssertionError)) {
1257
+ throw err;
1258
+ }
1259
+ if (firstErr === null)
1260
+ firstErr = err;
1261
+ numErrs++;
1262
+ }
1263
+ }, this);
1264
+ if (negate && props.length > 1 && numErrs === props.length) {
1265
+ throw firstErr;
1266
+ }
1267
+ return;
1268
+ }
1269
+ }
1270
+ this.assert(included, "expected #{this} to " + descriptor + "include " + inspect2(val), "expected #{this} to not " + descriptor + "include " + inspect2(val));
1271
+ }
1272
+ function assertExist() {
1273
+ let val = flag2(this, "object");
1274
+ this.assert(val !== null && val !== undefined, "expected #{this} to exist", "expected #{this} to not exist");
1275
+ }
1276
+ function checkArguments() {
1277
+ let obj = flag2(this, "object"), type3 = type(obj);
1278
+ this.assert(type3 === "Arguments", "expected #{this} to be arguments but got " + type3, "expected #{this} to not be arguments");
1279
+ }
1280
+ function assertEqual(val, msg) {
1281
+ if (msg)
1282
+ flag2(this, "message", msg);
1283
+ let obj = flag2(this, "object");
1284
+ if (flag2(this, "deep")) {
1285
+ let prevLockSsfi = flag2(this, "lockSsfi");
1286
+ flag2(this, "lockSsfi", true);
1287
+ this.eql(val);
1288
+ flag2(this, "lockSsfi", prevLockSsfi);
1289
+ } else {
1290
+ this.assert(val === obj, "expected #{this} to equal #{exp}", "expected #{this} to not equal #{exp}", val, this._obj, true);
1291
+ }
1292
+ }
1293
+ function assertEql(obj, msg) {
1294
+ if (msg)
1295
+ flag2(this, "message", msg);
1296
+ let eql = flag2(this, "eql");
1297
+ this.assert(eql(obj, flag2(this, "object")), "expected #{this} to deeply equal #{exp}", "expected #{this} to not deeply equal #{exp}", obj, this._obj, true);
1298
+ }
1299
+ function assertAbove(n, msg) {
1300
+ if (msg)
1301
+ flag2(this, "message", msg);
1302
+ let obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase();
1303
+ if (doLength && objType !== "map" && objType !== "set") {
1304
+ new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
1305
+ }
1306
+ if (!doLength && objType === "date" && nType !== "date") {
1307
+ throw new AssertionError(msgPrefix + "the argument to above must be a date", undefined, ssfi);
1308
+ } else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
1309
+ throw new AssertionError(msgPrefix + "the argument to above must be a number", undefined, ssfi);
1310
+ } else if (!doLength && objType !== "date" && !isNumeric(obj)) {
1311
+ let printObj = objType === "string" ? "'" + obj + "'" : obj;
1312
+ throw new AssertionError(msgPrefix + "expected " + printObj + " to be a number or a date", undefined, ssfi);
1313
+ }
1314
+ if (doLength) {
1315
+ let descriptor = "length", itemsCount;
1316
+ if (objType === "map" || objType === "set") {
1317
+ descriptor = "size";
1318
+ itemsCount = obj.size;
1319
+ } else {
1320
+ itemsCount = obj.length;
1321
+ }
1322
+ this.assert(itemsCount > n, "expected #{this} to have a " + descriptor + " above #{exp} but got #{act}", "expected #{this} to not have a " + descriptor + " above #{exp}", n, itemsCount);
1323
+ } else {
1324
+ this.assert(obj > n, "expected #{this} to be above #{exp}", "expected #{this} to be at most #{exp}", n);
1325
+ }
1326
+ }
1327
+ function assertLeast(n, msg) {
1328
+ if (msg)
1329
+ flag2(this, "message", msg);
1330
+ let obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true;
1331
+ if (doLength && objType !== "map" && objType !== "set") {
1332
+ new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
1333
+ }
1334
+ if (!doLength && objType === "date" && nType !== "date") {
1335
+ errorMessage = msgPrefix + "the argument to least must be a date";
1336
+ } else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
1337
+ errorMessage = msgPrefix + "the argument to least must be a number";
1338
+ } else if (!doLength && objType !== "date" && !isNumeric(obj)) {
1339
+ let printObj = objType === "string" ? "'" + obj + "'" : obj;
1340
+ errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
1341
+ } else {
1342
+ shouldThrow = false;
1343
+ }
1344
+ if (shouldThrow) {
1345
+ throw new AssertionError(errorMessage, undefined, ssfi);
1346
+ }
1347
+ if (doLength) {
1348
+ let descriptor = "length", itemsCount;
1349
+ if (objType === "map" || objType === "set") {
1350
+ descriptor = "size";
1351
+ itemsCount = obj.size;
1352
+ } else {
1353
+ itemsCount = obj.length;
1354
+ }
1355
+ this.assert(itemsCount >= n, "expected #{this} to have a " + descriptor + " at least #{exp} but got #{act}", "expected #{this} to have a " + descriptor + " below #{exp}", n, itemsCount);
1356
+ } else {
1357
+ this.assert(obj >= n, "expected #{this} to be at least #{exp}", "expected #{this} to be below #{exp}", n);
1358
+ }
1359
+ }
1360
+ function assertBelow(n, msg) {
1361
+ if (msg)
1362
+ flag2(this, "message", msg);
1363
+ let obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true;
1364
+ if (doLength && objType !== "map" && objType !== "set") {
1365
+ new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
1366
+ }
1367
+ if (!doLength && objType === "date" && nType !== "date") {
1368
+ errorMessage = msgPrefix + "the argument to below must be a date";
1369
+ } else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
1370
+ errorMessage = msgPrefix + "the argument to below must be a number";
1371
+ } else if (!doLength && objType !== "date" && !isNumeric(obj)) {
1372
+ let printObj = objType === "string" ? "'" + obj + "'" : obj;
1373
+ errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
1374
+ } else {
1375
+ shouldThrow = false;
1376
+ }
1377
+ if (shouldThrow) {
1378
+ throw new AssertionError(errorMessage, undefined, ssfi);
1379
+ }
1380
+ if (doLength) {
1381
+ let descriptor = "length", itemsCount;
1382
+ if (objType === "map" || objType === "set") {
1383
+ descriptor = "size";
1384
+ itemsCount = obj.size;
1385
+ } else {
1386
+ itemsCount = obj.length;
1387
+ }
1388
+ this.assert(itemsCount < n, "expected #{this} to have a " + descriptor + " below #{exp} but got #{act}", "expected #{this} to not have a " + descriptor + " below #{exp}", n, itemsCount);
1389
+ } else {
1390
+ this.assert(obj < n, "expected #{this} to be below #{exp}", "expected #{this} to be at least #{exp}", n);
1391
+ }
1392
+ }
1393
+ function assertMost(n, msg) {
1394
+ if (msg)
1395
+ flag2(this, "message", msg);
1396
+ let obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true;
1397
+ if (doLength && objType !== "map" && objType !== "set") {
1398
+ new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
1399
+ }
1400
+ if (!doLength && objType === "date" && nType !== "date") {
1401
+ errorMessage = msgPrefix + "the argument to most must be a date";
1402
+ } else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
1403
+ errorMessage = msgPrefix + "the argument to most must be a number";
1404
+ } else if (!doLength && objType !== "date" && !isNumeric(obj)) {
1405
+ let printObj = objType === "string" ? "'" + obj + "'" : obj;
1406
+ errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
1407
+ } else {
1408
+ shouldThrow = false;
1409
+ }
1410
+ if (shouldThrow) {
1411
+ throw new AssertionError(errorMessage, undefined, ssfi);
1412
+ }
1413
+ if (doLength) {
1414
+ let descriptor = "length", itemsCount;
1415
+ if (objType === "map" || objType === "set") {
1416
+ descriptor = "size";
1417
+ itemsCount = obj.size;
1418
+ } else {
1419
+ itemsCount = obj.length;
1420
+ }
1421
+ this.assert(itemsCount <= n, "expected #{this} to have a " + descriptor + " at most #{exp} but got #{act}", "expected #{this} to have a " + descriptor + " above #{exp}", n, itemsCount);
1422
+ } else {
1423
+ this.assert(obj <= n, "expected #{this} to be at most #{exp}", "expected #{this} to be above #{exp}", n);
1424
+ }
1425
+ }
1426
+ function assertInstanceOf(constructor, msg) {
1427
+ if (msg)
1428
+ flag2(this, "message", msg);
1429
+ let target = flag2(this, "object");
1430
+ let ssfi = flag2(this, "ssfi");
1431
+ let flagMsg = flag2(this, "message");
1432
+ let isInstanceOf;
1433
+ try {
1434
+ isInstanceOf = target instanceof constructor;
1435
+ } catch (err) {
1436
+ if (err instanceof TypeError) {
1437
+ flagMsg = flagMsg ? flagMsg + ": " : "";
1438
+ throw new AssertionError(flagMsg + "The instanceof assertion needs a constructor but " + type(constructor) + " was given.", undefined, ssfi);
1439
+ }
1440
+ throw err;
1441
+ }
1442
+ let name = getName(constructor);
1443
+ if (name == null) {
1444
+ name = "an unnamed constructor";
1445
+ }
1446
+ this.assert(isInstanceOf, "expected #{this} to be an instance of " + name, "expected #{this} to not be an instance of " + name);
1447
+ }
1448
+ function assertProperty(name, val, msg) {
1449
+ if (msg)
1450
+ flag2(this, "message", msg);
1451
+ let isNested = flag2(this, "nested"), isOwn = flag2(this, "own"), flagMsg = flag2(this, "message"), obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), nameType = typeof name;
1452
+ flagMsg = flagMsg ? flagMsg + ": " : "";
1453
+ if (isNested) {
1454
+ if (nameType !== "string") {
1455
+ throw new AssertionError(flagMsg + "the argument to property must be a string when using nested syntax", undefined, ssfi);
1456
+ }
1457
+ } else {
1458
+ if (nameType !== "string" && nameType !== "number" && nameType !== "symbol") {
1459
+ throw new AssertionError(flagMsg + "the argument to property must be a string, number, or symbol", undefined, ssfi);
1460
+ }
1461
+ }
1462
+ if (isNested && isOwn) {
1463
+ throw new AssertionError(flagMsg + 'The "nested" and "own" flags cannot be combined.', undefined, ssfi);
1464
+ }
1465
+ if (obj === null || obj === undefined) {
1466
+ throw new AssertionError(flagMsg + "Target cannot be null or undefined.", undefined, ssfi);
1467
+ }
1468
+ let isDeep = flag2(this, "deep"), negate = flag2(this, "negate"), pathInfo = isNested ? getPathInfo(obj, name) : null, value = isNested ? pathInfo.value : obj[name], isEql = isDeep ? flag2(this, "eql") : (val1, val2) => val1 === val2;
1469
+ let descriptor = "";
1470
+ if (isDeep)
1471
+ descriptor += "deep ";
1472
+ if (isOwn)
1473
+ descriptor += "own ";
1474
+ if (isNested)
1475
+ descriptor += "nested ";
1476
+ descriptor += "property ";
1477
+ let hasProperty2;
1478
+ if (isOwn)
1479
+ hasProperty2 = Object.prototype.hasOwnProperty.call(obj, name);
1480
+ else if (isNested)
1481
+ hasProperty2 = pathInfo.exists;
1482
+ else
1483
+ hasProperty2 = hasProperty(obj, name);
1484
+ if (!negate || arguments.length === 1) {
1485
+ this.assert(hasProperty2, "expected #{this} to have " + descriptor + inspect2(name), "expected #{this} to not have " + descriptor + inspect2(name));
1486
+ }
1487
+ if (arguments.length > 1) {
1488
+ this.assert(hasProperty2 && isEql(val, value), "expected #{this} to have " + descriptor + inspect2(name) + " of #{exp}, but got #{act}", "expected #{this} to not have " + descriptor + inspect2(name) + " of #{act}", val, value);
1489
+ }
1490
+ flag2(this, "object", value);
1491
+ }
1492
+ function assertOwnProperty(_name, _value, _msg) {
1493
+ flag2(this, "own", true);
1494
+ assertProperty.apply(this, arguments);
1495
+ }
1496
+ function assertOwnPropertyDescriptor(name, descriptor, msg) {
1497
+ if (typeof descriptor === "string") {
1498
+ msg = descriptor;
1499
+ descriptor = null;
1500
+ }
1501
+ if (msg)
1502
+ flag2(this, "message", msg);
1503
+ let obj = flag2(this, "object");
1504
+ let actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name);
1505
+ let eql = flag2(this, "eql");
1506
+ if (actualDescriptor && descriptor) {
1507
+ this.assert(eql(descriptor, actualDescriptor), "expected the own property descriptor for " + inspect2(name) + " on #{this} to match " + inspect2(descriptor) + ", got " + inspect2(actualDescriptor), "expected the own property descriptor for " + inspect2(name) + " on #{this} to not match " + inspect2(descriptor), descriptor, actualDescriptor, true);
1508
+ } else {
1509
+ this.assert(actualDescriptor, "expected #{this} to have an own property descriptor for " + inspect2(name), "expected #{this} to not have an own property descriptor for " + inspect2(name));
1510
+ }
1511
+ flag2(this, "object", actualDescriptor);
1512
+ }
1513
+ function assertLengthChain() {
1514
+ flag2(this, "doLength", true);
1515
+ }
1516
+ function assertLength(n, msg) {
1517
+ if (msg)
1518
+ flag2(this, "message", msg);
1519
+ let obj = flag2(this, "object"), objType = type(obj).toLowerCase(), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), descriptor = "length", itemsCount;
1520
+ switch (objType) {
1521
+ case "map":
1522
+ case "set":
1523
+ descriptor = "size";
1524
+ itemsCount = obj.size;
1525
+ break;
1526
+ default:
1527
+ new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
1528
+ itemsCount = obj.length;
1529
+ }
1530
+ this.assert(itemsCount == n, "expected #{this} to have a " + descriptor + " of #{exp} but got #{act}", "expected #{this} to not have a " + descriptor + " of #{act}", n, itemsCount);
1531
+ }
1532
+ function assertMatch(re, msg) {
1533
+ if (msg)
1534
+ flag2(this, "message", msg);
1535
+ let obj = flag2(this, "object");
1536
+ this.assert(re.exec(obj), "expected #{this} to match " + re, "expected #{this} not to match " + re);
1537
+ }
1538
+ function assertKeys(keys) {
1539
+ let obj = flag2(this, "object"), objType = type(obj), keysType = type(keys), ssfi = flag2(this, "ssfi"), isDeep = flag2(this, "deep"), str, deepStr = "", actual, ok = true, flagMsg = flag2(this, "message");
1540
+ flagMsg = flagMsg ? flagMsg + ": " : "";
1541
+ let mixedArgsMsg = flagMsg + "when testing keys against an object or an array you must give a single Array|Object|String argument or multiple String arguments";
1542
+ if (objType === "Map" || objType === "Set") {
1543
+ deepStr = isDeep ? "deeply " : "";
1544
+ actual = [];
1545
+ obj.forEach(function(val, key) {
1546
+ actual.push(key);
1547
+ });
1548
+ if (keysType !== "Array") {
1549
+ keys = Array.prototype.slice.call(arguments);
1550
+ }
1551
+ } else {
1552
+ actual = getOwnEnumerableProperties(obj);
1553
+ switch (keysType) {
1554
+ case "Array":
1555
+ if (arguments.length > 1) {
1556
+ throw new AssertionError(mixedArgsMsg, undefined, ssfi);
1557
+ }
1558
+ break;
1559
+ case "Object":
1560
+ if (arguments.length > 1) {
1561
+ throw new AssertionError(mixedArgsMsg, undefined, ssfi);
1562
+ }
1563
+ keys = Object.keys(keys);
1564
+ break;
1565
+ default:
1566
+ keys = Array.prototype.slice.call(arguments);
1567
+ }
1568
+ keys = keys.map(function(val) {
1569
+ return typeof val === "symbol" ? val : String(val);
1570
+ });
1571
+ }
1572
+ if (!keys.length) {
1573
+ throw new AssertionError(flagMsg + "keys required", undefined, ssfi);
1574
+ }
1575
+ let len = keys.length, any = flag2(this, "any"), all = flag2(this, "all"), expected = keys, isEql = isDeep ? flag2(this, "eql") : (val1, val2) => val1 === val2;
1576
+ if (!any && !all) {
1577
+ all = true;
1578
+ }
1579
+ if (any) {
1580
+ ok = expected.some(function(expectedKey) {
1581
+ return actual.some(function(actualKey) {
1582
+ return isEql(expectedKey, actualKey);
1583
+ });
1584
+ });
1585
+ }
1586
+ if (all) {
1587
+ ok = expected.every(function(expectedKey) {
1588
+ return actual.some(function(actualKey) {
1589
+ return isEql(expectedKey, actualKey);
1590
+ });
1591
+ });
1592
+ if (!flag2(this, "contains")) {
1593
+ ok = ok && keys.length == actual.length;
1594
+ }
1595
+ }
1596
+ if (len > 1) {
1597
+ keys = keys.map(function(key) {
1598
+ return inspect2(key);
1599
+ });
1600
+ let last = keys.pop();
1601
+ if (all) {
1602
+ str = keys.join(", ") + ", and " + last;
1603
+ }
1604
+ if (any) {
1605
+ str = keys.join(", ") + ", or " + last;
1606
+ }
1607
+ } else {
1608
+ str = inspect2(keys[0]);
1609
+ }
1610
+ str = (len > 1 ? "keys " : "key ") + str;
1611
+ str = (flag2(this, "contains") ? "contain " : "have ") + str;
1612
+ this.assert(ok, "expected #{this} to " + deepStr + str, "expected #{this} to not " + deepStr + str, expected.slice(0).sort(compareByInspect), actual.sort(compareByInspect), true);
1613
+ }
1614
+ function assertThrows(errorLike, errMsgMatcher, msg) {
1615
+ if (msg)
1616
+ flag2(this, "message", msg);
1617
+ let obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), negate = flag2(this, "negate") || false;
1618
+ new Assertion(obj, flagMsg, ssfi, true).is.a("function");
1619
+ if (isRegExp2(errorLike) || typeof errorLike === "string") {
1620
+ errMsgMatcher = errorLike;
1621
+ errorLike = null;
1622
+ }
1623
+ let caughtErr;
1624
+ let errorWasThrown = false;
1625
+ try {
1626
+ obj();
1627
+ } catch (err) {
1628
+ errorWasThrown = true;
1629
+ caughtErr = err;
1630
+ }
1631
+ let everyArgIsUndefined = errorLike === undefined && errMsgMatcher === undefined;
1632
+ let everyArgIsDefined = Boolean(errorLike && errMsgMatcher);
1633
+ let errorLikeFail = false;
1634
+ let errMsgMatcherFail = false;
1635
+ if (everyArgIsUndefined || !everyArgIsUndefined && !negate) {
1636
+ let errorLikeString = "an error";
1637
+ if (errorLike instanceof Error) {
1638
+ errorLikeString = "#{exp}";
1639
+ } else if (errorLike) {
1640
+ errorLikeString = check_error_exports.getConstructorName(errorLike);
1641
+ }
1642
+ let actual = caughtErr;
1643
+ if (caughtErr instanceof Error) {
1644
+ actual = caughtErr.toString();
1645
+ } else if (typeof caughtErr === "string") {
1646
+ actual = caughtErr;
1647
+ } else if (caughtErr && (typeof caughtErr === "object" || typeof caughtErr === "function")) {
1648
+ try {
1649
+ actual = check_error_exports.getConstructorName(caughtErr);
1650
+ } catch (_err) {}
1651
+ }
1652
+ this.assert(errorWasThrown, "expected #{this} to throw " + errorLikeString, "expected #{this} to not throw an error but #{act} was thrown", errorLike && errorLike.toString(), actual);
1653
+ }
1654
+ if (errorLike && caughtErr) {
1655
+ if (errorLike instanceof Error) {
1656
+ let isCompatibleInstance = check_error_exports.compatibleInstance(caughtErr, errorLike);
1657
+ if (isCompatibleInstance === negate) {
1658
+ if (everyArgIsDefined && negate) {
1659
+ errorLikeFail = true;
1660
+ } else {
1661
+ this.assert(negate, "expected #{this} to throw #{exp} but #{act} was thrown", "expected #{this} to not throw #{exp}" + (caughtErr && !negate ? " but #{act} was thrown" : ""), errorLike.toString(), caughtErr.toString());
1662
+ }
1663
+ }
1664
+ }
1665
+ let isCompatibleConstructor = check_error_exports.compatibleConstructor(caughtErr, errorLike);
1666
+ if (isCompatibleConstructor === negate) {
1667
+ if (everyArgIsDefined && negate) {
1668
+ errorLikeFail = true;
1669
+ } else {
1670
+ this.assert(negate, "expected #{this} to throw #{exp} but #{act} was thrown", "expected #{this} to not throw #{exp}" + (caughtErr ? " but #{act} was thrown" : ""), errorLike instanceof Error ? errorLike.toString() : errorLike && check_error_exports.getConstructorName(errorLike), caughtErr instanceof Error ? caughtErr.toString() : caughtErr && check_error_exports.getConstructorName(caughtErr));
1671
+ }
1672
+ }
1673
+ }
1674
+ if (caughtErr && errMsgMatcher !== undefined && errMsgMatcher !== null) {
1675
+ let placeholder = "including";
1676
+ if (isRegExp2(errMsgMatcher)) {
1677
+ placeholder = "matching";
1678
+ }
1679
+ let isCompatibleMessage = check_error_exports.compatibleMessage(caughtErr, errMsgMatcher);
1680
+ if (isCompatibleMessage === negate) {
1681
+ if (everyArgIsDefined && negate) {
1682
+ errMsgMatcherFail = true;
1683
+ } else {
1684
+ this.assert(negate, "expected #{this} to throw error " + placeholder + " #{exp} but got #{act}", "expected #{this} to throw error not " + placeholder + " #{exp}", errMsgMatcher, check_error_exports.getMessage(caughtErr));
1685
+ }
1686
+ }
1687
+ }
1688
+ if (errorLikeFail && errMsgMatcherFail) {
1689
+ this.assert(negate, "expected #{this} to throw #{exp} but #{act} was thrown", "expected #{this} to not throw #{exp}" + (caughtErr ? " but #{act} was thrown" : ""), errorLike instanceof Error ? errorLike.toString() : errorLike && check_error_exports.getConstructorName(errorLike), caughtErr instanceof Error ? caughtErr.toString() : caughtErr && check_error_exports.getConstructorName(caughtErr));
1690
+ }
1691
+ flag2(this, "object", caughtErr);
1692
+ }
1693
+ function respondTo(method, msg) {
1694
+ if (msg)
1695
+ flag2(this, "message", msg);
1696
+ let obj = flag2(this, "object"), itself = flag2(this, "itself"), context = typeof obj === "function" && !itself ? obj.prototype[method] : obj[method];
1697
+ this.assert(typeof context === "function", "expected #{this} to respond to " + inspect2(method), "expected #{this} to not respond to " + inspect2(method));
1698
+ }
1699
+ function satisfy(matcher, msg) {
1700
+ if (msg)
1701
+ flag2(this, "message", msg);
1702
+ let obj = flag2(this, "object");
1703
+ let result = matcher(obj);
1704
+ this.assert(result, "expected #{this} to satisfy " + objDisplay(matcher), "expected #{this} to not satisfy" + objDisplay(matcher), flag2(this, "negate") ? false : true, result);
1705
+ }
1706
+ function closeTo(expected, delta, msg) {
1707
+ if (msg)
1708
+ flag2(this, "message", msg);
1709
+ let obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
1710
+ new Assertion(obj, flagMsg, ssfi, true).is.numeric;
1711
+ let message = "A `delta` value is required for `closeTo`";
1712
+ if (delta == undefined) {
1713
+ throw new AssertionError(flagMsg ? `${flagMsg}: ${message}` : message, undefined, ssfi);
1714
+ }
1715
+ new Assertion(delta, flagMsg, ssfi, true).is.numeric;
1716
+ message = "A `expected` value is required for `closeTo`";
1717
+ if (expected == undefined) {
1718
+ throw new AssertionError(flagMsg ? `${flagMsg}: ${message}` : message, undefined, ssfi);
1719
+ }
1720
+ new Assertion(expected, flagMsg, ssfi, true).is.numeric;
1721
+ const abs = /* @__PURE__ */ __name((x) => x < 0 ? -x : x, "abs");
1722
+ const strip = /* @__PURE__ */ __name((number) => parseFloat(parseFloat(number).toPrecision(12)), "strip");
1723
+ this.assert(strip(abs(obj - expected)) <= delta, "expected #{this} to be close to " + expected + " +/- " + delta, "expected #{this} not to be close to " + expected + " +/- " + delta);
1724
+ }
1725
+ function isSubsetOf(_subset, _superset, cmp, contains, ordered) {
1726
+ let superset = Array.from(_superset);
1727
+ let subset = Array.from(_subset);
1728
+ if (!contains) {
1729
+ if (subset.length !== superset.length)
1730
+ return false;
1731
+ superset = superset.slice();
1732
+ }
1733
+ return subset.every(function(elem, idx) {
1734
+ if (ordered)
1735
+ return cmp ? cmp(elem, superset[idx]) : elem === superset[idx];
1736
+ if (!cmp) {
1737
+ let matchIdx = superset.indexOf(elem);
1738
+ if (matchIdx === -1)
1739
+ return false;
1740
+ if (!contains)
1741
+ superset.splice(matchIdx, 1);
1742
+ return true;
1743
+ }
1744
+ return superset.some(function(elem2, matchIdx) {
1745
+ if (!cmp(elem, elem2))
1746
+ return false;
1747
+ if (!contains)
1748
+ superset.splice(matchIdx, 1);
1749
+ return true;
1750
+ });
1751
+ });
1752
+ }
1753
+ function oneOf(list, msg) {
1754
+ if (msg)
1755
+ flag2(this, "message", msg);
1756
+ let expected = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), contains = flag2(this, "contains"), isDeep = flag2(this, "deep"), eql = flag2(this, "eql");
1757
+ new Assertion(list, flagMsg, ssfi, true).to.be.an("array");
1758
+ if (contains) {
1759
+ this.assert(list.some(function(possibility) {
1760
+ return expected.indexOf(possibility) > -1;
1761
+ }), "expected #{this} to contain one of #{exp}", "expected #{this} to not contain one of #{exp}", list, expected);
1762
+ } else {
1763
+ if (isDeep) {
1764
+ this.assert(list.some(function(possibility) {
1765
+ return eql(expected, possibility);
1766
+ }), "expected #{this} to deeply equal one of #{exp}", "expected #{this} to deeply equal one of #{exp}", list, expected);
1767
+ } else {
1768
+ this.assert(list.indexOf(expected) > -1, "expected #{this} to be one of #{exp}", "expected #{this} to not be one of #{exp}", list, expected);
1769
+ }
1770
+ }
1771
+ }
1772
+ function assertChanges(subject, prop, msg) {
1773
+ if (msg)
1774
+ flag2(this, "message", msg);
1775
+ let fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
1776
+ new Assertion(fn, flagMsg, ssfi, true).is.a("function");
1777
+ let initial;
1778
+ if (!prop) {
1779
+ new Assertion(subject, flagMsg, ssfi, true).is.a("function");
1780
+ initial = subject();
1781
+ } else {
1782
+ new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);
1783
+ initial = subject[prop];
1784
+ }
1785
+ fn();
1786
+ let final = prop === undefined || prop === null ? subject() : subject[prop];
1787
+ let msgObj = prop === undefined || prop === null ? initial : "." + prop;
1788
+ flag2(this, "deltaMsgObj", msgObj);
1789
+ flag2(this, "initialDeltaValue", initial);
1790
+ flag2(this, "finalDeltaValue", final);
1791
+ flag2(this, "deltaBehavior", "change");
1792
+ flag2(this, "realDelta", final !== initial);
1793
+ this.assert(initial !== final, "expected " + msgObj + " to change", "expected " + msgObj + " to not change");
1794
+ }
1795
+ function assertIncreases(subject, prop, msg) {
1796
+ if (msg)
1797
+ flag2(this, "message", msg);
1798
+ let fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
1799
+ new Assertion(fn, flagMsg, ssfi, true).is.a("function");
1800
+ let initial;
1801
+ if (!prop) {
1802
+ new Assertion(subject, flagMsg, ssfi, true).is.a("function");
1803
+ initial = subject();
1804
+ } else {
1805
+ new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);
1806
+ initial = subject[prop];
1807
+ }
1808
+ new Assertion(initial, flagMsg, ssfi, true).is.a("number");
1809
+ fn();
1810
+ let final = prop === undefined || prop === null ? subject() : subject[prop];
1811
+ let msgObj = prop === undefined || prop === null ? initial : "." + prop;
1812
+ flag2(this, "deltaMsgObj", msgObj);
1813
+ flag2(this, "initialDeltaValue", initial);
1814
+ flag2(this, "finalDeltaValue", final);
1815
+ flag2(this, "deltaBehavior", "increase");
1816
+ flag2(this, "realDelta", final - initial);
1817
+ this.assert(final - initial > 0, "expected " + msgObj + " to increase", "expected " + msgObj + " to not increase");
1818
+ }
1819
+ function assertDecreases(subject, prop, msg) {
1820
+ if (msg)
1821
+ flag2(this, "message", msg);
1822
+ let fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
1823
+ new Assertion(fn, flagMsg, ssfi, true).is.a("function");
1824
+ let initial;
1825
+ if (!prop) {
1826
+ new Assertion(subject, flagMsg, ssfi, true).is.a("function");
1827
+ initial = subject();
1828
+ } else {
1829
+ new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);
1830
+ initial = subject[prop];
1831
+ }
1832
+ new Assertion(initial, flagMsg, ssfi, true).is.a("number");
1833
+ fn();
1834
+ let final = prop === undefined || prop === null ? subject() : subject[prop];
1835
+ let msgObj = prop === undefined || prop === null ? initial : "." + prop;
1836
+ flag2(this, "deltaMsgObj", msgObj);
1837
+ flag2(this, "initialDeltaValue", initial);
1838
+ flag2(this, "finalDeltaValue", final);
1839
+ flag2(this, "deltaBehavior", "decrease");
1840
+ flag2(this, "realDelta", initial - final);
1841
+ this.assert(final - initial < 0, "expected " + msgObj + " to decrease", "expected " + msgObj + " to not decrease");
1842
+ }
1843
+ function assertDelta(delta, msg) {
1844
+ if (msg)
1845
+ flag2(this, "message", msg);
1846
+ let msgObj = flag2(this, "deltaMsgObj");
1847
+ let initial = flag2(this, "initialDeltaValue");
1848
+ let final = flag2(this, "finalDeltaValue");
1849
+ let behavior = flag2(this, "deltaBehavior");
1850
+ let realDelta = flag2(this, "realDelta");
1851
+ let expression;
1852
+ if (behavior === "change") {
1853
+ expression = Math.abs(final - initial) === Math.abs(delta);
1854
+ } else {
1855
+ expression = realDelta === Math.abs(delta);
1856
+ }
1857
+ this.assert(expression, "expected " + msgObj + " to " + behavior + " by " + delta, "expected " + msgObj + " to not " + behavior + " by " + delta);
1858
+ }
1859
+ function compareSubset(expected, actual) {
1860
+ if (expected === actual) {
1861
+ return true;
1862
+ }
1863
+ if (typeof actual !== typeof expected) {
1864
+ return false;
1865
+ }
1866
+ if (typeof expected !== "object" || expected === null) {
1867
+ return expected === actual;
1868
+ }
1869
+ if (!actual) {
1870
+ return false;
1871
+ }
1872
+ if (Array.isArray(expected)) {
1873
+ if (!Array.isArray(actual)) {
1874
+ return false;
1875
+ }
1876
+ return expected.every(function(exp) {
1877
+ return actual.some(function(act) {
1878
+ return compareSubset(exp, act);
1879
+ });
1880
+ });
1881
+ }
1882
+ if (expected instanceof Date) {
1883
+ if (actual instanceof Date) {
1884
+ return expected.getTime() === actual.getTime();
1885
+ } else {
1886
+ return false;
1887
+ }
1888
+ }
1889
+ return Object.keys(expected).every(function(key) {
1890
+ let expectedValue = expected[key];
1891
+ let actualValue = actual[key];
1892
+ if (typeof expectedValue === "object" && expectedValue !== null && actualValue !== null) {
1893
+ return compareSubset(expectedValue, actualValue);
1894
+ }
1895
+ if (typeof expectedValue === "function") {
1896
+ return expectedValue(actualValue);
1897
+ }
1898
+ return actualValue === expectedValue;
1899
+ });
1900
+ }
1901
+ function expect(val, message) {
1902
+ return new Assertion(val, message);
1903
+ }
1904
+ function loadShould() {
1905
+ function shouldGetter() {
1906
+ if (this instanceof String || this instanceof Number || this instanceof Boolean || typeof Symbol === "function" && this instanceof Symbol || typeof BigInt === "function" && this instanceof BigInt) {
1907
+ return new Assertion(this.valueOf(), null, shouldGetter);
1908
+ }
1909
+ return new Assertion(this, null, shouldGetter);
1910
+ }
1911
+ __name(shouldGetter, "shouldGetter");
1912
+ function shouldSetter(value) {
1913
+ Object.defineProperty(this, "should", {
1914
+ value,
1915
+ enumerable: true,
1916
+ configurable: true,
1917
+ writable: true
1918
+ });
1919
+ }
1920
+ __name(shouldSetter, "shouldSetter");
1921
+ Object.defineProperty(Object.prototype, "should", {
1922
+ set: shouldSetter,
1923
+ get: shouldGetter,
1924
+ configurable: true
1925
+ });
1926
+ let should2 = {};
1927
+ should2.fail = function(actual, expected, message, operator) {
1928
+ if (arguments.length < 2) {
1929
+ message = actual;
1930
+ actual = undefined;
1931
+ }
1932
+ message = message || "should.fail()";
1933
+ throw new AssertionError(message, {
1934
+ actual,
1935
+ expected,
1936
+ operator
1937
+ }, should2.fail);
1938
+ };
1939
+ should2.equal = function(actual, expected, message) {
1940
+ new Assertion(actual, message).to.equal(expected);
1941
+ };
1942
+ should2.Throw = function(fn, errt, errs, msg) {
1943
+ new Assertion(fn, msg).to.Throw(errt, errs);
1944
+ };
1945
+ should2.exist = function(val, msg) {
1946
+ new Assertion(val, msg).to.exist;
1947
+ };
1948
+ should2.not = {};
1949
+ should2.not.equal = function(actual, expected, msg) {
1950
+ new Assertion(actual, msg).to.not.equal(expected);
1951
+ };
1952
+ should2.not.Throw = function(fn, errt, errs, msg) {
1953
+ new Assertion(fn, msg).to.not.Throw(errt, errs);
1954
+ };
1955
+ should2.not.exist = function(val, msg) {
1956
+ new Assertion(val, msg).to.not.exist;
1957
+ };
1958
+ should2["throw"] = should2["Throw"];
1959
+ should2.not["throw"] = should2.not["Throw"];
1960
+ return should2;
1961
+ }
1962
+ function assert(express, errmsg) {
1963
+ let test2 = new Assertion(null, null, assert, true);
1964
+ test2.assert(express, errmsg, "[ negation message unavailable ]");
1965
+ }
1966
+ function use(fn) {
1967
+ const exports = {
1968
+ use,
1969
+ AssertionError,
1970
+ util: utils_exports,
1971
+ config,
1972
+ expect,
1973
+ assert,
1974
+ Assertion,
1975
+ ...should_exports
1976
+ };
1977
+ if (!~used.indexOf(fn)) {
1978
+ fn(exports, utils_exports);
1979
+ used.push(fn);
1980
+ }
1981
+ return exports;
1982
+ }
1983
+ var __defProp2, __defNormalProp = (obj, key, value) => (key in obj) ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value, __name = (target, value) => __defProp2(target, "name", { value, configurable: true }), __export2 = (target, all) => {
1984
+ for (var name in all)
1985
+ __defProp2(target, name, { get: all[name], enumerable: true });
1986
+ }, __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value), utils_exports, check_error_exports, canElideFrames, _AssertionError, AssertionError, ansiColors, styles, truncator = "…", getArrayName, isNaN, stringEscapeChars, escapeCharacters, hex = 16, unicodeLength = 4, getPromiseValue, promise_default, toStringTag, errorKeys, symbolsSupported, chaiInspect, nodeInspect, constructorMap, stringTagMap, baseTypesMap, inspectCustom, toString, config, MemoizeMap, deep_eql_default, _Assertion = class _Assertion2 {
1987
+ constructor(obj, msg, ssfi, lockSsfi) {
1988
+ __publicField(this, "__flags", {});
1989
+ flag(this, "ssfi", ssfi || _Assertion2);
1990
+ flag(this, "lockSsfi", lockSsfi);
1991
+ flag(this, "object", obj);
1992
+ flag(this, "message", msg);
1993
+ flag(this, "eql", config.deepEqual || deep_eql_default);
1994
+ return proxify(this);
1995
+ }
1996
+ static get includeStack() {
1997
+ console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead.");
1998
+ return config.includeStack;
1999
+ }
2000
+ static set includeStack(value) {
2001
+ console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead.");
2002
+ config.includeStack = value;
2003
+ }
2004
+ static get showDiff() {
2005
+ console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead.");
2006
+ return config.showDiff;
2007
+ }
2008
+ static set showDiff(value) {
2009
+ console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead.");
2010
+ config.showDiff = value;
2011
+ }
2012
+ static addProperty(name, fn) {
2013
+ addProperty(this.prototype, name, fn);
2014
+ }
2015
+ static addMethod(name, fn) {
2016
+ addMethod(this.prototype, name, fn);
2017
+ }
2018
+ static addChainableMethod(name, fn, chainingBehavior) {
2019
+ addChainableMethod(this.prototype, name, fn, chainingBehavior);
2020
+ }
2021
+ static overwriteProperty(name, fn) {
2022
+ overwriteProperty(this.prototype, name, fn);
2023
+ }
2024
+ static overwriteMethod(name, fn) {
2025
+ overwriteMethod(this.prototype, name, fn);
2026
+ }
2027
+ static overwriteChainableMethod(name, fn, chainingBehavior) {
2028
+ overwriteChainableMethod(this.prototype, name, fn, chainingBehavior);
2029
+ }
2030
+ assert(_expr, msg, _negateMsg, expected, _actual, showDiff) {
2031
+ const ok = test(this, arguments);
2032
+ if (showDiff !== false)
2033
+ showDiff = true;
2034
+ if (expected === undefined && _actual === undefined)
2035
+ showDiff = false;
2036
+ if (config.showDiff !== true)
2037
+ showDiff = false;
2038
+ if (!ok) {
2039
+ msg = getMessage2(this, arguments);
2040
+ const actual = getActual(this, arguments);
2041
+ const assertionErrorObjectProperties = {
2042
+ actual,
2043
+ expected,
2044
+ showDiff
2045
+ };
2046
+ const operator = getOperator(this, arguments);
2047
+ if (operator) {
2048
+ assertionErrorObjectProperties.operator = operator;
2049
+ }
2050
+ throw new AssertionError(msg, assertionErrorObjectProperties, config.includeStack ? this.assert : flag(this, "ssfi"));
2051
+ }
2052
+ }
2053
+ get _obj() {
2054
+ return flag(this, "object");
2055
+ }
2056
+ set _obj(val) {
2057
+ flag(this, "object", val);
2058
+ }
2059
+ }, Assertion, events, _PluginEvent, PluginEvent, fnLengthDesc, builtins, canSetPrototype, testFn, excludeNames, call, apply, _PluginAddChainableMethodEvent, PluginAddChainableMethodEvent, isNaN2, flag2, functionTypes, should_exports, should, Should, aliases, used;
2060
+ var init_chai = __esm(() => {
2061
+ __defProp2 = Object.defineProperty;
2062
+ utils_exports = {};
2063
+ __export2(utils_exports, {
2064
+ addChainableMethod: () => addChainableMethod,
2065
+ addLengthGuard: () => addLengthGuard,
2066
+ addMethod: () => addMethod,
2067
+ addProperty: () => addProperty,
2068
+ checkError: () => check_error_exports,
2069
+ compareByInspect: () => compareByInspect,
2070
+ eql: () => deep_eql_default,
2071
+ events: () => events,
2072
+ expectTypes: () => expectTypes,
2073
+ flag: () => flag,
2074
+ getActual: () => getActual,
2075
+ getMessage: () => getMessage2,
2076
+ getName: () => getName,
2077
+ getOperator: () => getOperator,
2078
+ getOwnEnumerableProperties: () => getOwnEnumerableProperties,
2079
+ getOwnEnumerablePropertySymbols: () => getOwnEnumerablePropertySymbols,
2080
+ getPathInfo: () => getPathInfo,
2081
+ hasProperty: () => hasProperty,
2082
+ inspect: () => inspect2,
2083
+ isNaN: () => isNaN2,
2084
+ isNumeric: () => isNumeric,
2085
+ isProxyEnabled: () => isProxyEnabled,
2086
+ isRegExp: () => isRegExp2,
2087
+ objDisplay: () => objDisplay,
2088
+ overwriteChainableMethod: () => overwriteChainableMethod,
2089
+ overwriteMethod: () => overwriteMethod,
2090
+ overwriteProperty: () => overwriteProperty,
2091
+ proxify: () => proxify,
2092
+ test: () => test,
2093
+ transferFlags: () => transferFlags,
2094
+ type: () => type
2095
+ });
2096
+ check_error_exports = {};
2097
+ __export2(check_error_exports, {
2098
+ compatibleConstructor: () => compatibleConstructor,
2099
+ compatibleInstance: () => compatibleInstance,
2100
+ compatibleMessage: () => compatibleMessage,
2101
+ getConstructorName: () => getConstructorName,
2102
+ getMessage: () => getMessage
2103
+ });
2104
+ __name(isErrorInstance, "isErrorInstance");
2105
+ __name(isRegExp, "isRegExp");
2106
+ __name(compatibleInstance, "compatibleInstance");
2107
+ __name(compatibleConstructor, "compatibleConstructor");
2108
+ __name(compatibleMessage, "compatibleMessage");
2109
+ __name(getConstructorName, "getConstructorName");
2110
+ __name(getMessage, "getMessage");
2111
+ __name(flag, "flag");
2112
+ __name(test, "test");
2113
+ __name(type, "type");
2114
+ canElideFrames = "captureStackTrace" in Error;
2115
+ _AssertionError = class _AssertionError2 extends Error {
2116
+ constructor(message = "Unspecified AssertionError", props, ssf) {
2117
+ super(message);
2118
+ __publicField(this, "message");
2119
+ this.message = message;
2120
+ if (canElideFrames) {
2121
+ Error.captureStackTrace(this, ssf || _AssertionError2);
2122
+ }
2123
+ for (const key in props) {
2124
+ if (!(key in this)) {
2125
+ this[key] = props[key];
2126
+ }
2127
+ }
2128
+ }
2129
+ get name() {
2130
+ return "AssertionError";
2131
+ }
2132
+ get ok() {
2133
+ return false;
2134
+ }
2135
+ toJSON(stack) {
2136
+ return {
2137
+ ...this,
2138
+ name: this.name,
2139
+ message: this.message,
2140
+ ok: false,
2141
+ stack: stack !== false ? this.stack : undefined
2142
+ };
2143
+ }
2144
+ };
2145
+ __name(_AssertionError, "AssertionError");
2146
+ AssertionError = _AssertionError;
2147
+ __name(expectTypes, "expectTypes");
2148
+ __name(getActual, "getActual");
2149
+ ansiColors = {
2150
+ bold: ["1", "22"],
2151
+ dim: ["2", "22"],
2152
+ italic: ["3", "23"],
2153
+ underline: ["4", "24"],
2154
+ inverse: ["7", "27"],
2155
+ hidden: ["8", "28"],
2156
+ strike: ["9", "29"],
2157
+ black: ["30", "39"],
2158
+ red: ["31", "39"],
2159
+ green: ["32", "39"],
2160
+ yellow: ["33", "39"],
2161
+ blue: ["34", "39"],
2162
+ magenta: ["35", "39"],
2163
+ cyan: ["36", "39"],
2164
+ white: ["37", "39"],
2165
+ brightblack: ["30;1", "39"],
2166
+ brightred: ["31;1", "39"],
2167
+ brightgreen: ["32;1", "39"],
2168
+ brightyellow: ["33;1", "39"],
2169
+ brightblue: ["34;1", "39"],
2170
+ brightmagenta: ["35;1", "39"],
2171
+ brightcyan: ["36;1", "39"],
2172
+ brightwhite: ["37;1", "39"],
2173
+ grey: ["90", "39"]
2174
+ };
2175
+ styles = {
2176
+ special: "cyan",
2177
+ number: "yellow",
2178
+ bigint: "yellow",
2179
+ boolean: "yellow",
2180
+ undefined: "grey",
2181
+ null: "bold",
2182
+ string: "green",
2183
+ symbol: "green",
2184
+ date: "magenta",
2185
+ regexp: "red"
2186
+ };
2187
+ __name(colorise, "colorise");
2188
+ __name(normaliseOptions, "normaliseOptions");
2189
+ __name(isHighSurrogate, "isHighSurrogate");
2190
+ __name(truncate, "truncate");
2191
+ __name(inspectList, "inspectList");
2192
+ __name(quoteComplexKey, "quoteComplexKey");
2193
+ __name(inspectProperty, "inspectProperty");
2194
+ __name(inspectArray, "inspectArray");
2195
+ getArrayName = /* @__PURE__ */ __name((array) => {
2196
+ if (typeof Buffer === "function" && array instanceof Buffer) {
2197
+ return "Buffer";
2198
+ }
2199
+ if (array[Symbol.toStringTag]) {
2200
+ return array[Symbol.toStringTag];
2201
+ }
2202
+ return array.constructor.name;
2203
+ }, "getArrayName");
2204
+ __name(inspectTypedArray, "inspectTypedArray");
2205
+ __name(inspectDate, "inspectDate");
2206
+ __name(inspectFunction, "inspectFunction");
2207
+ __name(inspectMapEntry, "inspectMapEntry");
2208
+ __name(mapToEntries, "mapToEntries");
2209
+ __name(inspectMap, "inspectMap");
2210
+ isNaN = Number.isNaN || ((i) => i !== i);
2211
+ __name(inspectNumber, "inspectNumber");
2212
+ __name(inspectBigInt, "inspectBigInt");
2213
+ __name(inspectRegExp, "inspectRegExp");
2214
+ __name(arrayFromSet, "arrayFromSet");
2215
+ __name(inspectSet, "inspectSet");
2216
+ stringEscapeChars = new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", "g");
2217
+ escapeCharacters = {
2218
+ "\b": "\\b",
2219
+ "\t": "\\t",
2220
+ "\n": "\\n",
2221
+ "\f": "\\f",
2222
+ "\r": "\\r",
2223
+ "'": "\\'",
2224
+ "\\": "\\\\"
2225
+ };
2226
+ __name(escape, "escape");
2227
+ __name(inspectString, "inspectString");
2228
+ __name(inspectSymbol, "inspectSymbol");
2229
+ getPromiseValue = /* @__PURE__ */ __name(() => "Promise{…}", "getPromiseValue");
2230
+ promise_default = getPromiseValue;
2231
+ __name(inspectObject, "inspectObject");
2232
+ toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag ? Symbol.toStringTag : false;
2233
+ __name(inspectClass, "inspectClass");
2234
+ __name(inspectArguments, "inspectArguments");
2235
+ errorKeys = [
2236
+ "stack",
2237
+ "line",
2238
+ "column",
2239
+ "name",
2240
+ "message",
2241
+ "fileName",
2242
+ "lineNumber",
2243
+ "columnNumber",
2244
+ "number",
2245
+ "description",
2246
+ "cause"
2247
+ ];
2248
+ __name(inspectObject2, "inspectObject");
2249
+ __name(inspectAttribute, "inspectAttribute");
2250
+ __name(inspectNodeCollection, "inspectNodeCollection");
2251
+ __name(inspectNode, "inspectNode");
2252
+ __name(inspectHTML, "inspectHTML");
2253
+ symbolsSupported = typeof Symbol === "function" && typeof Symbol.for === "function";
2254
+ chaiInspect = symbolsSupported ? /* @__PURE__ */ Symbol.for("chai/inspect") : "@@chai/inspect";
2255
+ nodeInspect = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
2256
+ constructorMap = /* @__PURE__ */ new WeakMap;
2257
+ stringTagMap = {};
2258
+ baseTypesMap = {
2259
+ undefined: /* @__PURE__ */ __name((value, options) => options.stylize("undefined", "undefined"), "undefined"),
2260
+ null: /* @__PURE__ */ __name((value, options) => options.stylize("null", "null"), "null"),
2261
+ boolean: /* @__PURE__ */ __name((value, options) => options.stylize(String(value), "boolean"), "boolean"),
2262
+ Boolean: /* @__PURE__ */ __name((value, options) => options.stylize(String(value), "boolean"), "Boolean"),
2263
+ number: inspectNumber,
2264
+ Number: inspectNumber,
2265
+ bigint: inspectBigInt,
2266
+ BigInt: inspectBigInt,
2267
+ string: inspectString,
2268
+ String: inspectString,
2269
+ function: inspectFunction,
2270
+ Function: inspectFunction,
2271
+ symbol: inspectSymbol,
2272
+ Symbol: inspectSymbol,
2273
+ Array: inspectArray,
2274
+ Date: inspectDate,
2275
+ Map: inspectMap,
2276
+ Set: inspectSet,
2277
+ RegExp: inspectRegExp,
2278
+ Promise: promise_default,
2279
+ WeakSet: /* @__PURE__ */ __name((value, options) => options.stylize("WeakSet{…}", "special"), "WeakSet"),
2280
+ WeakMap: /* @__PURE__ */ __name((value, options) => options.stylize("WeakMap{…}", "special"), "WeakMap"),
2281
+ Arguments: inspectArguments,
2282
+ Int8Array: inspectTypedArray,
2283
+ Uint8Array: inspectTypedArray,
2284
+ Uint8ClampedArray: inspectTypedArray,
2285
+ Int16Array: inspectTypedArray,
2286
+ Uint16Array: inspectTypedArray,
2287
+ Int32Array: inspectTypedArray,
2288
+ Uint32Array: inspectTypedArray,
2289
+ Float32Array: inspectTypedArray,
2290
+ Float64Array: inspectTypedArray,
2291
+ Generator: /* @__PURE__ */ __name(() => "", "Generator"),
2292
+ DataView: /* @__PURE__ */ __name(() => "", "DataView"),
2293
+ ArrayBuffer: /* @__PURE__ */ __name(() => "", "ArrayBuffer"),
2294
+ Error: inspectObject2,
2295
+ HTMLCollection: inspectNodeCollection,
2296
+ NodeList: inspectNodeCollection
2297
+ };
2298
+ inspectCustom = /* @__PURE__ */ __name((value, options, type3, inspectFn) => {
2299
+ if (chaiInspect in value && typeof value[chaiInspect] === "function") {
2300
+ return value[chaiInspect](options);
2301
+ }
2302
+ if (nodeInspect in value && typeof value[nodeInspect] === "function") {
2303
+ return value[nodeInspect](options.depth, options, inspectFn);
2304
+ }
2305
+ if ("inspect" in value && typeof value.inspect === "function") {
2306
+ return value.inspect(options.depth, options);
2307
+ }
2308
+ if ("constructor" in value && constructorMap.has(value.constructor)) {
2309
+ return constructorMap.get(value.constructor)(value, options);
2310
+ }
2311
+ if (stringTagMap[type3]) {
2312
+ return stringTagMap[type3](value, options);
2313
+ }
2314
+ return "";
2315
+ }, "inspectCustom");
2316
+ toString = Object.prototype.toString;
2317
+ __name(inspect, "inspect");
2318
+ config = {
2319
+ includeStack: false,
2320
+ showDiff: true,
2321
+ truncateThreshold: 40,
2322
+ useProxy: true,
2323
+ proxyExcludedKeys: ["then", "catch", "inspect", "toJSON"],
2324
+ deepEqual: null
2325
+ };
2326
+ __name(inspect2, "inspect");
2327
+ __name(objDisplay, "objDisplay");
2328
+ __name(getMessage2, "getMessage");
2329
+ __name(transferFlags, "transferFlags");
2330
+ __name(type2, "type");
2331
+ __name(FakeMap, "FakeMap");
2332
+ FakeMap.prototype = {
2333
+ get: /* @__PURE__ */ __name(function get(key) {
2334
+ return key[this._key];
2335
+ }, "get"),
2336
+ set: /* @__PURE__ */ __name(function set(key, value) {
2337
+ if (Object.isExtensible(key)) {
2338
+ Object.defineProperty(key, this._key, {
2339
+ value,
2340
+ configurable: true
2341
+ });
2342
+ }
2343
+ }, "set")
2344
+ };
2345
+ MemoizeMap = typeof WeakMap === "function" ? WeakMap : FakeMap;
2346
+ __name(memoizeCompare, "memoizeCompare");
2347
+ __name(memoizeSet, "memoizeSet");
2348
+ deep_eql_default = deepEqual;
2349
+ __name(deepEqual, "deepEqual");
2350
+ __name(simpleEqual, "simpleEqual");
2351
+ __name(extensiveDeepEqual, "extensiveDeepEqual");
2352
+ __name(extensiveDeepEqualByType, "extensiveDeepEqualByType");
2353
+ __name(regexpEqual, "regexpEqual");
2354
+ __name(entriesEqual, "entriesEqual");
2355
+ __name(iterableEqual, "iterableEqual");
2356
+ __name(generatorEqual, "generatorEqual");
2357
+ __name(hasIteratorFunction, "hasIteratorFunction");
2358
+ __name(getIteratorEntries, "getIteratorEntries");
2359
+ __name(getGeneratorEntries, "getGeneratorEntries");
2360
+ __name(getEnumerableKeys, "getEnumerableKeys");
2361
+ __name(getEnumerableSymbols, "getEnumerableSymbols");
2362
+ __name(keysEqual, "keysEqual");
2363
+ __name(objectEqual, "objectEqual");
2364
+ __name(isPrimitive, "isPrimitive");
2365
+ __name(mapSymbols, "mapSymbols");
2366
+ __name(hasProperty, "hasProperty");
2367
+ __name(parsePath, "parsePath");
2368
+ __name(internalGetPathValue, "internalGetPathValue");
2369
+ __name(getPathInfo, "getPathInfo");
2370
+ __name(_Assertion, "Assertion");
2371
+ Assertion = _Assertion;
2372
+ events = new EventTarget;
2373
+ _PluginEvent = class _PluginEvent2 extends Event {
2374
+ constructor(type3, name, fn) {
2375
+ super(type3);
2376
+ this.name = String(name);
2377
+ this.fn = fn;
2378
+ }
2379
+ };
2380
+ __name(_PluginEvent, "PluginEvent");
2381
+ PluginEvent = _PluginEvent;
2382
+ __name(isProxyEnabled, "isProxyEnabled");
2383
+ __name(addProperty, "addProperty");
2384
+ fnLengthDesc = Object.getOwnPropertyDescriptor(function() {}, "length");
2385
+ __name(addLengthGuard, "addLengthGuard");
2386
+ __name(getProperties, "getProperties");
2387
+ builtins = ["__flags", "__methods", "_obj", "assert"];
2388
+ __name(proxify, "proxify");
2389
+ __name(stringDistanceCapped, "stringDistanceCapped");
2390
+ __name(addMethod, "addMethod");
2391
+ __name(overwriteProperty, "overwriteProperty");
2392
+ __name(overwriteMethod, "overwriteMethod");
2393
+ canSetPrototype = typeof Object.setPrototypeOf === "function";
2394
+ testFn = /* @__PURE__ */ __name(function() {}, "testFn");
2395
+ excludeNames = Object.getOwnPropertyNames(testFn).filter(function(name) {
2396
+ let propDesc = Object.getOwnPropertyDescriptor(testFn, name);
2397
+ if (typeof propDesc !== "object")
2398
+ return true;
2399
+ return !propDesc.configurable;
2400
+ });
2401
+ call = Function.prototype.call;
2402
+ apply = Function.prototype.apply;
2403
+ _PluginAddChainableMethodEvent = class _PluginAddChainableMethodEvent2 extends PluginEvent {
2404
+ constructor(type3, name, fn, chainingBehavior) {
2405
+ super(type3, name, fn);
2406
+ this.chainingBehavior = chainingBehavior;
2407
+ }
2408
+ };
2409
+ __name(_PluginAddChainableMethodEvent, "PluginAddChainableMethodEvent");
2410
+ PluginAddChainableMethodEvent = _PluginAddChainableMethodEvent;
2411
+ __name(addChainableMethod, "addChainableMethod");
2412
+ __name(overwriteChainableMethod, "overwriteChainableMethod");
2413
+ __name(compareByInspect, "compareByInspect");
2414
+ __name(getOwnEnumerablePropertySymbols, "getOwnEnumerablePropertySymbols");
2415
+ __name(getOwnEnumerableProperties, "getOwnEnumerableProperties");
2416
+ isNaN2 = Number.isNaN;
2417
+ __name(isObjectType, "isObjectType");
2418
+ __name(getOperator, "getOperator");
2419
+ __name(getName, "getName");
2420
+ __name(isRegExp2, "isRegExp");
2421
+ __name(isNumeric, "isNumeric");
2422
+ ({ flag: flag2 } = utils_exports);
2423
+ [
2424
+ "to",
2425
+ "be",
2426
+ "been",
2427
+ "is",
2428
+ "and",
2429
+ "has",
2430
+ "have",
2431
+ "with",
2432
+ "that",
2433
+ "which",
2434
+ "at",
2435
+ "of",
2436
+ "same",
2437
+ "but",
2438
+ "does",
2439
+ "still",
2440
+ "also"
2441
+ ].forEach(function(chain) {
2442
+ Assertion.addProperty(chain);
2443
+ });
2444
+ Assertion.addProperty("not", function() {
2445
+ flag2(this, "negate", true);
2446
+ });
2447
+ Assertion.addProperty("deep", function() {
2448
+ flag2(this, "deep", true);
2449
+ });
2450
+ Assertion.addProperty("nested", function() {
2451
+ flag2(this, "nested", true);
2452
+ });
2453
+ Assertion.addProperty("own", function() {
2454
+ flag2(this, "own", true);
2455
+ });
2456
+ Assertion.addProperty("ordered", function() {
2457
+ flag2(this, "ordered", true);
2458
+ });
2459
+ Assertion.addProperty("any", function() {
2460
+ flag2(this, "any", true);
2461
+ flag2(this, "all", false);
2462
+ });
2463
+ Assertion.addProperty("all", function() {
2464
+ flag2(this, "all", true);
2465
+ flag2(this, "any", false);
2466
+ });
2467
+ functionTypes = {
2468
+ function: [
2469
+ "function",
2470
+ "asyncfunction",
2471
+ "generatorfunction",
2472
+ "asyncgeneratorfunction"
2473
+ ],
2474
+ asyncfunction: ["asyncfunction", "asyncgeneratorfunction"],
2475
+ generatorfunction: ["generatorfunction", "asyncgeneratorfunction"],
2476
+ asyncgeneratorfunction: ["asyncgeneratorfunction"]
2477
+ };
2478
+ __name(an, "an");
2479
+ Assertion.addChainableMethod("an", an);
2480
+ Assertion.addChainableMethod("a", an);
2481
+ __name(SameValueZero, "SameValueZero");
2482
+ __name(includeChainingBehavior, "includeChainingBehavior");
2483
+ __name(include, "include");
2484
+ Assertion.addChainableMethod("include", include, includeChainingBehavior);
2485
+ Assertion.addChainableMethod("contain", include, includeChainingBehavior);
2486
+ Assertion.addChainableMethod("contains", include, includeChainingBehavior);
2487
+ Assertion.addChainableMethod("includes", include, includeChainingBehavior);
2488
+ Assertion.addProperty("ok", function() {
2489
+ this.assert(flag2(this, "object"), "expected #{this} to be truthy", "expected #{this} to be falsy");
2490
+ });
2491
+ Assertion.addProperty("true", function() {
2492
+ this.assert(flag2(this, "object") === true, "expected #{this} to be true", "expected #{this} to be false", flag2(this, "negate") ? false : true);
2493
+ });
2494
+ Assertion.addProperty("numeric", function() {
2495
+ const object = flag2(this, "object");
2496
+ this.assert(["Number", "BigInt"].includes(type(object)), "expected #{this} to be numeric", "expected #{this} to not be numeric", flag2(this, "negate") ? false : true);
2497
+ });
2498
+ Assertion.addProperty("callable", function() {
2499
+ const val = flag2(this, "object");
2500
+ const ssfi = flag2(this, "ssfi");
2501
+ const message = flag2(this, "message");
2502
+ const msg = message ? `${message}: ` : "";
2503
+ const negate = flag2(this, "negate");
2504
+ const assertionMessage = negate ? `${msg}expected ${inspect2(val)} not to be a callable function` : `${msg}expected ${inspect2(val)} to be a callable function`;
2505
+ const isCallable = [
2506
+ "Function",
2507
+ "AsyncFunction",
2508
+ "GeneratorFunction",
2509
+ "AsyncGeneratorFunction"
2510
+ ].includes(type(val));
2511
+ if (isCallable && negate || !isCallable && !negate) {
2512
+ throw new AssertionError(assertionMessage, undefined, ssfi);
2513
+ }
2514
+ });
2515
+ Assertion.addProperty("false", function() {
2516
+ this.assert(flag2(this, "object") === false, "expected #{this} to be false", "expected #{this} to be true", flag2(this, "negate") ? true : false);
2517
+ });
2518
+ Assertion.addProperty("null", function() {
2519
+ this.assert(flag2(this, "object") === null, "expected #{this} to be null", "expected #{this} not to be null");
2520
+ });
2521
+ Assertion.addProperty("undefined", function() {
2522
+ this.assert(flag2(this, "object") === undefined, "expected #{this} to be undefined", "expected #{this} not to be undefined");
2523
+ });
2524
+ Assertion.addProperty("NaN", function() {
2525
+ this.assert(isNaN2(flag2(this, "object")), "expected #{this} to be NaN", "expected #{this} not to be NaN");
2526
+ });
2527
+ __name(assertExist, "assertExist");
2528
+ Assertion.addProperty("exist", assertExist);
2529
+ Assertion.addProperty("exists", assertExist);
2530
+ Assertion.addProperty("empty", function() {
2531
+ let val = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), itemsCount;
2532
+ flagMsg = flagMsg ? flagMsg + ": " : "";
2533
+ switch (type(val).toLowerCase()) {
2534
+ case "array":
2535
+ case "string":
2536
+ itemsCount = val.length;
2537
+ break;
2538
+ case "map":
2539
+ case "set":
2540
+ itemsCount = val.size;
2541
+ break;
2542
+ case "weakmap":
2543
+ case "weakset":
2544
+ throw new AssertionError(flagMsg + ".empty was passed a weak collection", undefined, ssfi);
2545
+ case "function": {
2546
+ const msg = flagMsg + ".empty was passed a function " + getName(val);
2547
+ throw new AssertionError(msg.trim(), undefined, ssfi);
2548
+ }
2549
+ default:
2550
+ if (val !== Object(val)) {
2551
+ throw new AssertionError(flagMsg + ".empty was passed non-string primitive " + inspect2(val), undefined, ssfi);
2552
+ }
2553
+ itemsCount = Object.keys(val).length;
2554
+ }
2555
+ this.assert(itemsCount === 0, "expected #{this} to be empty", "expected #{this} not to be empty");
2556
+ });
2557
+ __name(checkArguments, "checkArguments");
2558
+ Assertion.addProperty("arguments", checkArguments);
2559
+ Assertion.addProperty("Arguments", checkArguments);
2560
+ __name(assertEqual, "assertEqual");
2561
+ Assertion.addMethod("equal", assertEqual);
2562
+ Assertion.addMethod("equals", assertEqual);
2563
+ Assertion.addMethod("eq", assertEqual);
2564
+ __name(assertEql, "assertEql");
2565
+ Assertion.addMethod("eql", assertEql);
2566
+ Assertion.addMethod("eqls", assertEql);
2567
+ __name(assertAbove, "assertAbove");
2568
+ Assertion.addMethod("above", assertAbove);
2569
+ Assertion.addMethod("gt", assertAbove);
2570
+ Assertion.addMethod("greaterThan", assertAbove);
2571
+ __name(assertLeast, "assertLeast");
2572
+ Assertion.addMethod("least", assertLeast);
2573
+ Assertion.addMethod("gte", assertLeast);
2574
+ Assertion.addMethod("greaterThanOrEqual", assertLeast);
2575
+ __name(assertBelow, "assertBelow");
2576
+ Assertion.addMethod("below", assertBelow);
2577
+ Assertion.addMethod("lt", assertBelow);
2578
+ Assertion.addMethod("lessThan", assertBelow);
2579
+ __name(assertMost, "assertMost");
2580
+ Assertion.addMethod("most", assertMost);
2581
+ Assertion.addMethod("lte", assertMost);
2582
+ Assertion.addMethod("lessThanOrEqual", assertMost);
2583
+ Assertion.addMethod("within", function(start, finish, msg) {
2584
+ if (msg)
2585
+ flag2(this, "message", msg);
2586
+ let obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), startType = type(start).toLowerCase(), finishType = type(finish).toLowerCase(), errorMessage, shouldThrow = true, range = startType === "date" && finishType === "date" ? start.toISOString() + ".." + finish.toISOString() : start + ".." + finish;
2587
+ if (doLength && objType !== "map" && objType !== "set") {
2588
+ new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
2589
+ }
2590
+ if (!doLength && objType === "date" && (startType !== "date" || finishType !== "date")) {
2591
+ errorMessage = msgPrefix + "the arguments to within must be dates";
2592
+ } else if ((!isNumeric(start) || !isNumeric(finish)) && (doLength || isNumeric(obj))) {
2593
+ errorMessage = msgPrefix + "the arguments to within must be numbers";
2594
+ } else if (!doLength && objType !== "date" && !isNumeric(obj)) {
2595
+ let printObj = objType === "string" ? "'" + obj + "'" : obj;
2596
+ errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
2597
+ } else {
2598
+ shouldThrow = false;
2599
+ }
2600
+ if (shouldThrow) {
2601
+ throw new AssertionError(errorMessage, undefined, ssfi);
2602
+ }
2603
+ if (doLength) {
2604
+ let descriptor = "length", itemsCount;
2605
+ if (objType === "map" || objType === "set") {
2606
+ descriptor = "size";
2607
+ itemsCount = obj.size;
2608
+ } else {
2609
+ itemsCount = obj.length;
2610
+ }
2611
+ this.assert(itemsCount >= start && itemsCount <= finish, "expected #{this} to have a " + descriptor + " within " + range, "expected #{this} to not have a " + descriptor + " within " + range);
2612
+ } else {
2613
+ this.assert(obj >= start && obj <= finish, "expected #{this} to be within " + range, "expected #{this} to not be within " + range);
2614
+ }
2615
+ });
2616
+ __name(assertInstanceOf, "assertInstanceOf");
2617
+ Assertion.addMethod("instanceof", assertInstanceOf);
2618
+ Assertion.addMethod("instanceOf", assertInstanceOf);
2619
+ __name(assertProperty, "assertProperty");
2620
+ Assertion.addMethod("property", assertProperty);
2621
+ __name(assertOwnProperty, "assertOwnProperty");
2622
+ Assertion.addMethod("ownProperty", assertOwnProperty);
2623
+ Assertion.addMethod("haveOwnProperty", assertOwnProperty);
2624
+ __name(assertOwnPropertyDescriptor, "assertOwnPropertyDescriptor");
2625
+ Assertion.addMethod("ownPropertyDescriptor", assertOwnPropertyDescriptor);
2626
+ Assertion.addMethod("haveOwnPropertyDescriptor", assertOwnPropertyDescriptor);
2627
+ __name(assertLengthChain, "assertLengthChain");
2628
+ __name(assertLength, "assertLength");
2629
+ Assertion.addChainableMethod("length", assertLength, assertLengthChain);
2630
+ Assertion.addChainableMethod("lengthOf", assertLength, assertLengthChain);
2631
+ __name(assertMatch, "assertMatch");
2632
+ Assertion.addMethod("match", assertMatch);
2633
+ Assertion.addMethod("matches", assertMatch);
2634
+ Assertion.addMethod("string", function(str, msg) {
2635
+ if (msg)
2636
+ flag2(this, "message", msg);
2637
+ let obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
2638
+ new Assertion(obj, flagMsg, ssfi, true).is.a("string");
2639
+ this.assert(~obj.indexOf(str), "expected #{this} to contain " + inspect2(str), "expected #{this} to not contain " + inspect2(str));
2640
+ });
2641
+ __name(assertKeys, "assertKeys");
2642
+ Assertion.addMethod("keys", assertKeys);
2643
+ Assertion.addMethod("key", assertKeys);
2644
+ __name(assertThrows, "assertThrows");
2645
+ Assertion.addMethod("throw", assertThrows);
2646
+ Assertion.addMethod("throws", assertThrows);
2647
+ Assertion.addMethod("Throw", assertThrows);
2648
+ __name(respondTo, "respondTo");
2649
+ Assertion.addMethod("respondTo", respondTo);
2650
+ Assertion.addMethod("respondsTo", respondTo);
2651
+ Assertion.addProperty("itself", function() {
2652
+ flag2(this, "itself", true);
2653
+ });
2654
+ __name(satisfy, "satisfy");
2655
+ Assertion.addMethod("satisfy", satisfy);
2656
+ Assertion.addMethod("satisfies", satisfy);
2657
+ __name(closeTo, "closeTo");
2658
+ Assertion.addMethod("closeTo", closeTo);
2659
+ Assertion.addMethod("approximately", closeTo);
2660
+ __name(isSubsetOf, "isSubsetOf");
2661
+ Assertion.addMethod("members", function(subset, msg) {
2662
+ if (msg)
2663
+ flag2(this, "message", msg);
2664
+ let obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
2665
+ new Assertion(obj, flagMsg, ssfi, true).to.be.iterable;
2666
+ new Assertion(subset, flagMsg, ssfi, true).to.be.iterable;
2667
+ let contains = flag2(this, "contains");
2668
+ let ordered = flag2(this, "ordered");
2669
+ let subject, failMsg, failNegateMsg;
2670
+ if (contains) {
2671
+ subject = ordered ? "an ordered superset" : "a superset";
2672
+ failMsg = "expected #{this} to be " + subject + " of #{exp}";
2673
+ failNegateMsg = "expected #{this} to not be " + subject + " of #{exp}";
2674
+ } else {
2675
+ subject = ordered ? "ordered members" : "members";
2676
+ failMsg = "expected #{this} to have the same " + subject + " as #{exp}";
2677
+ failNegateMsg = "expected #{this} to not have the same " + subject + " as #{exp}";
2678
+ }
2679
+ let cmp = flag2(this, "deep") ? flag2(this, "eql") : undefined;
2680
+ this.assert(isSubsetOf(subset, obj, cmp, contains, ordered), failMsg, failNegateMsg, subset, obj, true);
2681
+ });
2682
+ Assertion.addProperty("iterable", function(msg) {
2683
+ if (msg)
2684
+ flag2(this, "message", msg);
2685
+ let obj = flag2(this, "object");
2686
+ this.assert(obj != null && obj[Symbol.iterator], "expected #{this} to be an iterable", "expected #{this} to not be an iterable", obj);
2687
+ });
2688
+ __name(oneOf, "oneOf");
2689
+ Assertion.addMethod("oneOf", oneOf);
2690
+ __name(assertChanges, "assertChanges");
2691
+ Assertion.addMethod("change", assertChanges);
2692
+ Assertion.addMethod("changes", assertChanges);
2693
+ __name(assertIncreases, "assertIncreases");
2694
+ Assertion.addMethod("increase", assertIncreases);
2695
+ Assertion.addMethod("increases", assertIncreases);
2696
+ __name(assertDecreases, "assertDecreases");
2697
+ Assertion.addMethod("decrease", assertDecreases);
2698
+ Assertion.addMethod("decreases", assertDecreases);
2699
+ __name(assertDelta, "assertDelta");
2700
+ Assertion.addMethod("by", assertDelta);
2701
+ Assertion.addProperty("extensible", function() {
2702
+ let obj = flag2(this, "object");
2703
+ let isExtensible = obj === Object(obj) && Object.isExtensible(obj);
2704
+ this.assert(isExtensible, "expected #{this} to be extensible", "expected #{this} to not be extensible");
2705
+ });
2706
+ Assertion.addProperty("sealed", function() {
2707
+ let obj = flag2(this, "object");
2708
+ let isSealed = obj === Object(obj) ? Object.isSealed(obj) : true;
2709
+ this.assert(isSealed, "expected #{this} to be sealed", "expected #{this} to not be sealed");
2710
+ });
2711
+ Assertion.addProperty("frozen", function() {
2712
+ let obj = flag2(this, "object");
2713
+ let isFrozen = obj === Object(obj) ? Object.isFrozen(obj) : true;
2714
+ this.assert(isFrozen, "expected #{this} to be frozen", "expected #{this} to not be frozen");
2715
+ });
2716
+ Assertion.addProperty("finite", function(_msg) {
2717
+ let obj = flag2(this, "object");
2718
+ this.assert(typeof obj === "number" && isFinite(obj), "expected #{this} to be a finite number", "expected #{this} to not be a finite number");
2719
+ });
2720
+ __name(compareSubset, "compareSubset");
2721
+ Assertion.addMethod("containSubset", function(expected) {
2722
+ const actual = flag(this, "object");
2723
+ const showDiff = config.showDiff;
2724
+ this.assert(compareSubset(expected, actual), "expected #{act} to contain subset #{exp}", "expected #{act} to not contain subset #{exp}", expected, actual, showDiff);
2725
+ });
2726
+ __name(expect, "expect");
2727
+ expect.fail = function(actual, expected, message, operator) {
2728
+ if (arguments.length < 2) {
2729
+ message = actual;
2730
+ actual = undefined;
2731
+ }
2732
+ message = message || "expect.fail()";
2733
+ throw new AssertionError(message, {
2734
+ actual,
2735
+ expected,
2736
+ operator
2737
+ }, expect.fail);
2738
+ };
2739
+ should_exports = {};
2740
+ __export2(should_exports, {
2741
+ Should: () => Should,
2742
+ should: () => should
2743
+ });
2744
+ __name(loadShould, "loadShould");
2745
+ should = loadShould;
2746
+ Should = loadShould;
2747
+ __name(assert, "assert");
2748
+ assert.fail = function(actual, expected, message, operator) {
2749
+ if (arguments.length < 2) {
2750
+ message = actual;
2751
+ actual = undefined;
2752
+ }
2753
+ message = message || "assert.fail()";
2754
+ throw new AssertionError(message, {
2755
+ actual,
2756
+ expected,
2757
+ operator
2758
+ }, assert.fail);
2759
+ };
2760
+ assert.isOk = function(val, msg) {
2761
+ new Assertion(val, msg, assert.isOk, true).is.ok;
2762
+ };
2763
+ assert.isNotOk = function(val, msg) {
2764
+ new Assertion(val, msg, assert.isNotOk, true).is.not.ok;
2765
+ };
2766
+ assert.equal = function(act, exp, msg) {
2767
+ let test2 = new Assertion(act, msg, assert.equal, true);
2768
+ test2.assert(exp == flag(test2, "object"), "expected #{this} to equal #{exp}", "expected #{this} to not equal #{act}", exp, act, true);
2769
+ };
2770
+ assert.notEqual = function(act, exp, msg) {
2771
+ let test2 = new Assertion(act, msg, assert.notEqual, true);
2772
+ test2.assert(exp != flag(test2, "object"), "expected #{this} to not equal #{exp}", "expected #{this} to equal #{act}", exp, act, true);
2773
+ };
2774
+ assert.strictEqual = function(act, exp, msg) {
2775
+ new Assertion(act, msg, assert.strictEqual, true).to.equal(exp);
2776
+ };
2777
+ assert.notStrictEqual = function(act, exp, msg) {
2778
+ new Assertion(act, msg, assert.notStrictEqual, true).to.not.equal(exp);
2779
+ };
2780
+ assert.deepEqual = assert.deepStrictEqual = function(act, exp, msg) {
2781
+ new Assertion(act, msg, assert.deepEqual, true).to.eql(exp);
2782
+ };
2783
+ assert.notDeepEqual = function(act, exp, msg) {
2784
+ new Assertion(act, msg, assert.notDeepEqual, true).to.not.eql(exp);
2785
+ };
2786
+ assert.isAbove = function(val, abv, msg) {
2787
+ new Assertion(val, msg, assert.isAbove, true).to.be.above(abv);
2788
+ };
2789
+ assert.isAtLeast = function(val, atlst, msg) {
2790
+ new Assertion(val, msg, assert.isAtLeast, true).to.be.least(atlst);
2791
+ };
2792
+ assert.isBelow = function(val, blw, msg) {
2793
+ new Assertion(val, msg, assert.isBelow, true).to.be.below(blw);
2794
+ };
2795
+ assert.isAtMost = function(val, atmst, msg) {
2796
+ new Assertion(val, msg, assert.isAtMost, true).to.be.most(atmst);
2797
+ };
2798
+ assert.isTrue = function(val, msg) {
2799
+ new Assertion(val, msg, assert.isTrue, true).is["true"];
2800
+ };
2801
+ assert.isNotTrue = function(val, msg) {
2802
+ new Assertion(val, msg, assert.isNotTrue, true).to.not.equal(true);
2803
+ };
2804
+ assert.isFalse = function(val, msg) {
2805
+ new Assertion(val, msg, assert.isFalse, true).is["false"];
2806
+ };
2807
+ assert.isNotFalse = function(val, msg) {
2808
+ new Assertion(val, msg, assert.isNotFalse, true).to.not.equal(false);
2809
+ };
2810
+ assert.isNull = function(val, msg) {
2811
+ new Assertion(val, msg, assert.isNull, true).to.equal(null);
2812
+ };
2813
+ assert.isNotNull = function(val, msg) {
2814
+ new Assertion(val, msg, assert.isNotNull, true).to.not.equal(null);
2815
+ };
2816
+ assert.isNaN = function(val, msg) {
2817
+ new Assertion(val, msg, assert.isNaN, true).to.be.NaN;
2818
+ };
2819
+ assert.isNotNaN = function(value, message) {
2820
+ new Assertion(value, message, assert.isNotNaN, true).not.to.be.NaN;
2821
+ };
2822
+ assert.exists = function(val, msg) {
2823
+ new Assertion(val, msg, assert.exists, true).to.exist;
2824
+ };
2825
+ assert.notExists = function(val, msg) {
2826
+ new Assertion(val, msg, assert.notExists, true).to.not.exist;
2827
+ };
2828
+ assert.isUndefined = function(val, msg) {
2829
+ new Assertion(val, msg, assert.isUndefined, true).to.equal(undefined);
2830
+ };
2831
+ assert.isDefined = function(val, msg) {
2832
+ new Assertion(val, msg, assert.isDefined, true).to.not.equal(undefined);
2833
+ };
2834
+ assert.isCallable = function(value, message) {
2835
+ new Assertion(value, message, assert.isCallable, true).is.callable;
2836
+ };
2837
+ assert.isNotCallable = function(value, message) {
2838
+ new Assertion(value, message, assert.isNotCallable, true).is.not.callable;
2839
+ };
2840
+ assert.isObject = function(val, msg) {
2841
+ new Assertion(val, msg, assert.isObject, true).to.be.a("object");
2842
+ };
2843
+ assert.isNotObject = function(val, msg) {
2844
+ new Assertion(val, msg, assert.isNotObject, true).to.not.be.a("object");
2845
+ };
2846
+ assert.isArray = function(val, msg) {
2847
+ new Assertion(val, msg, assert.isArray, true).to.be.an("array");
2848
+ };
2849
+ assert.isNotArray = function(val, msg) {
2850
+ new Assertion(val, msg, assert.isNotArray, true).to.not.be.an("array");
2851
+ };
2852
+ assert.isString = function(val, msg) {
2853
+ new Assertion(val, msg, assert.isString, true).to.be.a("string");
2854
+ };
2855
+ assert.isNotString = function(val, msg) {
2856
+ new Assertion(val, msg, assert.isNotString, true).to.not.be.a("string");
2857
+ };
2858
+ assert.isNumber = function(val, msg) {
2859
+ new Assertion(val, msg, assert.isNumber, true).to.be.a("number");
2860
+ };
2861
+ assert.isNotNumber = function(val, msg) {
2862
+ new Assertion(val, msg, assert.isNotNumber, true).to.not.be.a("number");
2863
+ };
2864
+ assert.isNumeric = function(val, msg) {
2865
+ new Assertion(val, msg, assert.isNumeric, true).is.numeric;
2866
+ };
2867
+ assert.isNotNumeric = function(val, msg) {
2868
+ new Assertion(val, msg, assert.isNotNumeric, true).is.not.numeric;
2869
+ };
2870
+ assert.isFinite = function(val, msg) {
2871
+ new Assertion(val, msg, assert.isFinite, true).to.be.finite;
2872
+ };
2873
+ assert.isBoolean = function(val, msg) {
2874
+ new Assertion(val, msg, assert.isBoolean, true).to.be.a("boolean");
2875
+ };
2876
+ assert.isNotBoolean = function(val, msg) {
2877
+ new Assertion(val, msg, assert.isNotBoolean, true).to.not.be.a("boolean");
2878
+ };
2879
+ assert.typeOf = function(val, type3, msg) {
2880
+ new Assertion(val, msg, assert.typeOf, true).to.be.a(type3);
2881
+ };
2882
+ assert.notTypeOf = function(value, type3, message) {
2883
+ new Assertion(value, message, assert.notTypeOf, true).to.not.be.a(type3);
2884
+ };
2885
+ assert.instanceOf = function(val, type3, msg) {
2886
+ new Assertion(val, msg, assert.instanceOf, true).to.be.instanceOf(type3);
2887
+ };
2888
+ assert.notInstanceOf = function(val, type3, msg) {
2889
+ new Assertion(val, msg, assert.notInstanceOf, true).to.not.be.instanceOf(type3);
2890
+ };
2891
+ assert.include = function(exp, inc, msg) {
2892
+ new Assertion(exp, msg, assert.include, true).include(inc);
2893
+ };
2894
+ assert.notInclude = function(exp, inc, msg) {
2895
+ new Assertion(exp, msg, assert.notInclude, true).not.include(inc);
2896
+ };
2897
+ assert.deepInclude = function(exp, inc, msg) {
2898
+ new Assertion(exp, msg, assert.deepInclude, true).deep.include(inc);
2899
+ };
2900
+ assert.notDeepInclude = function(exp, inc, msg) {
2901
+ new Assertion(exp, msg, assert.notDeepInclude, true).not.deep.include(inc);
2902
+ };
2903
+ assert.nestedInclude = function(exp, inc, msg) {
2904
+ new Assertion(exp, msg, assert.nestedInclude, true).nested.include(inc);
2905
+ };
2906
+ assert.notNestedInclude = function(exp, inc, msg) {
2907
+ new Assertion(exp, msg, assert.notNestedInclude, true).not.nested.include(inc);
2908
+ };
2909
+ assert.deepNestedInclude = function(exp, inc, msg) {
2910
+ new Assertion(exp, msg, assert.deepNestedInclude, true).deep.nested.include(inc);
2911
+ };
2912
+ assert.notDeepNestedInclude = function(exp, inc, msg) {
2913
+ new Assertion(exp, msg, assert.notDeepNestedInclude, true).not.deep.nested.include(inc);
2914
+ };
2915
+ assert.ownInclude = function(exp, inc, msg) {
2916
+ new Assertion(exp, msg, assert.ownInclude, true).own.include(inc);
2917
+ };
2918
+ assert.notOwnInclude = function(exp, inc, msg) {
2919
+ new Assertion(exp, msg, assert.notOwnInclude, true).not.own.include(inc);
2920
+ };
2921
+ assert.deepOwnInclude = function(exp, inc, msg) {
2922
+ new Assertion(exp, msg, assert.deepOwnInclude, true).deep.own.include(inc);
2923
+ };
2924
+ assert.notDeepOwnInclude = function(exp, inc, msg) {
2925
+ new Assertion(exp, msg, assert.notDeepOwnInclude, true).not.deep.own.include(inc);
2926
+ };
2927
+ assert.match = function(exp, re, msg) {
2928
+ new Assertion(exp, msg, assert.match, true).to.match(re);
2929
+ };
2930
+ assert.notMatch = function(exp, re, msg) {
2931
+ new Assertion(exp, msg, assert.notMatch, true).to.not.match(re);
2932
+ };
2933
+ assert.property = function(obj, prop, msg) {
2934
+ new Assertion(obj, msg, assert.property, true).to.have.property(prop);
2935
+ };
2936
+ assert.notProperty = function(obj, prop, msg) {
2937
+ new Assertion(obj, msg, assert.notProperty, true).to.not.have.property(prop);
2938
+ };
2939
+ assert.propertyVal = function(obj, prop, val, msg) {
2940
+ new Assertion(obj, msg, assert.propertyVal, true).to.have.property(prop, val);
2941
+ };
2942
+ assert.notPropertyVal = function(obj, prop, val, msg) {
2943
+ new Assertion(obj, msg, assert.notPropertyVal, true).to.not.have.property(prop, val);
2944
+ };
2945
+ assert.deepPropertyVal = function(obj, prop, val, msg) {
2946
+ new Assertion(obj, msg, assert.deepPropertyVal, true).to.have.deep.property(prop, val);
2947
+ };
2948
+ assert.notDeepPropertyVal = function(obj, prop, val, msg) {
2949
+ new Assertion(obj, msg, assert.notDeepPropertyVal, true).to.not.have.deep.property(prop, val);
2950
+ };
2951
+ assert.ownProperty = function(obj, prop, msg) {
2952
+ new Assertion(obj, msg, assert.ownProperty, true).to.have.own.property(prop);
2953
+ };
2954
+ assert.notOwnProperty = function(obj, prop, msg) {
2955
+ new Assertion(obj, msg, assert.notOwnProperty, true).to.not.have.own.property(prop);
2956
+ };
2957
+ assert.ownPropertyVal = function(obj, prop, value, msg) {
2958
+ new Assertion(obj, msg, assert.ownPropertyVal, true).to.have.own.property(prop, value);
2959
+ };
2960
+ assert.notOwnPropertyVal = function(obj, prop, value, msg) {
2961
+ new Assertion(obj, msg, assert.notOwnPropertyVal, true).to.not.have.own.property(prop, value);
2962
+ };
2963
+ assert.deepOwnPropertyVal = function(obj, prop, value, msg) {
2964
+ new Assertion(obj, msg, assert.deepOwnPropertyVal, true).to.have.deep.own.property(prop, value);
2965
+ };
2966
+ assert.notDeepOwnPropertyVal = function(obj, prop, value, msg) {
2967
+ new Assertion(obj, msg, assert.notDeepOwnPropertyVal, true).to.not.have.deep.own.property(prop, value);
2968
+ };
2969
+ assert.nestedProperty = function(obj, prop, msg) {
2970
+ new Assertion(obj, msg, assert.nestedProperty, true).to.have.nested.property(prop);
2971
+ };
2972
+ assert.notNestedProperty = function(obj, prop, msg) {
2973
+ new Assertion(obj, msg, assert.notNestedProperty, true).to.not.have.nested.property(prop);
2974
+ };
2975
+ assert.nestedPropertyVal = function(obj, prop, val, msg) {
2976
+ new Assertion(obj, msg, assert.nestedPropertyVal, true).to.have.nested.property(prop, val);
2977
+ };
2978
+ assert.notNestedPropertyVal = function(obj, prop, val, msg) {
2979
+ new Assertion(obj, msg, assert.notNestedPropertyVal, true).to.not.have.nested.property(prop, val);
2980
+ };
2981
+ assert.deepNestedPropertyVal = function(obj, prop, val, msg) {
2982
+ new Assertion(obj, msg, assert.deepNestedPropertyVal, true).to.have.deep.nested.property(prop, val);
2983
+ };
2984
+ assert.notDeepNestedPropertyVal = function(obj, prop, val, msg) {
2985
+ new Assertion(obj, msg, assert.notDeepNestedPropertyVal, true).to.not.have.deep.nested.property(prop, val);
2986
+ };
2987
+ assert.lengthOf = function(exp, len, msg) {
2988
+ new Assertion(exp, msg, assert.lengthOf, true).to.have.lengthOf(len);
2989
+ };
2990
+ assert.hasAnyKeys = function(obj, keys, msg) {
2991
+ new Assertion(obj, msg, assert.hasAnyKeys, true).to.have.any.keys(keys);
2992
+ };
2993
+ assert.hasAllKeys = function(obj, keys, msg) {
2994
+ new Assertion(obj, msg, assert.hasAllKeys, true).to.have.all.keys(keys);
2995
+ };
2996
+ assert.containsAllKeys = function(obj, keys, msg) {
2997
+ new Assertion(obj, msg, assert.containsAllKeys, true).to.contain.all.keys(keys);
2998
+ };
2999
+ assert.doesNotHaveAnyKeys = function(obj, keys, msg) {
3000
+ new Assertion(obj, msg, assert.doesNotHaveAnyKeys, true).to.not.have.any.keys(keys);
3001
+ };
3002
+ assert.doesNotHaveAllKeys = function(obj, keys, msg) {
3003
+ new Assertion(obj, msg, assert.doesNotHaveAllKeys, true).to.not.have.all.keys(keys);
3004
+ };
3005
+ assert.hasAnyDeepKeys = function(obj, keys, msg) {
3006
+ new Assertion(obj, msg, assert.hasAnyDeepKeys, true).to.have.any.deep.keys(keys);
3007
+ };
3008
+ assert.hasAllDeepKeys = function(obj, keys, msg) {
3009
+ new Assertion(obj, msg, assert.hasAllDeepKeys, true).to.have.all.deep.keys(keys);
3010
+ };
3011
+ assert.containsAllDeepKeys = function(obj, keys, msg) {
3012
+ new Assertion(obj, msg, assert.containsAllDeepKeys, true).to.contain.all.deep.keys(keys);
3013
+ };
3014
+ assert.doesNotHaveAnyDeepKeys = function(obj, keys, msg) {
3015
+ new Assertion(obj, msg, assert.doesNotHaveAnyDeepKeys, true).to.not.have.any.deep.keys(keys);
3016
+ };
3017
+ assert.doesNotHaveAllDeepKeys = function(obj, keys, msg) {
3018
+ new Assertion(obj, msg, assert.doesNotHaveAllDeepKeys, true).to.not.have.all.deep.keys(keys);
3019
+ };
3020
+ assert.throws = function(fn, errorLike, errMsgMatcher, msg) {
3021
+ if (typeof errorLike === "string" || errorLike instanceof RegExp) {
3022
+ errMsgMatcher = errorLike;
3023
+ errorLike = null;
3024
+ }
3025
+ let assertErr = new Assertion(fn, msg, assert.throws, true).to.throw(errorLike, errMsgMatcher);
3026
+ return flag(assertErr, "object");
3027
+ };
3028
+ assert.doesNotThrow = function(fn, errorLike, errMsgMatcher, message) {
3029
+ if (typeof errorLike === "string" || errorLike instanceof RegExp) {
3030
+ errMsgMatcher = errorLike;
3031
+ errorLike = null;
3032
+ }
3033
+ new Assertion(fn, message, assert.doesNotThrow, true).to.not.throw(errorLike, errMsgMatcher);
3034
+ };
3035
+ assert.operator = function(val, operator, val2, msg) {
3036
+ let ok;
3037
+ switch (operator) {
3038
+ case "==":
3039
+ ok = val == val2;
3040
+ break;
3041
+ case "===":
3042
+ ok = val === val2;
3043
+ break;
3044
+ case ">":
3045
+ ok = val > val2;
3046
+ break;
3047
+ case ">=":
3048
+ ok = val >= val2;
3049
+ break;
3050
+ case "<":
3051
+ ok = val < val2;
3052
+ break;
3053
+ case "<=":
3054
+ ok = val <= val2;
3055
+ break;
3056
+ case "!=":
3057
+ ok = val != val2;
3058
+ break;
3059
+ case "!==":
3060
+ ok = val !== val2;
3061
+ break;
3062
+ default:
3063
+ msg = msg ? msg + ": " : msg;
3064
+ throw new AssertionError(msg + 'Invalid operator "' + operator + '"', undefined, assert.operator);
3065
+ }
3066
+ let test2 = new Assertion(ok, msg, assert.operator, true);
3067
+ test2.assert(flag(test2, "object") === true, "expected " + inspect2(val) + " to be " + operator + " " + inspect2(val2), "expected " + inspect2(val) + " to not be " + operator + " " + inspect2(val2));
3068
+ };
3069
+ assert.closeTo = function(act, exp, delta, msg) {
3070
+ new Assertion(act, msg, assert.closeTo, true).to.be.closeTo(exp, delta);
3071
+ };
3072
+ assert.approximately = function(act, exp, delta, msg) {
3073
+ new Assertion(act, msg, assert.approximately, true).to.be.approximately(exp, delta);
3074
+ };
3075
+ assert.sameMembers = function(set1, set2, msg) {
3076
+ new Assertion(set1, msg, assert.sameMembers, true).to.have.same.members(set2);
3077
+ };
3078
+ assert.notSameMembers = function(set1, set2, msg) {
3079
+ new Assertion(set1, msg, assert.notSameMembers, true).to.not.have.same.members(set2);
3080
+ };
3081
+ assert.sameDeepMembers = function(set1, set2, msg) {
3082
+ new Assertion(set1, msg, assert.sameDeepMembers, true).to.have.same.deep.members(set2);
3083
+ };
3084
+ assert.notSameDeepMembers = function(set1, set2, msg) {
3085
+ new Assertion(set1, msg, assert.notSameDeepMembers, true).to.not.have.same.deep.members(set2);
3086
+ };
3087
+ assert.sameOrderedMembers = function(set1, set2, msg) {
3088
+ new Assertion(set1, msg, assert.sameOrderedMembers, true).to.have.same.ordered.members(set2);
3089
+ };
3090
+ assert.notSameOrderedMembers = function(set1, set2, msg) {
3091
+ new Assertion(set1, msg, assert.notSameOrderedMembers, true).to.not.have.same.ordered.members(set2);
3092
+ };
3093
+ assert.sameDeepOrderedMembers = function(set1, set2, msg) {
3094
+ new Assertion(set1, msg, assert.sameDeepOrderedMembers, true).to.have.same.deep.ordered.members(set2);
3095
+ };
3096
+ assert.notSameDeepOrderedMembers = function(set1, set2, msg) {
3097
+ new Assertion(set1, msg, assert.notSameDeepOrderedMembers, true).to.not.have.same.deep.ordered.members(set2);
3098
+ };
3099
+ assert.includeMembers = function(superset, subset, msg) {
3100
+ new Assertion(superset, msg, assert.includeMembers, true).to.include.members(subset);
3101
+ };
3102
+ assert.notIncludeMembers = function(superset, subset, msg) {
3103
+ new Assertion(superset, msg, assert.notIncludeMembers, true).to.not.include.members(subset);
3104
+ };
3105
+ assert.includeDeepMembers = function(superset, subset, msg) {
3106
+ new Assertion(superset, msg, assert.includeDeepMembers, true).to.include.deep.members(subset);
3107
+ };
3108
+ assert.notIncludeDeepMembers = function(superset, subset, msg) {
3109
+ new Assertion(superset, msg, assert.notIncludeDeepMembers, true).to.not.include.deep.members(subset);
3110
+ };
3111
+ assert.includeOrderedMembers = function(superset, subset, msg) {
3112
+ new Assertion(superset, msg, assert.includeOrderedMembers, true).to.include.ordered.members(subset);
3113
+ };
3114
+ assert.notIncludeOrderedMembers = function(superset, subset, msg) {
3115
+ new Assertion(superset, msg, assert.notIncludeOrderedMembers, true).to.not.include.ordered.members(subset);
3116
+ };
3117
+ assert.includeDeepOrderedMembers = function(superset, subset, msg) {
3118
+ new Assertion(superset, msg, assert.includeDeepOrderedMembers, true).to.include.deep.ordered.members(subset);
3119
+ };
3120
+ assert.notIncludeDeepOrderedMembers = function(superset, subset, msg) {
3121
+ new Assertion(superset, msg, assert.notIncludeDeepOrderedMembers, true).to.not.include.deep.ordered.members(subset);
3122
+ };
3123
+ assert.oneOf = function(inList, list, msg) {
3124
+ new Assertion(inList, msg, assert.oneOf, true).to.be.oneOf(list);
3125
+ };
3126
+ assert.isIterable = function(obj, msg) {
3127
+ if (obj == undefined || !obj[Symbol.iterator]) {
3128
+ msg = msg ? `${msg} expected ${inspect2(obj)} to be an iterable` : `expected ${inspect2(obj)} to be an iterable`;
3129
+ throw new AssertionError(msg, undefined, assert.isIterable);
3130
+ }
3131
+ };
3132
+ assert.changes = function(fn, obj, prop, msg) {
3133
+ if (arguments.length === 3 && typeof obj === "function") {
3134
+ msg = prop;
3135
+ prop = null;
3136
+ }
3137
+ new Assertion(fn, msg, assert.changes, true).to.change(obj, prop);
3138
+ };
3139
+ assert.changesBy = function(fn, obj, prop, delta, msg) {
3140
+ if (arguments.length === 4 && typeof obj === "function") {
3141
+ let tmpMsg = delta;
3142
+ delta = prop;
3143
+ msg = tmpMsg;
3144
+ } else if (arguments.length === 3) {
3145
+ delta = prop;
3146
+ prop = null;
3147
+ }
3148
+ new Assertion(fn, msg, assert.changesBy, true).to.change(obj, prop).by(delta);
3149
+ };
3150
+ assert.doesNotChange = function(fn, obj, prop, msg) {
3151
+ if (arguments.length === 3 && typeof obj === "function") {
3152
+ msg = prop;
3153
+ prop = null;
3154
+ }
3155
+ return new Assertion(fn, msg, assert.doesNotChange, true).to.not.change(obj, prop);
3156
+ };
3157
+ assert.changesButNotBy = function(fn, obj, prop, delta, msg) {
3158
+ if (arguments.length === 4 && typeof obj === "function") {
3159
+ let tmpMsg = delta;
3160
+ delta = prop;
3161
+ msg = tmpMsg;
3162
+ } else if (arguments.length === 3) {
3163
+ delta = prop;
3164
+ prop = null;
3165
+ }
3166
+ new Assertion(fn, msg, assert.changesButNotBy, true).to.change(obj, prop).but.not.by(delta);
3167
+ };
3168
+ assert.increases = function(fn, obj, prop, msg) {
3169
+ if (arguments.length === 3 && typeof obj === "function") {
3170
+ msg = prop;
3171
+ prop = null;
3172
+ }
3173
+ return new Assertion(fn, msg, assert.increases, true).to.increase(obj, prop);
3174
+ };
3175
+ assert.increasesBy = function(fn, obj, prop, delta, msg) {
3176
+ if (arguments.length === 4 && typeof obj === "function") {
3177
+ let tmpMsg = delta;
3178
+ delta = prop;
3179
+ msg = tmpMsg;
3180
+ } else if (arguments.length === 3) {
3181
+ delta = prop;
3182
+ prop = null;
3183
+ }
3184
+ new Assertion(fn, msg, assert.increasesBy, true).to.increase(obj, prop).by(delta);
3185
+ };
3186
+ assert.doesNotIncrease = function(fn, obj, prop, msg) {
3187
+ if (arguments.length === 3 && typeof obj === "function") {
3188
+ msg = prop;
3189
+ prop = null;
3190
+ }
3191
+ return new Assertion(fn, msg, assert.doesNotIncrease, true).to.not.increase(obj, prop);
3192
+ };
3193
+ assert.increasesButNotBy = function(fn, obj, prop, delta, msg) {
3194
+ if (arguments.length === 4 && typeof obj === "function") {
3195
+ let tmpMsg = delta;
3196
+ delta = prop;
3197
+ msg = tmpMsg;
3198
+ } else if (arguments.length === 3) {
3199
+ delta = prop;
3200
+ prop = null;
3201
+ }
3202
+ new Assertion(fn, msg, assert.increasesButNotBy, true).to.increase(obj, prop).but.not.by(delta);
3203
+ };
3204
+ assert.decreases = function(fn, obj, prop, msg) {
3205
+ if (arguments.length === 3 && typeof obj === "function") {
3206
+ msg = prop;
3207
+ prop = null;
3208
+ }
3209
+ return new Assertion(fn, msg, assert.decreases, true).to.decrease(obj, prop);
3210
+ };
3211
+ assert.decreasesBy = function(fn, obj, prop, delta, msg) {
3212
+ if (arguments.length === 4 && typeof obj === "function") {
3213
+ let tmpMsg = delta;
3214
+ delta = prop;
3215
+ msg = tmpMsg;
3216
+ } else if (arguments.length === 3) {
3217
+ delta = prop;
3218
+ prop = null;
3219
+ }
3220
+ new Assertion(fn, msg, assert.decreasesBy, true).to.decrease(obj, prop).by(delta);
3221
+ };
3222
+ assert.doesNotDecrease = function(fn, obj, prop, msg) {
3223
+ if (arguments.length === 3 && typeof obj === "function") {
3224
+ msg = prop;
3225
+ prop = null;
3226
+ }
3227
+ return new Assertion(fn, msg, assert.doesNotDecrease, true).to.not.decrease(obj, prop);
3228
+ };
3229
+ assert.doesNotDecreaseBy = function(fn, obj, prop, delta, msg) {
3230
+ if (arguments.length === 4 && typeof obj === "function") {
3231
+ let tmpMsg = delta;
3232
+ delta = prop;
3233
+ msg = tmpMsg;
3234
+ } else if (arguments.length === 3) {
3235
+ delta = prop;
3236
+ prop = null;
3237
+ }
3238
+ return new Assertion(fn, msg, assert.doesNotDecreaseBy, true).to.not.decrease(obj, prop).by(delta);
3239
+ };
3240
+ assert.decreasesButNotBy = function(fn, obj, prop, delta, msg) {
3241
+ if (arguments.length === 4 && typeof obj === "function") {
3242
+ let tmpMsg = delta;
3243
+ delta = prop;
3244
+ msg = tmpMsg;
3245
+ } else if (arguments.length === 3) {
3246
+ delta = prop;
3247
+ prop = null;
3248
+ }
3249
+ new Assertion(fn, msg, assert.decreasesButNotBy, true).to.decrease(obj, prop).but.not.by(delta);
3250
+ };
3251
+ assert.ifError = function(val) {
3252
+ if (val) {
3253
+ throw val;
3254
+ }
3255
+ };
3256
+ assert.isExtensible = function(obj, msg) {
3257
+ new Assertion(obj, msg, assert.isExtensible, true).to.be.extensible;
3258
+ };
3259
+ assert.isNotExtensible = function(obj, msg) {
3260
+ new Assertion(obj, msg, assert.isNotExtensible, true).to.not.be.extensible;
3261
+ };
3262
+ assert.isSealed = function(obj, msg) {
3263
+ new Assertion(obj, msg, assert.isSealed, true).to.be.sealed;
3264
+ };
3265
+ assert.isNotSealed = function(obj, msg) {
3266
+ new Assertion(obj, msg, assert.isNotSealed, true).to.not.be.sealed;
3267
+ };
3268
+ assert.isFrozen = function(obj, msg) {
3269
+ new Assertion(obj, msg, assert.isFrozen, true).to.be.frozen;
3270
+ };
3271
+ assert.isNotFrozen = function(obj, msg) {
3272
+ new Assertion(obj, msg, assert.isNotFrozen, true).to.not.be.frozen;
3273
+ };
3274
+ assert.isEmpty = function(val, msg) {
3275
+ new Assertion(val, msg, assert.isEmpty, true).to.be.empty;
3276
+ };
3277
+ assert.isNotEmpty = function(val, msg) {
3278
+ new Assertion(val, msg, assert.isNotEmpty, true).to.not.be.empty;
3279
+ };
3280
+ assert.containsSubset = function(val, exp, msg) {
3281
+ new Assertion(val, msg).to.containSubset(exp);
3282
+ };
3283
+ assert.doesNotContainSubset = function(val, exp, msg) {
3284
+ new Assertion(val, msg).to.not.containSubset(exp);
3285
+ };
3286
+ aliases = [
3287
+ ["isOk", "ok"],
3288
+ ["isNotOk", "notOk"],
3289
+ ["throws", "throw"],
3290
+ ["throws", "Throw"],
3291
+ ["isExtensible", "extensible"],
3292
+ ["isNotExtensible", "notExtensible"],
3293
+ ["isSealed", "sealed"],
3294
+ ["isNotSealed", "notSealed"],
3295
+ ["isFrozen", "frozen"],
3296
+ ["isNotFrozen", "notFrozen"],
3297
+ ["isEmpty", "empty"],
3298
+ ["isNotEmpty", "notEmpty"],
3299
+ ["isCallable", "isFunction"],
3300
+ ["isNotCallable", "isNotFunction"],
3301
+ ["containsSubset", "containSubset"]
3302
+ ];
3303
+ for (const [name, as] of aliases) {
3304
+ assert[as] = assert[name];
3305
+ }
3306
+ used = [];
3307
+ __name(use, "use");
3308
+ });
3309
+
20
3310
  // tools/core/results.js
21
3311
  class ModuleInfo {
22
3312
  constructor({ path = null, present = new Set, counts = {}, warnings = [] }) {
@@ -118,6 +3408,50 @@ class RenderBatch {
118
3408
  }
119
3409
  }
120
3410
 
3411
+ class TestResult {
3412
+ constructor({ title, fullPath, componentName = null, status, durationMs = 0, error = null }) {
3413
+ this.title = title;
3414
+ this.fullPath = fullPath;
3415
+ this.componentName = componentName;
3416
+ this.status = status;
3417
+ this.durationMs = durationMs;
3418
+ this.error = error;
3419
+ }
3420
+ }
3421
+
3422
+ class DescribeResult {
3423
+ constructor({ title, componentName = null, children = [] }) {
3424
+ this.title = title;
3425
+ this.componentName = componentName;
3426
+ this.children = children;
3427
+ }
3428
+ }
3429
+
3430
+ class ModuleTestReport {
3431
+ constructor({ path = null, suites = [], counts = { pass: 0, fail: 0, skip: 0, total: 0 } }) {
3432
+ this.path = path;
3433
+ this.suites = suites;
3434
+ this.counts = counts;
3435
+ }
3436
+ }
3437
+
3438
+ class TestReport {
3439
+ constructor({ modules = [] }) {
3440
+ this.modules = modules;
3441
+ }
3442
+ get totals() {
3443
+ return this.modules.reduce((acc, m) => ({
3444
+ pass: acc.pass + m.counts.pass,
3445
+ fail: acc.fail + m.counts.fail,
3446
+ skip: acc.skip + m.counts.skip,
3447
+ total: acc.total + m.counts.total
3448
+ }), { pass: 0, fail: 0, skip: 0, total: 0 });
3449
+ }
3450
+ get hasFailures() {
3451
+ return this.modules.some((m) => m.counts.fail > 0);
3452
+ }
3453
+ }
3454
+
121
3455
  // tools/core/module.js
122
3456
  class Example {
123
3457
  constructor({ title, description = null, value, view = "main", componentName = null }) {
@@ -211,6 +3545,7 @@ function normalizeModule(mod, { path = null } = {}) {
211
3545
  "getMacros",
212
3546
  "getRequestHandlers",
213
3547
  "getExamples",
3548
+ "getTests",
214
3549
  "getRoot"
215
3550
  ]) {
216
3551
  if (typeof mod[key] === "function")
@@ -266,7 +3601,7 @@ function getSignature(name, fn) {
266
3601
  return `${name}(${params})`;
267
3602
  }
268
3603
  function getFieldMethods(field) {
269
- const { name, type } = field;
3604
+ const { name, type: type3 } = field;
270
3605
  const uname = name[0].toUpperCase() + name.slice(1);
271
3606
  const methods = [
272
3607
  { name: `set${uname}`, sig: `set${uname}(v)`, desc: "Set value" },
@@ -291,7 +3626,7 @@ function getFieldMethods(field) {
291
3626
  desc: "Check if not null/undefined"
292
3627
  }
293
3628
  ];
294
- switch (type) {
3629
+ switch (type3) {
295
3630
  case "bool":
296
3631
  methods[0].desc = "Set value (coerces to boolean)";
297
3632
  methods.push({
@@ -344,7 +3679,7 @@ function getFieldMethods(field) {
344
3679
  break;
345
3680
  case "map":
346
3681
  case "omap": {
347
- const label = type === "omap" ? "ordered map" : "map";
3682
+ const label = type3 === "omap" ? "ordered map" : "map";
348
3683
  methods.push({
349
3684
  name: `is${uname}Empty`,
350
3685
  sig: `is${uname}Empty()`,
@@ -478,8 +3813,9 @@ class Step {
478
3813
  setValue(root, _v) {
479
3814
  return root;
480
3815
  }
481
- updateBinds(_v, _o) {}
482
- isFrame = true;
3816
+ enterFrame(stack, _prev, next) {
3817
+ return stack.enter(next, {}, true);
3818
+ }
483
3819
  }
484
3820
 
485
3821
  class Path {
@@ -518,16 +3854,15 @@ class Path {
518
3854
  return newVal;
519
3855
  }
520
3856
  buildStack(stack) {
521
- const root = stack.it;
522
- let curVal = root;
3857
+ let prev = stack.it;
523
3858
  for (const step of this.steps) {
524
- curVal = step.lookup(curVal, NONE);
525
- if (curVal === NONE) {
526
- console.warn(`bad PathItem`, { root, curVal, step, path: this });
3859
+ const next = step.lookup(prev, NONE);
3860
+ if (next === NONE) {
3861
+ console.warn("bad PathItem", { root: stack.it, step, path: this });
527
3862
  return null;
528
3863
  }
529
- step.updateBinds(curVal, stack.binds[0].binds);
530
- stack = stack.enter(curVal, {}, step.isFrame);
3864
+ stack = step.enterFrame(stack, prev, next);
3865
+ prev = next;
531
3866
  }
532
3867
  return stack;
533
3868
  }
@@ -567,8 +3902,8 @@ class Path {
567
3902
  return [new Path(pathSteps.reverse()), handlers];
568
3903
  }
569
3904
  static fromEvent(e, rNode, maxDepth, comps, stopOnNoEvent = true) {
570
- const { type, target } = e;
571
- return Path.fromNodeAndEventName(target, type, rNode, maxDepth, comps, stopOnNoEvent);
3905
+ const { type: type3, target } = e;
3906
+ return Path.fromNodeAndEventName(target, type3, rNode, maxDepth, comps, stopOnNoEvent);
572
3907
  }
573
3908
  }
574
3909
  function parseMetaComment(n) {
@@ -594,12 +3929,27 @@ function findHandlers(comp, eventIds, vid, eventName) {
594
3929
  }
595
3930
  function resolvePathStep(comp, nodeIds, vid) {
596
3931
  for (let i = 0;i < nodeIds.length; i++) {
597
- const node = comp.getNodeForId(+nodeIds[i].nid, vid);
598
- const j = node.pathInNext ? i + 1 : i;
599
- const { si, sk, nid: nodeId } = nodeIds[j];
600
- const pi = node.pathInNext ? comp.getNodeForId(+nodeId, vid).val.toPathItem() : node.toPathItem();
3932
+ const meta = nodeIds[i];
3933
+ const node = comp.getNodeForId(+meta.nid, vid);
3934
+ const key = meta.si !== undefined ? +meta.si : meta.sk;
3935
+ if (node.pathInNext) {
3936
+ const next = nodeIds[i + 1];
3937
+ if (!next)
3938
+ continue;
3939
+ const nextNode = comp.getNodeForId(+next.nid, vid);
3940
+ const nKey = next.si !== undefined ? +next.si : next.sk;
3941
+ if (nextNode.toPathItemRenderIt && nKey !== undefined)
3942
+ return nextNode.toPathItemRenderIt(nKey);
3943
+ const pi2 = nextNode.val.toPathItem();
3944
+ if (pi2 !== null)
3945
+ return next.si !== undefined ? pi2.withIndex(nKey) : next.sk ? pi2.withKey(nKey) : pi2;
3946
+ continue;
3947
+ }
3948
+ if (key !== undefined && node.toPathItemEachBind)
3949
+ return node.toPathItemEachBind(key);
3950
+ const pi = node.toPathItem();
601
3951
  if (pi !== null)
602
- return si !== undefined ? pi.withIndex(+si) : sk ? pi.withKey(sk) : pi;
3952
+ return meta.si !== undefined ? pi.withIndex(+meta.si) : meta.sk ? pi.withKey(meta.sk) : pi;
603
3953
  }
604
3954
  return null;
605
3955
  }
@@ -622,8 +3972,9 @@ class PathBuilder {
622
3972
  return this.add(new SeqKeyStep(name, key));
623
3973
  }
624
3974
  }
625
- var BindStep, FieldStep, FieldSeqStep, SeqKeyStep, SeqIndexStep, NONE, SeqAccessStep, EMPTY_META, NO_EVENT_INFO;
3975
+ var NONE, BindStep, FieldStep, FieldSeqStep, SeqKeyStep, SeqIndexStep, SeqAccessStep, EachBindStep, EachRenderItStep, EMPTY_META, NO_EVENT_INFO;
626
3976
  var init_path = __esm(() => {
3977
+ NONE = Symbol("NONE");
627
3978
  BindStep = class BindStep extends Step {
628
3979
  constructor(binds) {
629
3980
  super();
@@ -635,16 +3986,15 @@ var init_path = __esm(() => {
635
3986
  setValue(_root, v) {
636
3987
  return v;
637
3988
  }
3989
+ enterFrame(stack, _prev, next) {
3990
+ return stack.enter(next, { ...this.binds }, false);
3991
+ }
638
3992
  withIndex(i) {
639
3993
  return new BindStep({ ...this.binds, key: i });
640
3994
  }
641
3995
  withKey(key) {
642
3996
  return new BindStep({ ...this.binds, key });
643
3997
  }
644
- updateBinds(_v, o) {
645
- Object.assign(o, this.binds);
646
- }
647
- isFrame = false;
648
3998
  };
649
3999
  FieldStep = class FieldStep extends Step {
650
4000
  constructor(field) {
@@ -677,15 +4027,14 @@ var init_path = __esm(() => {
677
4027
  setValue(root, v) {
678
4028
  return root.set(this.field, root.get(this.field).set(this.key, v));
679
4029
  }
680
- updateBinds(_v, o) {
681
- o.key = this.key;
4030
+ enterFrame(stack, _prev, next) {
4031
+ return stack.enter(next, { key: this.key }, true);
682
4032
  }
683
4033
  };
684
4034
  SeqKeyStep = class SeqKeyStep extends FieldSeqStep {
685
4035
  };
686
4036
  SeqIndexStep = class SeqIndexStep extends FieldSeqStep {
687
4037
  };
688
- NONE = Symbol("NONE");
689
4038
  SeqAccessStep = class SeqAccessStep extends Step {
690
4039
  constructor(seqField, keyField) {
691
4040
  super();
@@ -702,8 +4051,40 @@ var init_path = __esm(() => {
702
4051
  const key = root?.get(this.keyField, NONE);
703
4052
  return seq === NONE || key === NONE ? root : root.set(this.seqField, seq.set(key, v));
704
4053
  }
705
- updateBinds(v, o) {
706
- o.key = v?.get(this.keyField, null);
4054
+ };
4055
+ EachBindStep = class EachBindStep extends Step {
4056
+ constructor(seqVal, key) {
4057
+ super();
4058
+ this.seqVal = seqVal;
4059
+ this.key = key;
4060
+ }
4061
+ lookup(v, _dval) {
4062
+ return v;
4063
+ }
4064
+ setValue(_root, v) {
4065
+ return v;
4066
+ }
4067
+ enterFrame(stack, _prev, next) {
4068
+ const item = this.seqVal.eval(stack)?.get(this.key, null);
4069
+ return stack.enter(next, { key: this.key, value: item }, false);
4070
+ }
4071
+ };
4072
+ EachRenderItStep = class EachRenderItStep extends Step {
4073
+ constructor(seqField, key) {
4074
+ super();
4075
+ this.seqField = seqField;
4076
+ this.key = key;
4077
+ }
4078
+ lookup(v, dval = null) {
4079
+ const seq = v?.get(this.seqField, null);
4080
+ return seq?.get ? seq.get(this.key, dval) : dval;
4081
+ }
4082
+ setValue(root, v) {
4083
+ const seq = root?.get(this.seqField, null);
4084
+ return seq ? root.set(this.seqField, seq.set(this.key, v)) : root;
4085
+ }
4086
+ enterFrame(stack, _prev, next) {
4087
+ return stack.enter(next, { key: this.key, value: next }, false).enter(next, {}, true);
707
4088
  }
708
4089
  };
709
4090
  EMPTY_META = {};
@@ -864,8 +4245,8 @@ function getValSubType(s) {
864
4245
  return open === 1 && close === 1 ? VAL_SUB_TYPE_SEQ_ACCESS : VAL_SUB_TYPE_INVALID;
865
4246
  return -1;
866
4247
  }
867
- var VALID_VAL_ID_RE, isValidValId = (name) => VALID_VAL_ID_RE.test(name), VALID_FLOAT_RE, STR_TPL_SPLIT_RE, parseStrTemplate = (v, px) => StrTplVal.parse(v, px), parseConst = (v, _) => new ConstVal(v), parseName = (v, _) => isValidValId(v) ? new NameVal(v) : null, parseType = (v, _) => isValidValId(v) ? new TypeVal(v) : null, parseBind = (v, _) => isValidValId(v) ? new BindVal(v) : null, parseDyn = (v, _) => isValidValId(v) ? new DynVal(v) : null, parseField = (v, _) => isValidValId(v) ? new FieldVal(v) : null, parseReq = (v, _) => isValidValId(v) ? new RequestVal(v) : null, ConstVal, VarVal, StrTplVal, NameVal, InputHandlerNameVal, AlterHandlerNameVal, mk404Handler = (type, name) => function(...args) {
868
- console.warn("handler not found", { type, name, args }, this);
4248
+ var VALID_VAL_ID_RE, isValidValId = (name) => VALID_VAL_ID_RE.test(name), VALID_FLOAT_RE, STR_TPL_SPLIT_RE, parseStrTemplate = (v, px) => StrTplVal.parse(v, px), parseConst = (v, _) => new ConstVal(v), parseName = (v, _) => isValidValId(v) ? new NameVal(v) : null, parseType = (v, _) => isValidValId(v) ? new TypeVal(v) : null, parseBind = (v, _) => isValidValId(v) ? new BindVal(v) : null, parseDyn = (v, _) => isValidValId(v) ? new DynVal(v) : null, parseField = (v, _) => isValidValId(v) ? new FieldVal(v) : null, parseReq = (v, _) => isValidValId(v) ? new RequestVal(v) : null, ConstVal, VarVal, StrTplVal, NameVal, InputHandlerNameVal, AlterHandlerNameVal, mk404Handler = (type3, name) => function(...args) {
4249
+ console.warn("handler not found", { type: type3, name, args }, this);
869
4250
  return this;
870
4251
  }, TypeVal, RequestVal, RawFieldVal, RenderVal, RenderNameVal, BindVal, DynVal, FieldVal, SeqAccessVal, VAL_SUB_TYPE_STRING_TEMPLATE = 0, VAL_SUB_TYPE_SEQ_ACCESS = 1, VAL_SUB_TYPE_INVALID = 2, VAL_SUB_TYPE_CONST_STRING = 3, vp;
871
4252
  var init_value = __esm(() => {
@@ -1471,9 +4852,9 @@ class IterInfo {
1471
4852
  }
1472
4853
 
1473
4854
  class ParseContext {
1474
- constructor(document2, Text, Comment, nodes, events, macroNodes, frame, parent) {
4855
+ constructor(document2, Text, Comment, nodes, events2, macroNodes, frame, parent) {
1475
4856
  this.nodes = nodes ?? [];
1476
- this.events = events ?? [];
4857
+ this.events = events2 ?? [];
1477
4858
  this.macroNodes = macroNodes ?? [];
1478
4859
  this.parent = parent ?? null;
1479
4860
  this.frame = frame ?? {};
@@ -1487,9 +4868,9 @@ class ParseContext {
1487
4868
  return this.frame.macroName === name || this.parent?.isInsideMacro(name);
1488
4869
  }
1489
4870
  enterMacro(macroName, macroVars, macroSlots) {
1490
- const { document: document2, Text, Comment, nodes, events, macroNodes } = this;
4871
+ const { document: document2, Text, Comment, nodes, events: events2, macroNodes } = this;
1491
4872
  const frame = { macroName, macroVars, macroSlots };
1492
- return new ParseContext(document2, Text, Comment, nodes, events, macroNodes, frame, this);
4873
+ return new ParseContext(document2, Text, Comment, nodes, events2, macroNodes, frame, this);
1493
4874
  }
1494
4875
  parseHTML(html) {
1495
4876
  const t = this.document.createElement("template");
@@ -1507,9 +4888,9 @@ class ParseContext {
1507
4888
  }
1508
4889
  registerEvents() {
1509
4890
  const id = this.events.length;
1510
- const events = new NodeEvents(id);
1511
- this.events.push(events);
1512
- return events;
4891
+ const events2 = new NodeEvents(id);
4892
+ this.events.push(events2);
4893
+ return events2;
1513
4894
  }
1514
4895
  newMacroNode(macroName, mAttrs, childs) {
1515
4896
  const anySlot = [];
@@ -1935,6 +5316,12 @@ var init_anode = __esm(() => {
1935
5316
  toPathItem() {
1936
5317
  return new BindStep({});
1937
5318
  }
5319
+ toPathItemRenderIt(key) {
5320
+ return new EachRenderItStep(this.val.name, key);
5321
+ }
5322
+ toPathItemEachBind(key) {
5323
+ return new EachBindStep(this.val, key);
5324
+ }
1938
5325
  static register = true;
1939
5326
  };
1940
5327
  X_OP_CONSUMED = {
@@ -2000,10 +5387,10 @@ class Components {
2000
5387
  return comp ? comp.scope.lookupRequest(name) : null;
2001
5388
  }
2002
5389
  compileStyles() {
2003
- const styles = [];
5390
+ const styles2 = [];
2004
5391
  for (const comp of this.byId.values())
2005
- styles.push(comp.compileStyle());
2006
- return styles.join(`
5392
+ styles2.push(comp.compileStyle());
5393
+ return styles2.join(`
2007
5394
  `);
2008
5395
  }
2009
5396
  }
@@ -2019,20 +5406,20 @@ class ComponentStack {
2019
5406
  enter() {
2020
5407
  return new ComponentStack(this.comps, this);
2021
5408
  }
2022
- registerComponents(comps, aliases = {}) {
5409
+ registerComponents(comps, aliases2 = {}) {
2023
5410
  for (let i = 0;i < comps.length; i++) {
2024
5411
  const comp = comps[i];
2025
5412
  comp.scope = this.enter();
2026
5413
  this.comps.registerComponent(comp);
2027
5414
  this.byName[comp.name] = comp;
2028
5415
  }
2029
- for (const alias in aliases) {
2030
- const comp = this.byName[aliases[alias]];
5416
+ for (const alias in aliases2) {
5417
+ const comp = this.byName[aliases2[alias]];
2031
5418
  console.assert(this.byName[alias] === undefined, "alias overrides component", alias);
2032
5419
  if (comp !== undefined)
2033
5420
  this.byName[alias] = comp;
2034
5421
  else
2035
- console.warn("alias", alias, "to inexistent component", aliases[alias]);
5422
+ console.warn("alias", alias, "to inexistent component", aliases2[alias]);
2036
5423
  }
2037
5424
  }
2038
5425
  registerMacros(macros) {
@@ -3851,8 +7238,8 @@ class LinterCtx {
3851
7238
  return this.startInBody(name, raw, selfClosing, start, endIndex);
3852
7239
  }
3853
7240
  if (name === "input") {
3854
- const type = (this.getAttr("type") ?? "").toLowerCase();
3855
- if (type === "hidden")
7241
+ const type3 = (this.getAttr("type") ?? "").toLowerCase();
7242
+ if (type3 === "hidden")
3856
7243
  return;
3857
7244
  this.report(HTML_TAG_NOT_ALLOWED_IN_PARENT, LEVEL_WARN, start, {
3858
7245
  tag: raw,
@@ -4826,11 +8213,6 @@ class Stack {
4826
8213
  _enrichOnEnter() {
4827
8214
  return this.withDynamicBinds(this.comps.getOnEnterFor(this.it).call(this.it));
4828
8215
  }
4829
- upToFrameBinds() {
4830
- const { comps, binds, dynBinds, views, viewsId, ctx } = this;
4831
- const [head, tail] = binds;
4832
- return head.isFrame ? this : new Stack(comps, tail[0].it, tail, dynBinds, views, viewsId, ctx);
4833
- }
4834
8216
  static root(comps, it, ctx) {
4835
8217
  const binds = [new BindFrame(it, { it }, true), null];
4836
8218
  const dynBinds = [new ObjectFrame({}), null];
@@ -5020,8 +8402,7 @@ class Transaction {
5020
8402
  return Stack.root(comps, root);
5021
8403
  }
5022
8404
  buildStack(root, comps) {
5023
- const stack = this.path.buildStack(this.buildRootStack(root, comps));
5024
- return stack ? stack.upToFrameBinds() : null;
8405
+ return this.path.buildStack(this.buildRootStack(root, comps));
5025
8406
  }
5026
8407
  callHandler(root, instance, comps) {
5027
8408
  const [handler, args] = this.getHandlerAndArgs(root, instance, comps);
@@ -5310,13 +8691,13 @@ function diffProps(a, b) {
5310
8691
  function morphNode(domNode, source, target, opts) {
5311
8692
  if (source === target || source.isEqualTo(target))
5312
8693
  return domNode;
5313
- const type = source.nodeType;
5314
- if (type === target.nodeType) {
5315
- if (type === 3 || type === 8) {
8694
+ const type3 = source.nodeType;
8695
+ if (type3 === target.nodeType) {
8696
+ if (type3 === 3 || type3 === 8) {
5316
8697
  domNode.data = target.text;
5317
8698
  return domNode;
5318
8699
  }
5319
- if (type === 1 && source.isSameKind(target)) {
8700
+ if (type3 === 1 && source.isSameKind(target)) {
5320
8701
  const propsDiff = diffProps(source.attrs, target.attrs);
5321
8702
  const isSelect = source.tag === "SELECT";
5322
8703
  if (propsDiff) {
@@ -5332,7 +8713,7 @@ function morphNode(domNode, source, target, opts) {
5332
8713
  applyProperties(domNode, { value: target.attrs.value }, source.attrs);
5333
8714
  return domNode;
5334
8715
  }
5335
- if (type === 11) {
8716
+ if (type3 === 11) {
5336
8717
  morphChildren(domNode, source.childs, target.childs, opts);
5337
8718
  return domNode;
5338
8719
  }
@@ -5375,18 +8756,18 @@ function morphChildren(parentDom, oldChilds, newChilds, opts) {
5375
8756
  if (key != null)
5376
8757
  oldKeyMap[key] = i;
5377
8758
  }
5378
- const used = new Uint8Array(oldChilds.length);
8759
+ const used2 = new Uint8Array(oldChilds.length);
5379
8760
  let unkeyedCursor = 0;
5380
8761
  for (let j = 0;j < newChilds.length; j++) {
5381
8762
  const newChild = newChilds[j];
5382
8763
  const newKey = getKey(newChild);
5383
8764
  let oldIdx = -1;
5384
8765
  if (newKey != null) {
5385
- if (newKey in oldKeyMap && !used[oldKeyMap[newKey]])
8766
+ if (newKey in oldKeyMap && !used2[oldKeyMap[newKey]])
5386
8767
  oldIdx = oldKeyMap[newKey];
5387
8768
  } else {
5388
8769
  while (unkeyedCursor < oldChilds.length) {
5389
- if (!used[unkeyedCursor] && getKey(oldChilds[unkeyedCursor]) == null) {
8770
+ if (!used2[unkeyedCursor] && getKey(oldChilds[unkeyedCursor]) == null) {
5390
8771
  oldIdx = unkeyedCursor++;
5391
8772
  break;
5392
8773
  }
@@ -5394,7 +8775,7 @@ function morphChildren(parentDom, oldChilds, newChilds, opts) {
5394
8775
  }
5395
8776
  }
5396
8777
  if (oldIdx >= 0) {
5397
- used[oldIdx] = 1;
8778
+ used2[oldIdx] = 1;
5398
8779
  const newDom = morphNode(domNodes[oldIdx], oldChilds[oldIdx], newChild, opts);
5399
8780
  const ref = parentDom.childNodes[j] ?? null;
5400
8781
  if (newDom !== ref)
@@ -5405,7 +8786,7 @@ function morphChildren(parentDom, oldChilds, newChilds, opts) {
5405
8786
  }
5406
8787
  }
5407
8788
  for (let i = oldChilds.length - 1;i >= 0; i--)
5408
- if (!used[i] && domNodes[i].parentNode === parentDom)
8789
+ if (!used2[i] && domNodes[i].parentNode === parentDom)
5409
8790
  parentDom.removeChild(domNodes[i]);
5410
8791
  }
5411
8792
  function render(vnode, container, options, prev) {
@@ -5575,27 +8956,27 @@ class App {
5575
8956
  return this.transactor.state;
5576
8957
  }
5577
8958
  handleEvent(e) {
5578
- const { type } = e;
5579
- if (type[0] === "t" && type.startsWith("touch")) {
8959
+ const { type: type3 } = e;
8960
+ if (type3[0] === "t" && type3.startsWith("touch")) {
5580
8961
  this._handleTouchEvent(e);
5581
8962
  return;
5582
8963
  }
5583
8964
  this._dispatchEvent(e);
5584
8965
  }
5585
8966
  _dispatchEvent(e) {
5586
- const { type } = e;
5587
- const isDrag = type === "dragover" || type === "dragstart" || type === "dragend";
8967
+ const { type: type3 } = e;
8968
+ const isDrag = type3 === "dragover" || type3 === "dragstart" || type3 === "dragend";
5588
8969
  const { rootNode: root, maxEventNodeDepth: maxDepth, comps, transactor } = this;
5589
8970
  const [path, handlers] = Path.fromEvent(e, root, maxDepth, comps, !isDrag);
5590
8971
  if (isDrag)
5591
- this._handleDragEvent(e, type, path);
8972
+ this._handleDragEvent(e, type3, path);
5592
8973
  if (path !== null && handlers !== null)
5593
8974
  for (const handler of handlers)
5594
8975
  transactor.transactInputNow(path, e, handler, this.dragInfo);
5595
8976
  }
5596
8977
  _handleTouchEvent(e) {
5597
- const { type } = e;
5598
- if (type === "touchstart") {
8978
+ const { type: type3 } = e;
8979
+ if (type3 === "touchstart") {
5599
8980
  if (this._touch !== null || e.touches.length !== 1)
5600
8981
  return;
5601
8982
  const t = e.touches[0];
@@ -5612,11 +8993,11 @@ class App {
5612
8993
  return;
5613
8994
  const { rootNode, _touch } = this;
5614
8995
  const { clientX, clientY } = touch;
5615
- const fire = (type2, target) => {
5616
- const e2 = { type: type2, target, clientX, clientY, preventDefault: NOOP };
8996
+ const fire = (type4, target) => {
8997
+ const e2 = { type: type4, target, clientX, clientY, preventDefault: NOOP };
5617
8998
  this._dispatchEvent(e2);
5618
8999
  };
5619
- if (type === "touchmove") {
9000
+ if (type3 === "touchmove") {
5620
9001
  if (!_touch.active) {
5621
9002
  const dx = clientX - _touch.startX;
5622
9003
  const dy = clientY - _touch.startY;
@@ -5631,17 +9012,17 @@ class App {
5631
9012
  }
5632
9013
  return;
5633
9014
  }
5634
- if (type === "touchend" || type === "touchcancel") {
9015
+ if (type3 === "touchend" || type3 === "touchcancel") {
5635
9016
  if (_touch.active) {
5636
- if (type === "touchend")
9017
+ if (type3 === "touchend")
5637
9018
  fire("drop", hitTest(rootNode, clientX, clientY));
5638
9019
  fire("dragend", _touch.target);
5639
9020
  }
5640
9021
  this._touch = null;
5641
9022
  }
5642
9023
  }
5643
- _handleDragEvent(e, type, path) {
5644
- if (type === "dragover") {
9024
+ _handleDragEvent(e, type3, path) {
9025
+ if (type3 === "dragover") {
5645
9026
  const dropTarget = getClosestDropTarget(e.target, this.rootNode, 50);
5646
9027
  if (dropTarget !== null) {
5647
9028
  e.preventDefault();
@@ -5649,7 +9030,7 @@ class App {
5649
9030
  this.curDragOver = dropTarget;
5650
9031
  dropTarget.dataset.draggingover = this.dragInfo?.type ?? "_external";
5651
9032
  }
5652
- } else if (type === "dragstart") {
9033
+ } else if (type3 === "dragstart") {
5653
9034
  e.target.dataset.dragging = 1;
5654
9035
  const rootValue = this.state.val;
5655
9036
  const value = path.lookup(rootValue);
@@ -5717,9 +9098,9 @@ class App {
5717
9098
  sendAtRoot(name, args, opts) {
5718
9099
  this.transactor.pushSend(new Path([]), name, args, opts);
5719
9100
  }
5720
- registerComponents(comps, aliases) {
9101
+ registerComponents(comps, aliases2) {
5721
9102
  const scope = this.compStack.enter();
5722
- scope.registerComponents(comps, aliases);
9103
+ scope.registerComponents(comps, aliases2);
5723
9104
  return scope;
5724
9105
  }
5725
9106
  _transactNextBatch(maxRunTimeMs = 10) {
@@ -5785,12 +9166,12 @@ function getClosestDropTarget(target, rootNode, count) {
5785
9166
  }
5786
9167
 
5787
9168
  class DragInfo {
5788
- constructor(path, stack, e, val, type, node) {
9169
+ constructor(path, stack, e, val, type3, node) {
5789
9170
  this.path = path;
5790
9171
  this.stack = stack;
5791
9172
  this.e = e;
5792
9173
  this.val = val;
5793
- this.type = type;
9174
+ this.type = type3;
5794
9175
  this.node = node;
5795
9176
  }
5796
9177
  lookupBind(name) {
@@ -6200,14 +9581,14 @@ function coerceKeyPath(keyPath) {
6200
9581
  }
6201
9582
  throw new TypeError(`Invalid keyPath: expected Ordered Collection or Array: ${keyPath}`);
6202
9583
  }
6203
- function get(collection, key, notSetValue) {
9584
+ function get2(collection, key, notSetValue) {
6204
9585
  return isImmutable(collection) ? collection.get(key, notSetValue) : !has(collection, key) ? notSetValue : typeof collection.get === "function" ? collection.get(key) : collection[key];
6205
9586
  }
6206
9587
  function getIn$1(collection, searchKeyPath, notSetValue) {
6207
9588
  const keyPath = coerceKeyPath(searchKeyPath);
6208
9589
  let i = 0;
6209
9590
  while (i !== keyPath.length) {
6210
- collection = get(collection, keyPath[i++], NOT_SET);
9591
+ collection = get2(collection, keyPath[i++], NOT_SET);
6211
9592
  if (collection === NOT_SET) {
6212
9593
  return notSetValue;
6213
9594
  }
@@ -6256,7 +9637,7 @@ function toJS(value) {
6256
9637
  });
6257
9638
  return result;
6258
9639
  }
6259
- function deepEqual(a, b) {
9640
+ function deepEqual2(a, b) {
6260
9641
  if (a === b) {
6261
9642
  return true;
6262
9643
  }
@@ -6984,7 +10365,7 @@ function remove(collection, key) {
6984
10365
  }
6985
10366
  return collectionCopy;
6986
10367
  }
6987
- function set(collection, key, value) {
10368
+ function set2(collection, key, value) {
6988
10369
  if (!isDataStructure(collection)) {
6989
10370
  throw new TypeError(`Cannot update non-data-structure value: ${collection}`);
6990
10371
  }
@@ -7020,7 +10401,7 @@ function updateInDeeply(inImmutable, existing, keyPath, i, notSetValue, updater)
7020
10401
  throw new TypeError(`Cannot update within non-data-structure value in path [${Array.from(keyPath).slice(0, i).map(quoteString)}]: ${existing}`);
7021
10402
  }
7022
10403
  const key = keyPath[i];
7023
- const nextExisting = wasNotSet ? NOT_SET : get(existing, key, NOT_SET);
10404
+ const nextExisting = wasNotSet ? NOT_SET : get2(existing, key, NOT_SET);
7024
10405
  const nextUpdated = updateInDeeply(nextExisting === NOT_SET ? inImmutable : isImmutable(nextExisting), nextExisting, keyPath, i + 1, notSetValue, updater);
7025
10406
  if (nextUpdated === nextExisting) {
7026
10407
  return existing;
@@ -7029,7 +10410,7 @@ function updateInDeeply(inImmutable, existing, keyPath, i, notSetValue, updater)
7029
10410
  return remove(existing, key);
7030
10411
  }
7031
10412
  const collection = wasNotSet ? inImmutable ? emptyMap() : {} : existing;
7032
- return set(collection, key, nextUpdated);
10413
+ return set2(collection, key, nextUpdated);
7033
10414
  }
7034
10415
  function update$1(collection, key, notSetValue, updater) {
7035
10416
  return updateIn$1(collection, [key], notSetValue, updater);
@@ -7535,26 +10916,26 @@ function returnStack(stack, newSize, head) {
7535
10916
  }
7536
10917
  return makeStack(newSize, head);
7537
10918
  }
7538
- function filterByIters(set2, iters, shouldRemove) {
10919
+ function filterByIters(set3, iters, shouldRemove) {
7539
10920
  if (iters.length === 0) {
7540
- return set2;
10921
+ return set3;
7541
10922
  }
7542
10923
  iters = iters.map((iter) => SetCollection(iter));
7543
- return set2.withMutations((s) => {
7544
- set2.forEach((value) => {
10924
+ return set3.withMutations((s) => {
10925
+ set3.forEach((value) => {
7545
10926
  if (shouldRemove(value, iters)) {
7546
10927
  s.remove(value);
7547
10928
  }
7548
10929
  });
7549
10930
  });
7550
10931
  }
7551
- function updateSet(set2, newMap) {
7552
- if (set2.__ownerID) {
7553
- set2.size = newMap.size;
7554
- set2._map = newMap;
7555
- return set2;
10932
+ function updateSet(set3, newMap) {
10933
+ if (set3.__ownerID) {
10934
+ set3.size = newMap.size;
10935
+ set3._map = newMap;
10936
+ return set3;
7556
10937
  }
7557
- return newMap === set2._map ? set2 : newMap.size === 0 ? set2.__empty() : set2.__make(newMap);
10938
+ return newMap === set3._map ? set3 : newMap.size === 0 ? set3.__empty() : set3.__make(newMap);
7558
10939
  }
7559
10940
  function throwOnInvalidDefaultValues(defaultValues) {
7560
10941
  if (isRecord(defaultValues)) {
@@ -7673,14 +11054,14 @@ var keyMapper = (v, k) => k, entryMapper = (v, k) => [k, v], not = (predicate) =
7673
11054
  const iter = KeyedCollection(value);
7674
11055
  assertNotInfinite(iter.size);
7675
11056
  iter.forEach((v, k) => map.set(k, v));
7676
- }), OrderedMapImpl, makeOrderedMap = (map, list, ownerID, hash2) => new OrderedMapImpl(map, list, ownerID, hash2), emptyOrderedMap = () => makeOrderedMap(emptyMap(), emptyList()), Stack2 = (value) => value === undefined || value === null ? emptyStack() : isStack(value) ? value : emptyStack().pushAll(value), StackImpl, makeStack = (size, head, ownerID, hash2) => new StackImpl(size, head, ownerID, hash2), EMPTY_STACK, emptyStack = () => EMPTY_STACK || (EMPTY_STACK = makeStack(0)), Set2 = (value) => value === undefined || value === null ? emptySet() : isSet(value) && !isOrdered(value) ? value : emptySet().withMutations((set2) => {
11057
+ }), OrderedMapImpl, makeOrderedMap = (map, list, ownerID, hash2) => new OrderedMapImpl(map, list, ownerID, hash2), emptyOrderedMap = () => makeOrderedMap(emptyMap(), emptyList()), Stack2 = (value) => value === undefined || value === null ? emptyStack() : isStack(value) ? value : emptyStack().pushAll(value), StackImpl, makeStack = (size, head, ownerID, hash2) => new StackImpl(size, head, ownerID, hash2), EMPTY_STACK, emptyStack = () => EMPTY_STACK || (EMPTY_STACK = makeStack(0)), Set2 = (value) => value === undefined || value === null ? emptySet() : isSet(value) && !isOrdered(value) ? value : emptySet().withMutations((set3) => {
7677
11058
  const iter = SetCollection(value);
7678
11059
  assertNotInfinite(iter.size);
7679
- iter.forEach((v) => set2.add(v));
7680
- }), SetImpl, makeSet = (map, ownerID) => new SetImpl(map, ownerID), EMPTY_SET, emptySet = () => EMPTY_SET || (EMPTY_SET = makeSet(emptyMap())), OrderedSet = (value) => value === undefined || value === null ? emptyOrderedSet() : isOrderedSet(value) ? value : emptyOrderedSet().withMutations((set2) => {
11060
+ iter.forEach((v) => set3.add(v));
11061
+ }), SetImpl, makeSet = (map, ownerID) => new SetImpl(map, ownerID), EMPTY_SET, emptySet = () => EMPTY_SET || (EMPTY_SET = makeSet(emptyMap())), OrderedSet = (value) => value === undefined || value === null ? emptyOrderedSet() : isOrderedSet(value) ? value : emptyOrderedSet().withMutations((set3) => {
7681
11062
  const iter = SetCollection(value);
7682
11063
  assertNotInfinite(iter.size);
7683
- iter.forEach((v) => set2.add(v));
11064
+ iter.forEach((v) => set3.add(v));
7684
11065
  }), OrderedSetImpl, makeOrderedSet = (map, ownerID) => new OrderedSetImpl(map, ownerID), emptyOrderedSet = () => makeOrderedSet(emptyOrderedMap()), Record = (defaultValues, name) => {
7685
11066
  let hasInitialized;
7686
11067
  throwOnInvalidDefaultValues(defaultValues);
@@ -7765,7 +11146,7 @@ var init_immutable = __esm(() => {
7765
11146
  this.prototype.contains = this.prototype.includes;
7766
11147
  }
7767
11148
  equals(other) {
7768
- return deepEqual(this, other);
11149
+ return deepEqual2(this, other);
7769
11150
  }
7770
11151
  hashCode() {
7771
11152
  return this.__hash ?? (this.__hash = hashCollection(this));
@@ -9619,12 +13000,12 @@ var init_immutable = __esm(() => {
9619
13000
  if (this.size === 0 && !this.__ownerID && iters.length === 1) {
9620
13001
  return Set2(iters[0]);
9621
13002
  }
9622
- return this.withMutations((set2) => {
13003
+ return this.withMutations((set3) => {
9623
13004
  for (const iter of iters) {
9624
13005
  if (typeof iter === "string") {
9625
- set2.add(iter);
13006
+ set3.add(iter);
9626
13007
  } else {
9627
- SetCollection(iter).forEach((value) => set2.add(value));
13008
+ SetCollection(iter).forEach((value) => set3.add(value));
9628
13009
  }
9629
13010
  }
9630
13011
  });
@@ -9929,7 +13310,7 @@ var init_immutable = __esm(() => {
9929
13310
  return makeIndexKeys(this.size);
9930
13311
  }
9931
13312
  equals(other) {
9932
- return other instanceof RangeImpl ? this._start === other._start && this._end === other._end && this._step === other._step : deepEqual(this, other);
13313
+ return other instanceof RangeImpl ? this._start === other._start && this._end === other._end && this._step === other._step : deepEqual2(this, other);
9933
13314
  }
9934
13315
  static {
9935
13316
  this.prototype[Symbol.iterator] = this.prototype.values;
@@ -10015,7 +13396,7 @@ var init_immutable = __esm(() => {
10015
13396
  return makeIndexKeys(this.size);
10016
13397
  }
10017
13398
  equals(other) {
10018
- return other instanceof RepeatImpl ? this.size === other.size && is(this._value, other._value) : deepEqual(this, other);
13399
+ return other instanceof RepeatImpl ? this.size === other.size && is(this._value, other._value) : deepEqual2(this, other);
10019
13400
  }
10020
13401
  static {
10021
13402
  this.prototype[Symbol.iterator] = this.prototype.values;
@@ -10312,6 +13693,227 @@ var init_render2 = __esm(() => {
10312
13693
  init_render();
10313
13694
  });
10314
13695
 
13696
+ // tools/core/tests.js
13697
+ class Describe {
13698
+ constructor({ title, componentName = null, parent = null }) {
13699
+ this.title = title;
13700
+ this.componentName = componentName;
13701
+ this.parent = parent;
13702
+ this.children = [];
13703
+ }
13704
+ }
13705
+
13706
+ class Test {
13707
+ constructor({ title, fn, componentName = null, parent = null }) {
13708
+ this.title = title;
13709
+ this.fn = fn;
13710
+ this.componentName = componentName;
13711
+ this.parent = parent;
13712
+ }
13713
+ }
13714
+
13715
+ class ModuleTests {
13716
+ constructor({ path = null, suites = [] } = {}) {
13717
+ this.path = path;
13718
+ this.suites = suites;
13719
+ }
13720
+ }
13721
+ function isComponentObject(x) {
13722
+ return x !== null && typeof x === "object" && typeof x.name === "string" && typeof x.Class === "function";
13723
+ }
13724
+ function resolveComponentName2(arg, components) {
13725
+ if (isComponentObject(arg))
13726
+ return arg.name;
13727
+ if (typeof arg === "function") {
13728
+ for (const c of components)
13729
+ if (c.Class === arg)
13730
+ return c.name;
13731
+ }
13732
+ return null;
13733
+ }
13734
+ function titleFromArg(arg) {
13735
+ if (typeof arg === "string")
13736
+ return arg;
13737
+ if (isComponentObject(arg))
13738
+ return arg.name;
13739
+ if (typeof arg === "function")
13740
+ return arg.name || "(anonymous)";
13741
+ return String(arg);
13742
+ }
13743
+ function makeCollector({ path = null, components = [] } = {}) {
13744
+ const moduleTests = new ModuleTests({ path, suites: [] });
13745
+ const stack = [];
13746
+ function describe(...args) {
13747
+ let head;
13748
+ let options = null;
13749
+ let fn;
13750
+ if (args.length === 2) {
13751
+ [head, fn] = args;
13752
+ } else if (args.length === 3) {
13753
+ [head, options, fn] = args;
13754
+ } else {
13755
+ throw new Error(`describe() expects 2 or 3 arguments, got ${args.length}`);
13756
+ }
13757
+ if (typeof fn !== "function") {
13758
+ throw new Error(`describe(${JSON.stringify(titleFromArg(head))}): final argument must be a function`);
13759
+ }
13760
+ let componentName = null;
13761
+ if (typeof head !== "string") {
13762
+ componentName = resolveComponentName2(head, components);
13763
+ }
13764
+ if (componentName === null && options && options.component != null) {
13765
+ componentName = resolveComponentName2(options.component, components);
13766
+ }
13767
+ if (componentName === null) {
13768
+ const parent2 = stack.length ? stack[stack.length - 1] : null;
13769
+ if (parent2)
13770
+ componentName = parent2.componentName;
13771
+ }
13772
+ const parent = stack.length ? stack[stack.length - 1] : null;
13773
+ const node = new Describe({
13774
+ title: titleFromArg(head),
13775
+ componentName,
13776
+ parent
13777
+ });
13778
+ if (parent)
13779
+ parent.children.push(node);
13780
+ else
13781
+ moduleTests.suites.push(node);
13782
+ stack.push(node);
13783
+ try {
13784
+ fn();
13785
+ } finally {
13786
+ stack.pop();
13787
+ }
13788
+ }
13789
+ function test2(title, fn) {
13790
+ if (typeof title !== "string") {
13791
+ throw new Error("test(title, fn): title must be a string");
13792
+ }
13793
+ if (typeof fn !== "function") {
13794
+ throw new Error(`test(${JSON.stringify(title)}): fn must be a function`);
13795
+ }
13796
+ const parent = stack.length ? stack[stack.length - 1] : null;
13797
+ if (!parent) {
13798
+ throw new Error(`test(${JSON.stringify(title)}) must be called inside a describe()`);
13799
+ }
13800
+ parent.children.push(new Test({
13801
+ title,
13802
+ fn,
13803
+ componentName: parent.componentName,
13804
+ parent
13805
+ }));
13806
+ }
13807
+ return { describe, test: test2, moduleTests };
13808
+ }
13809
+
13810
+ // tools/core/test.js
13811
+ function buildPath(node) {
13812
+ const parts = [];
13813
+ let cur = node;
13814
+ while (cur) {
13815
+ parts.unshift(cur.title);
13816
+ cur = cur.parent;
13817
+ }
13818
+ return parts.join(" > ");
13819
+ }
13820
+ function captureError(e) {
13821
+ const out = { message: e.message, stack: e.stack };
13822
+ if ("expected" in e)
13823
+ out.expected = e.expected;
13824
+ if ("actual" in e)
13825
+ out.actual = e.actual;
13826
+ return out;
13827
+ }
13828
+ async function runTests({
13829
+ getTests,
13830
+ components = [],
13831
+ path = null,
13832
+ expect: expect2,
13833
+ name = null,
13834
+ grep = null,
13835
+ bail = false
13836
+ } = {}) {
13837
+ const counts = { pass: 0, fail: 0, skip: 0, total: 0 };
13838
+ if (typeof getTests !== "function") {
13839
+ return new TestReport({
13840
+ modules: [new ModuleTestReport({ path, suites: [], counts })]
13841
+ });
13842
+ }
13843
+ if (typeof expect2 !== "function") {
13844
+ throw new Error("runTests: expect must be provided (e.g. chai's expect)");
13845
+ }
13846
+ const { describe, test: test2, moduleTests } = makeCollector({ path, components });
13847
+ await getTests({ describe, test: test2, expect: expect2 });
13848
+ let bailed = false;
13849
+ async function visit(node) {
13850
+ if (node instanceof Test) {
13851
+ if (name !== null && node.componentName !== name)
13852
+ return null;
13853
+ const fullPath = buildPath(node);
13854
+ if (grep !== null && !fullPath.includes(grep))
13855
+ return null;
13856
+ counts.total++;
13857
+ if (bailed) {
13858
+ counts.skip++;
13859
+ return new TestResult({
13860
+ title: node.title,
13861
+ fullPath,
13862
+ componentName: node.componentName,
13863
+ status: "skip"
13864
+ });
13865
+ }
13866
+ const start = performance.now();
13867
+ try {
13868
+ await node.fn();
13869
+ counts.pass++;
13870
+ return new TestResult({
13871
+ title: node.title,
13872
+ fullPath,
13873
+ componentName: node.componentName,
13874
+ status: "pass",
13875
+ durationMs: performance.now() - start
13876
+ });
13877
+ } catch (e) {
13878
+ counts.fail++;
13879
+ if (bail)
13880
+ bailed = true;
13881
+ return new TestResult({
13882
+ title: node.title,
13883
+ fullPath,
13884
+ componentName: node.componentName,
13885
+ status: "fail",
13886
+ durationMs: performance.now() - start,
13887
+ error: captureError(e)
13888
+ });
13889
+ }
13890
+ }
13891
+ const childResults = [];
13892
+ for (const child of node.children) {
13893
+ const r = await visit(child);
13894
+ if (r !== null)
13895
+ childResults.push(r);
13896
+ }
13897
+ if (childResults.length === 0)
13898
+ return null;
13899
+ return new DescribeResult({
13900
+ title: node.title,
13901
+ componentName: node.componentName,
13902
+ children: childResults
13903
+ });
13904
+ }
13905
+ const suiteResults = [];
13906
+ for (const suite of moduleTests.suites) {
13907
+ const r = await visit(suite);
13908
+ if (r !== null)
13909
+ suiteResults.push(r);
13910
+ }
13911
+ return new TestReport({
13912
+ modules: [new ModuleTestReport({ path, suites: suiteResults, counts })]
13913
+ });
13914
+ }
13915
+ var init_test = () => {};
13916
+
10315
13917
  // tools/cli/commands/_registry.js
10316
13918
  var exports__registry = {};
10317
13919
  __export(exports__registry, {
@@ -10319,11 +13921,13 @@ __export(exports__registry, {
10319
13921
  });
10320
13922
  var COMMANDS;
10321
13923
  var init__registry = __esm(() => {
13924
+ init_chai();
10322
13925
  init_describe();
10323
13926
  init_docs();
10324
13927
  init_list();
10325
13928
  init_lint();
10326
13929
  init_render2();
13930
+ init_test();
10327
13931
  COMMANDS = {
10328
13932
  info: {
10329
13933
  describe: "Summarize the module's exports and counts.",
@@ -10369,6 +13973,25 @@ var init__registry = __esm(() => {
10369
13973
  view: values.view ?? null
10370
13974
  }),
10371
13975
  exitOn: (result) => result.hasErrors ? 3 : 0
13976
+ },
13977
+ test: {
13978
+ describe: "Run tests defined by getTests() (optional <name> to filter by component).",
13979
+ defaultFormat: "cli",
13980
+ needsEnv: true,
13981
+ parseOptions: {
13982
+ grep: { type: "string" },
13983
+ bail: { type: "boolean" }
13984
+ },
13985
+ run: (normalized, { values, positionals }) => runTests({
13986
+ getTests: normalized.mod.getTests,
13987
+ components: normalized.components,
13988
+ path: normalized.path,
13989
+ expect,
13990
+ name: positionals[0] ?? null,
13991
+ grep: values.grep ?? null,
13992
+ bail: values.bail ?? false
13993
+ }),
13994
+ exitOn: (result) => result.hasFailures ? 4 : 0
10372
13995
  }
10373
13996
  };
10374
13997
  });
@@ -10548,6 +14171,15 @@ MODULE CONVENTION
10548
14171
  export function getRequestHandlers() // optional
10549
14172
  -> Record<string, Function>
10550
14173
 
14174
+ export function getTests({ describe, test, expect }) // required for test
14175
+ -> void // imperative collector
14176
+ where describe is one of:
14177
+ describe(Component, fn) // tags suite with Component.name
14178
+ describe(title, fn) // untagged
14179
+ describe(title, { component }, fn)// explicit tag with custom title
14180
+ and test(title, fn) // fn may be async
14181
+ and expect comes from chai
14182
+
10551
14183
  export function getRoot() // optional; returned by info
10552
14184
 
10553
14185
  COMMANDS (require <module-path>)
@@ -10579,6 +14211,14 @@ COMMANDS (require <module-path>)
10579
14211
  --view <v> override the example's view name
10580
14212
  Exits 3 if any render crashes.
10581
14213
 
14214
+ test [name] [--grep <pattern>] [--bail]
14215
+ Run tests defined by getTests({ describe, test, expect }). Filters:
14216
+ [name] only tests whose tagged componentName equals <name>
14217
+ --grep <p> substring match against the full test path
14218
+ (e.g. "MyComp > nested describe > test name")
14219
+ --bail stop on first failure; remaining tests reported as skip
14220
+ Exits 4 if any test fails.
14221
+
10582
14222
  COMMANDS (no module required)
10583
14223
  help [command]
10584
14224
  Without [command]: prints this full reference.
@@ -10615,6 +14255,7 @@ EXIT CODES
10615
14255
  1 usage error (bad args, missing module, bad module shape)
10616
14256
  2 lint findings at error level
10617
14257
  3 render crash
14258
+ 4 test failures
10618
14259
 
10619
14260
  ENVIRONMENT
10620
14261
  \`prettier\` is an optional peer dep, only used by --pretty.
@@ -10981,6 +14622,51 @@ function fmtLintReport(rep) {
10981
14622
  return lines.join(`
10982
14623
  `);
10983
14624
  }
14625
+ function fmtTestNode(node, depth, lines) {
14626
+ const pad = " ".repeat(depth);
14627
+ if (node.children) {
14628
+ lines.push(`${pad}${node.title}`);
14629
+ for (const child of node.children)
14630
+ fmtTestNode(child, depth + 1, lines);
14631
+ return;
14632
+ }
14633
+ const mark = node.status === "pass" ? "✓" : node.status === "fail" ? "✗" : "○";
14634
+ const dur = node.status === "skip" ? "" : ` (${Math.round(node.durationMs)}ms)`;
14635
+ lines.push(`${pad}${mark} ${node.title}${dur}`);
14636
+ if (node.status === "fail" && node.error) {
14637
+ const errPad = " ".repeat(depth + 1);
14638
+ lines.push(`${errPad}${node.error.message}`);
14639
+ if ("expected" in node.error || "actual" in node.error) {
14640
+ lines.push(`${errPad} expected: ${JSON.stringify(node.error.expected)}`);
14641
+ lines.push(`${errPad} actual: ${JSON.stringify(node.error.actual)}`);
14642
+ }
14643
+ if (node.error.stack) {
14644
+ const trimmed = node.error.stack.split(`
14645
+ `).slice(1, 4).map((l) => `${errPad}${l.trim()}`).join(`
14646
+ `);
14647
+ if (trimmed)
14648
+ lines.push(trimmed);
14649
+ }
14650
+ }
14651
+ }
14652
+ function fmtTestReport(report) {
14653
+ const lines = [];
14654
+ for (const m of report.modules) {
14655
+ if (m.path)
14656
+ lines.push(`Module: ${m.path}`);
14657
+ if (m.suites.length === 0) {
14658
+ lines.push("(no tests)");
14659
+ } else {
14660
+ for (const s of m.suites)
14661
+ fmtTestNode(s, 0, lines);
14662
+ }
14663
+ const c = m.counts;
14664
+ lines.push("");
14665
+ lines.push(`Total: ${c.pass} passed, ${c.fail} failed, ${c.skip} skipped (${c.total} total)`);
14666
+ }
14667
+ return lines.join(`
14668
+ `);
14669
+ }
10984
14670
  function fmtRenderBatch(batch) {
10985
14671
  const totalItems = batch.sections.reduce((n, s) => n + s.items.length, 0);
10986
14672
  if (totalItems === 0)
@@ -11002,7 +14688,8 @@ var { supports, format } = makeFormatter("cli", {
11002
14688
  ExampleIndex: fmtExampleIndex,
11003
14689
  ComponentDocs: fmtComponentDocs,
11004
14690
  LintReport: fmtLintReport,
11005
- RenderBatch: fmtRenderBatch
14691
+ RenderBatch: fmtRenderBatch,
14692
+ TestReport: fmtTestReport
11006
14693
  });
11007
14694
 
11008
14695
  // tools/format/md.js
@@ -11149,13 +14836,54 @@ function fmtComponentList2(list) {
11149
14836
  return lines.join(`
11150
14837
  `);
11151
14838
  }
14839
+ function fmtTestSubtree(node, depth, lines) {
14840
+ if (node.children) {
14841
+ const headerLevel = Math.min(depth + 2, 6);
14842
+ lines.push(`${"#".repeat(headerLevel)} ${node.title}`, "");
14843
+ for (const child of node.children)
14844
+ fmtTestSubtree(child, depth + 1, lines);
14845
+ return;
14846
+ }
14847
+ const mark = node.status === "pass" ? "✓" : node.status === "fail" ? "✗" : "○";
14848
+ const dur = node.status === "skip" ? "" : ` _(${Math.round(node.durationMs)}ms)_`;
14849
+ lines.push(`- ${mark} **${node.title}**${dur}`);
14850
+ if (node.status === "fail" && node.error) {
14851
+ lines.push("", "```");
14852
+ lines.push(node.error.message);
14853
+ if ("expected" in node.error || "actual" in node.error) {
14854
+ lines.push(`expected: ${JSON.stringify(node.error.expected)}`);
14855
+ lines.push(`actual: ${JSON.stringify(node.error.actual)}`);
14856
+ }
14857
+ if (node.error.stack)
14858
+ lines.push(node.error.stack);
14859
+ lines.push("```", "");
14860
+ }
14861
+ }
14862
+ function fmtTestReport2(report) {
14863
+ const lines = [];
14864
+ for (const m of report.modules) {
14865
+ lines.push(`# Test report${m.path ? ` — ${m.path}` : ""}`, "");
14866
+ if (m.suites.length === 0) {
14867
+ lines.push("_(no tests)_", "");
14868
+ } else {
14869
+ for (const s of m.suites)
14870
+ fmtTestSubtree(s, 0, lines);
14871
+ }
14872
+ const c = m.counts;
14873
+ lines.push("");
14874
+ lines.push(`**Total:** ${c.pass} passed, ${c.fail} failed, ${c.skip} skipped (${c.total} total)`);
14875
+ }
14876
+ return lines.join(`
14877
+ `);
14878
+ }
11152
14879
  var { supports: supports2, format: format2 } = makeFormatter("md", {
11153
14880
  ComponentDocs: fmtComponentDocs2,
11154
14881
  RenderBatch: fmtRenderBatch2,
11155
14882
  ExampleIndex: fmtExampleIndex2,
11156
14883
  LintReport: fmtLintReport2,
11157
14884
  ModuleInfo: fmtModuleInfo2,
11158
- ComponentList: fmtComponentList2
14885
+ ComponentList: fmtComponentList2,
14886
+ TestReport: fmtTestReport2
11159
14887
  });
11160
14888
 
11161
14889
  // tools/format/json.js
@@ -11178,7 +14906,8 @@ var { supports: supports3, format: format3 } = makeFormatter("json", {
11178
14906
  ExampleIndex: fmtJson,
11179
14907
  ComponentDocs: fmtJson,
11180
14908
  LintReport: fmtJson,
11181
- RenderBatch: fmtJson
14909
+ RenderBatch: fmtJson,
14910
+ TestReport: fmtJson
11182
14911
  });
11183
14912
 
11184
14913
  // tools/format/html.js