tutuca 0.9.71 → 0.9.73

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.
@@ -1,3465 +1,5 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __hasOwnProp = Object.prototype.hasOwnProperty;
4
- function __accessProp(key) {
5
- return this[key];
6
- }
7
- var __reExport = (target, mod, secondTarget) => {
8
- var keys = __getOwnPropNames(mod);
9
- for (let key of keys)
10
- if (!__hasOwnProp.call(target, key) && key !== "default")
11
- __defProp(target, key, {
12
- get: __accessProp.bind(mod, key),
13
- enumerable: true
14
- });
15
- if (secondTarget) {
16
- for (let key of keys)
17
- if (!__hasOwnProp.call(secondTarget, key) && key !== "default")
18
- __defProp(secondTarget, key, {
19
- get: __accessProp.bind(mod, key),
20
- enumerable: true
21
- });
22
- return secondTarget;
23
- }
24
- };
25
- var __returnValue = (v) => v;
26
- function __exportSetter(name, newValue) {
27
- this[name] = __returnValue.bind(null, newValue);
28
- }
29
- var __export = (target, all) => {
30
- for (var name in all)
31
- __defProp(target, name, {
32
- get: all[name],
33
- enumerable: true,
34
- configurable: true,
35
- set: __exportSetter.bind(all, name)
36
- });
37
- };
38
-
39
- // dev.js
40
- var exports_dev = {};
41
- __export(exports_dev, {
42
- tutuca: () => tutuca,
43
- test: () => test4,
44
- suggestionToMessage: () => suggestionToMessage,
45
- runTests: () => runTests,
46
- reportTestReportToConsole: () => reportTestReportToConsole,
47
- makeCollector: () => makeCollector,
48
- macro: () => macro,
49
- lintIdToMessage: () => lintIdToMessage,
50
- isOMap: () => isOrderedMap,
51
- isIMap: () => isMap,
52
- injectCss: () => injectCss,
53
- html: () => html,
54
- getComponentsDocs: () => getComponentsDocs,
55
- docComponents: () => docComponents,
56
- css: () => css,
57
- component: () => component,
58
- compileClassesToStyleText: () => compileClassesToStyleText,
59
- compileClassesToStyle: () => compileClassesToStyle,
60
- collectIterBindings: () => collectIterBindings2,
61
- checkComponent: () => checkComponent,
62
- check: () => check2,
63
- UNSUPPORTED_EXPR_SYNTAX: () => UNSUPPORTED_EXPR_SYNTAX,
64
- UNKNOWN_X_OP: () => UNKNOWN_X_OP,
65
- UNKNOWN_X_ATTR: () => UNKNOWN_X_ATTR,
66
- UNKNOWN_REQUEST_NAME: () => UNKNOWN_REQUEST_NAME,
67
- UNKNOWN_MACRO_ARG: () => UNKNOWN_MACRO_ARG,
68
- UNKNOWN_HANDLER_ARG_NAME: () => UNKNOWN_HANDLER_ARG_NAME,
69
- UNKNOWN_EVENT_MODIFIER: () => UNKNOWN_EVENT_MODIFIER,
70
- UNKNOWN_DIRECTIVE: () => UNKNOWN_DIRECTIVE,
71
- UNKNOWN_COMPONENT_SPEC_KEY: () => UNKNOWN_COMPONENT_SPEC_KEY,
72
- UNKNOWN_COMPONENT_NAME: () => UNKNOWN_COMPONENT_NAME,
73
- TestResult: () => TestResult,
74
- TestReport: () => TestReport,
75
- TestIndex: () => TestIndex,
76
- Test: () => Test,
77
- SEQ_INFO: () => SEQ_INFO,
78
- RenderedSection: () => RenderedSection,
79
- RenderedExample: () => RenderedExample,
80
- RenderBatch: () => RenderBatch,
81
- RENDER_IT_OUTSIDE_OF_LOOP: () => RENDER_IT_OUTSIDE_OF_LOOP,
82
- REDUNDANT_TEMPLATE_STRING: () => REDUNDANT_TEMPLATE_STRING,
83
- ParseContext: () => ParseContext,
84
- PLACEHOLDERLESS_TEMPLATE_STRING: () => PLACEHOLDERLESS_TEMPLATE_STRING,
85
- OMap: () => OrderedMap2,
86
- ModuleTests: () => ModuleTests,
87
- ModuleTestReport: () => ModuleTestReport,
88
- ModuleInfo: () => ModuleInfo,
89
- METHOD_VAL_NOT_DEFINED: () => METHOD_VAL_NOT_DEFINED,
90
- METHOD_VAL_IS_FIELD: () => METHOD_VAL_IS_FIELD,
91
- MAYBE_DROP_AT_PREFIX: () => MAYBE_DROP_AT_PREFIX,
92
- MAYBE_ADD_AT_PREFIX: () => MAYBE_ADD_AT_PREFIX,
93
- LintReport: () => LintReport,
94
- LintParseContext: () => LintParseContext,
95
- LintFinding: () => LintFinding,
96
- LintContext: () => LintContext,
97
- LintComponentResult: () => LintComponentResult,
98
- LintClassCollectorCtx: () => LintClassCollectorCtx,
99
- KList: () => KList,
100
- ISet: () => Set2,
101
- INPUT_HANDLER_NOT_REFERENCED: () => INPUT_HANDLER_NOT_REFERENCED,
102
- INPUT_HANDLER_NOT_IMPLEMENTED: () => INPUT_HANDLER_NOT_IMPLEMENTED,
103
- INPUT_HANDLER_METHOD_NOT_IMPLEMENTED: () => INPUT_HANDLER_METHOD_NOT_IMPLEMENTED,
104
- INPUT_HANDLER_METHOD_FOR_INPUT_HANDLER: () => INPUT_HANDLER_METHOD_FOR_INPUT_HANDLER,
105
- INPUT_HANDLER_FOR_INPUT_HANDLER_METHOD: () => INPUT_HANDLER_FOR_INPUT_HANDLER_METHOD,
106
- IMap: () => Map2,
107
- IF_NO_BRANCH_SET: () => IF_NO_BRANCH_SET,
108
- FIELD_VAL_NOT_DEFINED: () => FIELD_VAL_NOT_DEFINED,
109
- FIELD_VAL_IS_METHOD: () => FIELD_VAL_IS_METHOD,
110
- FIELD_CLASS: () => FIELD_CLASS,
111
- ExampleIndex: () => ExampleIndex,
112
- DescribeResult: () => DescribeResult,
113
- Describe: () => Describe,
114
- DYN_VAL_NOT_DEFINED: () => DYN_VAL_NOT_DEFINED,
115
- DYN_ALIAS_NOT_REFERENCED: () => DYN_ALIAS_NOT_REFERENCED,
116
- DUPLICATE_ATTR_DEFINITION: () => DUPLICATE_ATTR_DEFINITION,
117
- ComponentSummary: () => ComponentSummary,
118
- ComponentList: () => ComponentList,
119
- ComponentDocs: () => ComponentDocs,
120
- COMP_FIELD_BAD_SHAPE: () => COMP_FIELD_BAD_SHAPE,
121
- BAD_VALUE: () => BAD_VALUE,
122
- ALT_HANDLER_NOT_REFERENCED: () => ALT_HANDLER_NOT_REFERENCED,
123
- ALT_HANDLER_NOT_DEFINED: () => ALT_HANDLER_NOT_DEFINED
124
- });
125
-
126
- // node_modules/chai/index.js
127
- var exports_chai = {};
128
- __export(exports_chai, {
129
- util: () => utils_exports,
130
- use: () => use,
131
- should: () => should,
132
- expect: () => expect,
133
- config: () => config,
134
- assert: () => assert,
135
- Should: () => Should,
136
- AssertionError: () => AssertionError,
137
- Assertion: () => Assertion
138
- });
139
- var __defProp2 = Object.defineProperty;
140
- var __defNormalProp = (obj, key, value) => (key in obj) ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
141
- var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
142
- var __export2 = (target, all) => {
143
- for (var name in all)
144
- __defProp2(target, name, { get: all[name], enumerable: true });
145
- };
146
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
147
- var utils_exports = {};
148
- __export2(utils_exports, {
149
- addChainableMethod: () => addChainableMethod,
150
- addLengthGuard: () => addLengthGuard,
151
- addMethod: () => addMethod,
152
- addProperty: () => addProperty,
153
- checkError: () => check_error_exports,
154
- compareByInspect: () => compareByInspect,
155
- eql: () => deep_eql_default,
156
- events: () => events,
157
- expectTypes: () => expectTypes,
158
- flag: () => flag,
159
- getActual: () => getActual,
160
- getMessage: () => getMessage2,
161
- getName: () => getName,
162
- getOperator: () => getOperator,
163
- getOwnEnumerableProperties: () => getOwnEnumerableProperties,
164
- getOwnEnumerablePropertySymbols: () => getOwnEnumerablePropertySymbols,
165
- getPathInfo: () => getPathInfo,
166
- hasProperty: () => hasProperty,
167
- inspect: () => inspect2,
168
- isNaN: () => isNaN2,
169
- isNumeric: () => isNumeric,
170
- isProxyEnabled: () => isProxyEnabled,
171
- isRegExp: () => isRegExp2,
172
- objDisplay: () => objDisplay,
173
- overwriteChainableMethod: () => overwriteChainableMethod,
174
- overwriteMethod: () => overwriteMethod,
175
- overwriteProperty: () => overwriteProperty,
176
- proxify: () => proxify,
177
- test: () => test,
178
- transferFlags: () => transferFlags,
179
- type: () => type
180
- });
181
- var check_error_exports = {};
182
- __export2(check_error_exports, {
183
- compatibleConstructor: () => compatibleConstructor,
184
- compatibleInstance: () => compatibleInstance,
185
- compatibleMessage: () => compatibleMessage,
186
- getConstructorName: () => getConstructorName,
187
- getMessage: () => getMessage
188
- });
189
- function isErrorInstance(obj) {
190
- return obj instanceof Error || Object.prototype.toString.call(obj) === "[object Error]";
191
- }
192
- __name(isErrorInstance, "isErrorInstance");
193
- function isRegExp(obj) {
194
- return Object.prototype.toString.call(obj) === "[object RegExp]";
195
- }
196
- __name(isRegExp, "isRegExp");
197
- function compatibleInstance(thrown, errorLike) {
198
- return isErrorInstance(errorLike) && thrown === errorLike;
199
- }
200
- __name(compatibleInstance, "compatibleInstance");
201
- function compatibleConstructor(thrown, errorLike) {
202
- if (isErrorInstance(errorLike)) {
203
- return thrown.constructor === errorLike.constructor || thrown instanceof errorLike.constructor;
204
- } else if ((typeof errorLike === "object" || typeof errorLike === "function") && errorLike.prototype) {
205
- return thrown.constructor === errorLike || thrown instanceof errorLike;
206
- }
207
- return false;
208
- }
209
- __name(compatibleConstructor, "compatibleConstructor");
210
- function compatibleMessage(thrown, errMatcher) {
211
- const comparisonString = typeof thrown === "string" ? thrown : thrown.message;
212
- if (isRegExp(errMatcher)) {
213
- return errMatcher.test(comparisonString);
214
- } else if (typeof errMatcher === "string") {
215
- return comparisonString.indexOf(errMatcher) !== -1;
216
- }
217
- return false;
218
- }
219
- __name(compatibleMessage, "compatibleMessage");
220
- function getConstructorName(errorLike) {
221
- let constructorName = errorLike;
222
- if (isErrorInstance(errorLike)) {
223
- constructorName = errorLike.constructor.name;
224
- } else if (typeof errorLike === "function") {
225
- constructorName = errorLike.name;
226
- if (constructorName === "") {
227
- const newConstructorName = new errorLike().name;
228
- constructorName = newConstructorName || constructorName;
229
- }
230
- }
231
- return constructorName;
232
- }
233
- __name(getConstructorName, "getConstructorName");
234
- function getMessage(errorLike) {
235
- let msg = "";
236
- if (errorLike && errorLike.message) {
237
- msg = errorLike.message;
238
- } else if (typeof errorLike === "string") {
239
- msg = errorLike;
240
- }
241
- return msg;
242
- }
243
- __name(getMessage, "getMessage");
244
- function flag(obj, key, value) {
245
- let flags = obj.__flags || (obj.__flags = /* @__PURE__ */ Object.create(null));
246
- if (arguments.length === 3) {
247
- flags[key] = value;
248
- } else {
249
- return flags[key];
250
- }
251
- }
252
- __name(flag, "flag");
253
- function test(obj, args) {
254
- let negate = flag(obj, "negate"), expr = args[0];
255
- return negate ? !expr : expr;
256
- }
257
- __name(test, "test");
258
- function type(obj) {
259
- if (typeof obj === "undefined") {
260
- return "undefined";
261
- }
262
- if (obj === null) {
263
- return "null";
264
- }
265
- const stringTag = obj[Symbol.toStringTag];
266
- if (typeof stringTag === "string") {
267
- return stringTag;
268
- }
269
- const type3 = Object.prototype.toString.call(obj).slice(8, -1);
270
- return type3;
271
- }
272
- __name(type, "type");
273
- var canElideFrames = "captureStackTrace" in Error;
274
- var _AssertionError = class _AssertionError2 extends Error {
275
- constructor(message = "Unspecified AssertionError", props, ssf) {
276
- super(message);
277
- __publicField(this, "message");
278
- this.message = message;
279
- if (canElideFrames) {
280
- Error.captureStackTrace(this, ssf || _AssertionError2);
281
- }
282
- for (const key in props) {
283
- if (!(key in this)) {
284
- this[key] = props[key];
285
- }
286
- }
287
- }
288
- get name() {
289
- return "AssertionError";
290
- }
291
- get ok() {
292
- return false;
293
- }
294
- toJSON(stack) {
295
- return {
296
- ...this,
297
- name: this.name,
298
- message: this.message,
299
- ok: false,
300
- stack: stack !== false ? this.stack : undefined
301
- };
302
- }
303
- };
304
- __name(_AssertionError, "AssertionError");
305
- var AssertionError = _AssertionError;
306
- function expectTypes(obj, types) {
307
- let flagMsg = flag(obj, "message");
308
- let ssfi = flag(obj, "ssfi");
309
- flagMsg = flagMsg ? flagMsg + ": " : "";
310
- obj = flag(obj, "object");
311
- types = types.map(function(t) {
312
- return t.toLowerCase();
313
- });
314
- types.sort();
315
- let str = types.map(function(t, index) {
316
- let art = ~["a", "e", "i", "o", "u"].indexOf(t.charAt(0)) ? "an" : "a";
317
- let or = types.length > 1 && index === types.length - 1 ? "or " : "";
318
- return or + art + " " + t;
319
- }).join(", ");
320
- let objType = type(obj).toLowerCase();
321
- if (!types.some(function(expected) {
322
- return objType === expected;
323
- })) {
324
- throw new AssertionError(flagMsg + "object tested must be " + str + ", but " + objType + " given", undefined, ssfi);
325
- }
326
- }
327
- __name(expectTypes, "expectTypes");
328
- function getActual(obj, args) {
329
- return args.length > 4 ? args[4] : obj._obj;
330
- }
331
- __name(getActual, "getActual");
332
- var ansiColors = {
333
- bold: ["1", "22"],
334
- dim: ["2", "22"],
335
- italic: ["3", "23"],
336
- underline: ["4", "24"],
337
- inverse: ["7", "27"],
338
- hidden: ["8", "28"],
339
- strike: ["9", "29"],
340
- black: ["30", "39"],
341
- red: ["31", "39"],
342
- green: ["32", "39"],
343
- yellow: ["33", "39"],
344
- blue: ["34", "39"],
345
- magenta: ["35", "39"],
346
- cyan: ["36", "39"],
347
- white: ["37", "39"],
348
- brightblack: ["30;1", "39"],
349
- brightred: ["31;1", "39"],
350
- brightgreen: ["32;1", "39"],
351
- brightyellow: ["33;1", "39"],
352
- brightblue: ["34;1", "39"],
353
- brightmagenta: ["35;1", "39"],
354
- brightcyan: ["36;1", "39"],
355
- brightwhite: ["37;1", "39"],
356
- grey: ["90", "39"]
357
- };
358
- var styles = {
359
- special: "cyan",
360
- number: "yellow",
361
- bigint: "yellow",
362
- boolean: "yellow",
363
- undefined: "grey",
364
- null: "bold",
365
- string: "green",
366
- symbol: "green",
367
- date: "magenta",
368
- regexp: "red"
369
- };
370
- var truncator = "…";
371
- function colorise(value, styleType) {
372
- const color = ansiColors[styles[styleType]] || ansiColors[styleType] || "";
373
- if (!color) {
374
- return String(value);
375
- }
376
- return `\x1B[${color[0]}m${String(value)}\x1B[${color[1]}m`;
377
- }
378
- __name(colorise, "colorise");
379
- function normaliseOptions({
380
- showHidden = false,
381
- depth = 2,
382
- colors = false,
383
- customInspect = true,
384
- showProxy = false,
385
- maxArrayLength = Infinity,
386
- breakLength = Infinity,
387
- seen = [],
388
- truncate: truncate2 = Infinity,
389
- stylize = String
390
- } = {}, inspect3) {
391
- const options = {
392
- showHidden: Boolean(showHidden),
393
- depth: Number(depth),
394
- colors: Boolean(colors),
395
- customInspect: Boolean(customInspect),
396
- showProxy: Boolean(showProxy),
397
- maxArrayLength: Number(maxArrayLength),
398
- breakLength: Number(breakLength),
399
- truncate: Number(truncate2),
400
- seen,
401
- inspect: inspect3,
402
- stylize
403
- };
404
- if (options.colors) {
405
- options.stylize = colorise;
406
- }
407
- return options;
408
- }
409
- __name(normaliseOptions, "normaliseOptions");
410
- function isHighSurrogate(char) {
411
- return char >= "\uD800" && char <= "\uDBFF";
412
- }
413
- __name(isHighSurrogate, "isHighSurrogate");
414
- function truncate(string, length, tail = truncator) {
415
- string = String(string);
416
- const tailLength = tail.length;
417
- const stringLength = string.length;
418
- if (tailLength > length && stringLength > tailLength) {
419
- return tail;
420
- }
421
- if (stringLength > length && stringLength > tailLength) {
422
- let end = length - tailLength;
423
- if (end > 0 && isHighSurrogate(string[end - 1])) {
424
- end = end - 1;
425
- }
426
- return `${string.slice(0, end)}${tail}`;
427
- }
428
- return string;
429
- }
430
- __name(truncate, "truncate");
431
- function inspectList(list, options, inspectItem, separator = ", ") {
432
- inspectItem = inspectItem || options.inspect;
433
- const size = list.length;
434
- if (size === 0)
435
- return "";
436
- const originalLength = options.truncate;
437
- let output = "";
438
- let peek = "";
439
- let truncated = "";
440
- for (let i = 0;i < size; i += 1) {
441
- const last = i + 1 === list.length;
442
- const secondToLast = i + 2 === list.length;
443
- truncated = `${truncator}(${list.length - i})`;
444
- const value = list[i];
445
- options.truncate = originalLength - output.length - (last ? 0 : separator.length);
446
- const string = peek || inspectItem(value, options) + (last ? "" : separator);
447
- const nextLength = output.length + string.length;
448
- const truncatedLength = nextLength + truncated.length;
449
- if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) {
450
- break;
451
- }
452
- if (!last && !secondToLast && truncatedLength > originalLength) {
453
- break;
454
- }
455
- peek = last ? "" : inspectItem(list[i + 1], options) + (secondToLast ? "" : separator);
456
- if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) {
457
- break;
458
- }
459
- output += string;
460
- if (!last && !secondToLast && nextLength + peek.length >= originalLength) {
461
- truncated = `${truncator}(${list.length - i - 1})`;
462
- break;
463
- }
464
- truncated = "";
465
- }
466
- return `${output}${truncated}`;
467
- }
468
- __name(inspectList, "inspectList");
469
- function quoteComplexKey(key) {
470
- if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) {
471
- return key;
472
- }
473
- return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
474
- }
475
- __name(quoteComplexKey, "quoteComplexKey");
476
- function inspectProperty([key, value], options) {
477
- options.truncate -= 2;
478
- if (typeof key === "string") {
479
- key = quoteComplexKey(key);
480
- } else if (typeof key !== "number") {
481
- key = `[${options.inspect(key, options)}]`;
482
- }
483
- options.truncate -= key.length;
484
- value = options.inspect(value, options);
485
- return `${key}: ${value}`;
486
- }
487
- __name(inspectProperty, "inspectProperty");
488
- function inspectArray(array, options) {
489
- const nonIndexProperties = Object.keys(array).slice(array.length);
490
- if (!array.length && !nonIndexProperties.length)
491
- return "[]";
492
- options.truncate -= 4;
493
- const listContents = inspectList(array, options);
494
- options.truncate -= listContents.length;
495
- let propertyContents = "";
496
- if (nonIndexProperties.length) {
497
- propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
498
- }
499
- return `[ ${listContents}${propertyContents ? `, ${propertyContents}` : ""} ]`;
500
- }
501
- __name(inspectArray, "inspectArray");
502
- var getArrayName = /* @__PURE__ */ __name((array) => {
503
- if (typeof Buffer === "function" && array instanceof Buffer) {
504
- return "Buffer";
505
- }
506
- if (array[Symbol.toStringTag]) {
507
- return array[Symbol.toStringTag];
508
- }
509
- return array.constructor.name;
510
- }, "getArrayName");
511
- function inspectTypedArray(array, options) {
512
- const name = getArrayName(array);
513
- options.truncate -= name.length + 4;
514
- const nonIndexProperties = Object.keys(array).slice(array.length);
515
- if (!array.length && !nonIndexProperties.length)
516
- return `${name}[]`;
517
- let output = "";
518
- for (let i = 0;i < array.length; i++) {
519
- const string = `${options.stylize(truncate(array[i], options.truncate), "number")}${i === array.length - 1 ? "" : ", "}`;
520
- options.truncate -= string.length;
521
- if (array[i] !== array.length && options.truncate <= 3) {
522
- output += `${truncator}(${array.length - array[i] + 1})`;
523
- break;
524
- }
525
- output += string;
526
- }
527
- let propertyContents = "";
528
- if (nonIndexProperties.length) {
529
- propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
530
- }
531
- return `${name}[ ${output}${propertyContents ? `, ${propertyContents}` : ""} ]`;
532
- }
533
- __name(inspectTypedArray, "inspectTypedArray");
534
- function inspectDate(dateObject, options) {
535
- const stringRepresentation = dateObject.toJSON();
536
- if (stringRepresentation === null) {
537
- return "Invalid Date";
538
- }
539
- const split = stringRepresentation.split("T");
540
- const date = split[0];
541
- return options.stylize(`${date}T${truncate(split[1], options.truncate - date.length - 1)}`, "date");
542
- }
543
- __name(inspectDate, "inspectDate");
544
- function inspectFunction(func, options) {
545
- const functionType = func[Symbol.toStringTag] || "Function";
546
- const name = func.name;
547
- if (!name) {
548
- return options.stylize(`[${functionType}]`, "special");
549
- }
550
- return options.stylize(`[${functionType} ${truncate(name, options.truncate - 11)}]`, "special");
551
- }
552
- __name(inspectFunction, "inspectFunction");
553
- function inspectMapEntry([key, value], options) {
554
- options.truncate -= 4;
555
- key = options.inspect(key, options);
556
- options.truncate -= key.length;
557
- value = options.inspect(value, options);
558
- return `${key} => ${value}`;
559
- }
560
- __name(inspectMapEntry, "inspectMapEntry");
561
- function mapToEntries(map) {
562
- const entries = [];
563
- map.forEach((value, key) => {
564
- entries.push([key, value]);
565
- });
566
- return entries;
567
- }
568
- __name(mapToEntries, "mapToEntries");
569
- function inspectMap(map, options) {
570
- if (map.size === 0)
571
- return "Map{}";
572
- options.truncate -= 7;
573
- return `Map{ ${inspectList(mapToEntries(map), options, inspectMapEntry)} }`;
574
- }
575
- __name(inspectMap, "inspectMap");
576
- var isNaN = Number.isNaN || ((i) => i !== i);
577
- function inspectNumber(number, options) {
578
- if (isNaN(number)) {
579
- return options.stylize("NaN", "number");
580
- }
581
- if (number === Infinity) {
582
- return options.stylize("Infinity", "number");
583
- }
584
- if (number === -Infinity) {
585
- return options.stylize("-Infinity", "number");
586
- }
587
- if (number === 0) {
588
- return options.stylize(1 / number === Infinity ? "+0" : "-0", "number");
589
- }
590
- return options.stylize(truncate(String(number), options.truncate), "number");
591
- }
592
- __name(inspectNumber, "inspectNumber");
593
- function inspectBigInt(number, options) {
594
- let nums = truncate(number.toString(), options.truncate - 1);
595
- if (nums !== truncator)
596
- nums += "n";
597
- return options.stylize(nums, "bigint");
598
- }
599
- __name(inspectBigInt, "inspectBigInt");
600
- function inspectRegExp(value, options) {
601
- const flags = value.toString().split("/")[2];
602
- const sourceLength = options.truncate - (2 + flags.length);
603
- const source = value.source;
604
- return options.stylize(`/${truncate(source, sourceLength)}/${flags}`, "regexp");
605
- }
606
- __name(inspectRegExp, "inspectRegExp");
607
- function arrayFromSet(set2) {
608
- const values = [];
609
- set2.forEach((value) => {
610
- values.push(value);
611
- });
612
- return values;
613
- }
614
- __name(arrayFromSet, "arrayFromSet");
615
- function inspectSet(set2, options) {
616
- if (set2.size === 0)
617
- return "Set{}";
618
- options.truncate -= 7;
619
- return `Set{ ${inspectList(arrayFromSet(set2), options)} }`;
620
- }
621
- __name(inspectSet, "inspectSet");
622
- var stringEscapeChars = new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", "g");
623
- var escapeCharacters = {
624
- "\b": "\\b",
625
- "\t": "\\t",
626
- "\n": "\\n",
627
- "\f": "\\f",
628
- "\r": "\\r",
629
- "'": "\\'",
630
- "\\": "\\\\"
631
- };
632
- var hex = 16;
633
- var unicodeLength = 4;
634
- function escape(char) {
635
- return escapeCharacters[char] || `\\u${`0000${char.charCodeAt(0).toString(hex)}`.slice(-unicodeLength)}`;
636
- }
637
- __name(escape, "escape");
638
- function inspectString(string, options) {
639
- if (stringEscapeChars.test(string)) {
640
- string = string.replace(stringEscapeChars, escape);
641
- }
642
- return options.stylize(`'${truncate(string, options.truncate - 2)}'`, "string");
643
- }
644
- __name(inspectString, "inspectString");
645
- function inspectSymbol(value) {
646
- if ("description" in Symbol.prototype) {
647
- return value.description ? `Symbol(${value.description})` : "Symbol()";
648
- }
649
- return value.toString();
650
- }
651
- __name(inspectSymbol, "inspectSymbol");
652
- var getPromiseValue = /* @__PURE__ */ __name(() => "Promise{…}", "getPromiseValue");
653
- var promise_default = getPromiseValue;
654
- function inspectObject(object, options) {
655
- const properties = Object.getOwnPropertyNames(object);
656
- const symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : [];
657
- if (properties.length === 0 && symbols.length === 0) {
658
- return "{}";
659
- }
660
- options.truncate -= 4;
661
- options.seen = options.seen || [];
662
- if (options.seen.includes(object)) {
663
- return "[Circular]";
664
- }
665
- options.seen.push(object);
666
- const propertyContents = inspectList(properties.map((key) => [key, object[key]]), options, inspectProperty);
667
- const symbolContents = inspectList(symbols.map((key) => [key, object[key]]), options, inspectProperty);
668
- options.seen.pop();
669
- let sep = "";
670
- if (propertyContents && symbolContents) {
671
- sep = ", ";
672
- }
673
- return `{ ${propertyContents}${sep}${symbolContents} }`;
674
- }
675
- __name(inspectObject, "inspectObject");
676
- var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag ? Symbol.toStringTag : false;
677
- function inspectClass(value, options) {
678
- let name = "";
679
- if (toStringTag && toStringTag in value) {
680
- name = value[toStringTag];
681
- }
682
- name = name || value.constructor.name;
683
- if (!name || name === "_class") {
684
- name = "<Anonymous Class>";
685
- }
686
- options.truncate -= name.length;
687
- return `${name}${inspectObject(value, options)}`;
688
- }
689
- __name(inspectClass, "inspectClass");
690
- function inspectArguments(args, options) {
691
- if (args.length === 0)
692
- return "Arguments[]";
693
- options.truncate -= 13;
694
- return `Arguments[ ${inspectList(args, options)} ]`;
695
- }
696
- __name(inspectArguments, "inspectArguments");
697
- var errorKeys = [
698
- "stack",
699
- "line",
700
- "column",
701
- "name",
702
- "message",
703
- "fileName",
704
- "lineNumber",
705
- "columnNumber",
706
- "number",
707
- "description",
708
- "cause"
709
- ];
710
- function inspectObject2(error, options) {
711
- const properties = Object.getOwnPropertyNames(error).filter((key) => errorKeys.indexOf(key) === -1);
712
- const name = error.name;
713
- options.truncate -= name.length;
714
- let message = "";
715
- if (typeof error.message === "string") {
716
- message = truncate(error.message, options.truncate);
717
- } else {
718
- properties.unshift("message");
719
- }
720
- message = message ? `: ${message}` : "";
721
- options.truncate -= message.length + 5;
722
- options.seen = options.seen || [];
723
- if (options.seen.includes(error)) {
724
- return "[Circular]";
725
- }
726
- options.seen.push(error);
727
- const propertyContents = inspectList(properties.map((key) => [key, error[key]]), options, inspectProperty);
728
- return `${name}${message}${propertyContents ? ` { ${propertyContents} }` : ""}`;
729
- }
730
- __name(inspectObject2, "inspectObject");
731
- function inspectAttribute([key, value], options) {
732
- options.truncate -= 3;
733
- if (!value) {
734
- return `${options.stylize(String(key), "yellow")}`;
735
- }
736
- return `${options.stylize(String(key), "yellow")}=${options.stylize(`"${value}"`, "string")}`;
737
- }
738
- __name(inspectAttribute, "inspectAttribute");
739
- function inspectNodeCollection(collection, options) {
740
- return inspectList(collection, options, inspectNode, `
741
- `);
742
- }
743
- __name(inspectNodeCollection, "inspectNodeCollection");
744
- function inspectNode(node, options) {
745
- switch (node.nodeType) {
746
- case 1:
747
- return inspectHTML(node, options);
748
- case 3:
749
- return options.inspect(node.data, options);
750
- default:
751
- return options.inspect(node, options);
752
- }
753
- }
754
- __name(inspectNode, "inspectNode");
755
- function inspectHTML(element, options) {
756
- const properties = element.getAttributeNames();
757
- const name = element.tagName.toLowerCase();
758
- const head = options.stylize(`<${name}`, "special");
759
- const headClose = options.stylize(`>`, "special");
760
- const tail = options.stylize(`</${name}>`, "special");
761
- options.truncate -= name.length * 2 + 5;
762
- let propertyContents = "";
763
- if (properties.length > 0) {
764
- propertyContents += " ";
765
- propertyContents += inspectList(properties.map((key) => [key, element.getAttribute(key)]), options, inspectAttribute, " ");
766
- }
767
- options.truncate -= propertyContents.length;
768
- const truncate2 = options.truncate;
769
- let children = inspectNodeCollection(element.children, options);
770
- if (children && children.length > truncate2) {
771
- children = `${truncator}(${element.children.length})`;
772
- }
773
- return `${head}${propertyContents}${headClose}${children}${tail}`;
774
- }
775
- __name(inspectHTML, "inspectHTML");
776
- var symbolsSupported = typeof Symbol === "function" && typeof Symbol.for === "function";
777
- var chaiInspect = symbolsSupported ? /* @__PURE__ */ Symbol.for("chai/inspect") : "@@chai/inspect";
778
- var nodeInspect = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
779
- var constructorMap = /* @__PURE__ */ new WeakMap;
780
- var stringTagMap = {};
781
- var baseTypesMap = {
782
- undefined: /* @__PURE__ */ __name((value, options) => options.stylize("undefined", "undefined"), "undefined"),
783
- null: /* @__PURE__ */ __name((value, options) => options.stylize("null", "null"), "null"),
784
- boolean: /* @__PURE__ */ __name((value, options) => options.stylize(String(value), "boolean"), "boolean"),
785
- Boolean: /* @__PURE__ */ __name((value, options) => options.stylize(String(value), "boolean"), "Boolean"),
786
- number: inspectNumber,
787
- Number: inspectNumber,
788
- bigint: inspectBigInt,
789
- BigInt: inspectBigInt,
790
- string: inspectString,
791
- String: inspectString,
792
- function: inspectFunction,
793
- Function: inspectFunction,
794
- symbol: inspectSymbol,
795
- Symbol: inspectSymbol,
796
- Array: inspectArray,
797
- Date: inspectDate,
798
- Map: inspectMap,
799
- Set: inspectSet,
800
- RegExp: inspectRegExp,
801
- Promise: promise_default,
802
- WeakSet: /* @__PURE__ */ __name((value, options) => options.stylize("WeakSet{…}", "special"), "WeakSet"),
803
- WeakMap: /* @__PURE__ */ __name((value, options) => options.stylize("WeakMap{…}", "special"), "WeakMap"),
804
- Arguments: inspectArguments,
805
- Int8Array: inspectTypedArray,
806
- Uint8Array: inspectTypedArray,
807
- Uint8ClampedArray: inspectTypedArray,
808
- Int16Array: inspectTypedArray,
809
- Uint16Array: inspectTypedArray,
810
- Int32Array: inspectTypedArray,
811
- Uint32Array: inspectTypedArray,
812
- Float32Array: inspectTypedArray,
813
- Float64Array: inspectTypedArray,
814
- Generator: /* @__PURE__ */ __name(() => "", "Generator"),
815
- DataView: /* @__PURE__ */ __name(() => "", "DataView"),
816
- ArrayBuffer: /* @__PURE__ */ __name(() => "", "ArrayBuffer"),
817
- Error: inspectObject2,
818
- HTMLCollection: inspectNodeCollection,
819
- NodeList: inspectNodeCollection
820
- };
821
- var inspectCustom = /* @__PURE__ */ __name((value, options, type3, inspectFn) => {
822
- if (chaiInspect in value && typeof value[chaiInspect] === "function") {
823
- return value[chaiInspect](options);
824
- }
825
- if (nodeInspect in value && typeof value[nodeInspect] === "function") {
826
- return value[nodeInspect](options.depth, options, inspectFn);
827
- }
828
- if ("inspect" in value && typeof value.inspect === "function") {
829
- return value.inspect(options.depth, options);
830
- }
831
- if ("constructor" in value && constructorMap.has(value.constructor)) {
832
- return constructorMap.get(value.constructor)(value, options);
833
- }
834
- if (stringTagMap[type3]) {
835
- return stringTagMap[type3](value, options);
836
- }
837
- return "";
838
- }, "inspectCustom");
839
- var toString = Object.prototype.toString;
840
- function inspect(value, opts = {}) {
841
- const options = normaliseOptions(opts, inspect);
842
- const { customInspect } = options;
843
- let type3 = value === null ? "null" : typeof value;
844
- if (type3 === "object") {
845
- type3 = toString.call(value).slice(8, -1);
846
- }
847
- if (type3 in baseTypesMap) {
848
- return baseTypesMap[type3](value, options);
849
- }
850
- if (customInspect && value) {
851
- const output = inspectCustom(value, options, type3, inspect);
852
- if (output) {
853
- if (typeof output === "string")
854
- return output;
855
- return inspect(output, options);
856
- }
857
- }
858
- const proto = value ? Object.getPrototypeOf(value) : false;
859
- if (proto === Object.prototype || proto === null) {
860
- return inspectObject(value, options);
861
- }
862
- if (value && typeof HTMLElement === "function" && value instanceof HTMLElement) {
863
- return inspectHTML(value, options);
864
- }
865
- if ("constructor" in value) {
866
- if (value.constructor !== Object) {
867
- return inspectClass(value, options);
868
- }
869
- return inspectObject(value, options);
870
- }
871
- if (value === Object(value)) {
872
- return inspectObject(value, options);
873
- }
874
- return options.stylize(String(value), type3);
875
- }
876
- __name(inspect, "inspect");
877
- var config = {
878
- includeStack: false,
879
- showDiff: true,
880
- truncateThreshold: 40,
881
- useProxy: true,
882
- proxyExcludedKeys: ["then", "catch", "inspect", "toJSON"],
883
- deepEqual: null
884
- };
885
- function inspect2(obj, showHidden, depth, colors) {
886
- let options = {
887
- colors,
888
- depth: typeof depth === "undefined" ? 2 : depth,
889
- showHidden,
890
- truncate: config.truncateThreshold ? config.truncateThreshold : Infinity
891
- };
892
- return inspect(obj, options);
893
- }
894
- __name(inspect2, "inspect");
895
- function objDisplay(obj) {
896
- let str = inspect2(obj), type3 = Object.prototype.toString.call(obj);
897
- if (config.truncateThreshold && str.length >= config.truncateThreshold) {
898
- if (type3 === "[object Function]") {
899
- return !obj.name || obj.name === "" ? "[Function]" : "[Function: " + obj.name + "]";
900
- } else if (type3 === "[object Array]") {
901
- return "[ Array(" + obj.length + ") ]";
902
- } else if (type3 === "[object Object]") {
903
- let keys = Object.keys(obj), kstr = keys.length > 2 ? keys.splice(0, 2).join(", ") + ", ..." : keys.join(", ");
904
- return "{ Object (" + kstr + ") }";
905
- } else {
906
- return str;
907
- }
908
- } else {
909
- return str;
910
- }
911
- }
912
- __name(objDisplay, "objDisplay");
913
- function getMessage2(obj, args) {
914
- let negate = flag(obj, "negate");
915
- let val = flag(obj, "object");
916
- let expected = args[3];
917
- let actual = getActual(obj, args);
918
- let msg = negate ? args[2] : args[1];
919
- let flagMsg = flag(obj, "message");
920
- if (typeof msg === "function")
921
- msg = msg();
922
- msg = msg || "";
923
- msg = msg.replace(/#\{this\}/g, function() {
924
- return objDisplay(val);
925
- }).replace(/#\{act\}/g, function() {
926
- return objDisplay(actual);
927
- }).replace(/#\{exp\}/g, function() {
928
- return objDisplay(expected);
929
- });
930
- return flagMsg ? flagMsg + ": " + msg : msg;
931
- }
932
- __name(getMessage2, "getMessage");
933
- function transferFlags(assertion, object, includeAll) {
934
- let flags = assertion.__flags || (assertion.__flags = /* @__PURE__ */ Object.create(null));
935
- if (!object.__flags) {
936
- object.__flags = /* @__PURE__ */ Object.create(null);
937
- }
938
- includeAll = arguments.length === 3 ? includeAll : true;
939
- for (let flag3 in flags) {
940
- if (includeAll || flag3 !== "object" && flag3 !== "ssfi" && flag3 !== "lockSsfi" && flag3 != "message") {
941
- object.__flags[flag3] = flags[flag3];
942
- }
943
- }
944
- }
945
- __name(transferFlags, "transferFlags");
946
- function type2(obj) {
947
- if (typeof obj === "undefined") {
948
- return "undefined";
949
- }
950
- if (obj === null) {
951
- return "null";
952
- }
953
- const stringTag = obj[Symbol.toStringTag];
954
- if (typeof stringTag === "string") {
955
- return stringTag;
956
- }
957
- const sliceStart = 8;
958
- const sliceEnd = -1;
959
- return Object.prototype.toString.call(obj).slice(sliceStart, sliceEnd);
960
- }
961
- __name(type2, "type");
962
- function FakeMap() {
963
- this._key = "chai/deep-eql__" + Math.random() + Date.now();
964
- }
965
- __name(FakeMap, "FakeMap");
966
- FakeMap.prototype = {
967
- get: /* @__PURE__ */ __name(function get(key) {
968
- return key[this._key];
969
- }, "get"),
970
- set: /* @__PURE__ */ __name(function set(key, value) {
971
- if (Object.isExtensible(key)) {
972
- Object.defineProperty(key, this._key, {
973
- value,
974
- configurable: true
975
- });
976
- }
977
- }, "set")
978
- };
979
- var MemoizeMap = typeof WeakMap === "function" ? WeakMap : FakeMap;
980
- function memoizeCompare(leftHandOperand, rightHandOperand, memoizeMap) {
981
- if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
982
- return null;
983
- }
984
- var leftHandMap = memoizeMap.get(leftHandOperand);
985
- if (leftHandMap) {
986
- var result = leftHandMap.get(rightHandOperand);
987
- if (typeof result === "boolean") {
988
- return result;
989
- }
990
- }
991
- return null;
992
- }
993
- __name(memoizeCompare, "memoizeCompare");
994
- function memoizeSet(leftHandOperand, rightHandOperand, memoizeMap, result) {
995
- if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
996
- return;
997
- }
998
- var leftHandMap = memoizeMap.get(leftHandOperand);
999
- if (leftHandMap) {
1000
- leftHandMap.set(rightHandOperand, result);
1001
- } else {
1002
- leftHandMap = new MemoizeMap;
1003
- leftHandMap.set(rightHandOperand, result);
1004
- memoizeMap.set(leftHandOperand, leftHandMap);
1005
- }
1006
- }
1007
- __name(memoizeSet, "memoizeSet");
1008
- var deep_eql_default = deepEqual;
1009
- function deepEqual(leftHandOperand, rightHandOperand, options) {
1010
- if (options && options.comparator) {
1011
- return extensiveDeepEqual(leftHandOperand, rightHandOperand, options);
1012
- }
1013
- var simpleResult = simpleEqual(leftHandOperand, rightHandOperand);
1014
- if (simpleResult !== null) {
1015
- return simpleResult;
1016
- }
1017
- return extensiveDeepEqual(leftHandOperand, rightHandOperand, options);
1018
- }
1019
- __name(deepEqual, "deepEqual");
1020
- function simpleEqual(leftHandOperand, rightHandOperand) {
1021
- if (leftHandOperand === rightHandOperand) {
1022
- return leftHandOperand !== 0 || 1 / leftHandOperand === 1 / rightHandOperand;
1023
- }
1024
- if (leftHandOperand !== leftHandOperand && rightHandOperand !== rightHandOperand) {
1025
- return true;
1026
- }
1027
- if (isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
1028
- return false;
1029
- }
1030
- return null;
1031
- }
1032
- __name(simpleEqual, "simpleEqual");
1033
- function extensiveDeepEqual(leftHandOperand, rightHandOperand, options) {
1034
- options = options || {};
1035
- options.memoize = options.memoize === false ? false : options.memoize || new MemoizeMap;
1036
- var comparator = options && options.comparator;
1037
- var memoizeResultLeft = memoizeCompare(leftHandOperand, rightHandOperand, options.memoize);
1038
- if (memoizeResultLeft !== null) {
1039
- return memoizeResultLeft;
1040
- }
1041
- var memoizeResultRight = memoizeCompare(rightHandOperand, leftHandOperand, options.memoize);
1042
- if (memoizeResultRight !== null) {
1043
- return memoizeResultRight;
1044
- }
1045
- if (comparator) {
1046
- var comparatorResult = comparator(leftHandOperand, rightHandOperand);
1047
- if (comparatorResult === false || comparatorResult === true) {
1048
- memoizeSet(leftHandOperand, rightHandOperand, options.memoize, comparatorResult);
1049
- return comparatorResult;
1050
- }
1051
- var simpleResult = simpleEqual(leftHandOperand, rightHandOperand);
1052
- if (simpleResult !== null) {
1053
- return simpleResult;
1054
- }
1055
- }
1056
- var leftHandType = type2(leftHandOperand);
1057
- if (leftHandType !== type2(rightHandOperand)) {
1058
- memoizeSet(leftHandOperand, rightHandOperand, options.memoize, false);
1059
- return false;
1060
- }
1061
- memoizeSet(leftHandOperand, rightHandOperand, options.memoize, true);
1062
- var result = extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options);
1063
- memoizeSet(leftHandOperand, rightHandOperand, options.memoize, result);
1064
- return result;
1065
- }
1066
- __name(extensiveDeepEqual, "extensiveDeepEqual");
1067
- function extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options) {
1068
- switch (leftHandType) {
1069
- case "String":
1070
- case "Number":
1071
- case "Boolean":
1072
- case "Date":
1073
- return deepEqual(leftHandOperand.valueOf(), rightHandOperand.valueOf());
1074
- case "Promise":
1075
- case "Symbol":
1076
- case "function":
1077
- case "WeakMap":
1078
- case "WeakSet":
1079
- return leftHandOperand === rightHandOperand;
1080
- case "Error":
1081
- return keysEqual(leftHandOperand, rightHandOperand, ["name", "message", "code"], options);
1082
- case "Arguments":
1083
- case "Int8Array":
1084
- case "Uint8Array":
1085
- case "Uint8ClampedArray":
1086
- case "Int16Array":
1087
- case "Uint16Array":
1088
- case "Int32Array":
1089
- case "Uint32Array":
1090
- case "Float32Array":
1091
- case "Float64Array":
1092
- case "Array":
1093
- return iterableEqual(leftHandOperand, rightHandOperand, options);
1094
- case "RegExp":
1095
- return regexpEqual(leftHandOperand, rightHandOperand);
1096
- case "Generator":
1097
- return generatorEqual(leftHandOperand, rightHandOperand, options);
1098
- case "DataView":
1099
- return iterableEqual(new Uint8Array(leftHandOperand.buffer), new Uint8Array(rightHandOperand.buffer), options);
1100
- case "ArrayBuffer":
1101
- return iterableEqual(new Uint8Array(leftHandOperand), new Uint8Array(rightHandOperand), options);
1102
- case "Set":
1103
- return entriesEqual(leftHandOperand, rightHandOperand, options);
1104
- case "Map":
1105
- return entriesEqual(leftHandOperand, rightHandOperand, options);
1106
- case "Temporal.PlainDate":
1107
- case "Temporal.PlainTime":
1108
- case "Temporal.PlainDateTime":
1109
- case "Temporal.Instant":
1110
- case "Temporal.ZonedDateTime":
1111
- case "Temporal.PlainYearMonth":
1112
- case "Temporal.PlainMonthDay":
1113
- return leftHandOperand.equals(rightHandOperand);
1114
- case "Temporal.Duration":
1115
- return leftHandOperand.total("nanoseconds") === rightHandOperand.total("nanoseconds");
1116
- case "Temporal.TimeZone":
1117
- case "Temporal.Calendar":
1118
- return leftHandOperand.toString() === rightHandOperand.toString();
1119
- default:
1120
- return objectEqual(leftHandOperand, rightHandOperand, options);
1121
- }
1122
- }
1123
- __name(extensiveDeepEqualByType, "extensiveDeepEqualByType");
1124
- function regexpEqual(leftHandOperand, rightHandOperand) {
1125
- return leftHandOperand.toString() === rightHandOperand.toString();
1126
- }
1127
- __name(regexpEqual, "regexpEqual");
1128
- function entriesEqual(leftHandOperand, rightHandOperand, options) {
1129
- try {
1130
- if (leftHandOperand.size !== rightHandOperand.size) {
1131
- return false;
1132
- }
1133
- if (leftHandOperand.size === 0) {
1134
- return true;
1135
- }
1136
- } catch (sizeError) {
1137
- return false;
1138
- }
1139
- var leftHandItems = [];
1140
- var rightHandItems = [];
1141
- leftHandOperand.forEach(/* @__PURE__ */ __name(function gatherEntries(key, value) {
1142
- leftHandItems.push([key, value]);
1143
- }, "gatherEntries"));
1144
- rightHandOperand.forEach(/* @__PURE__ */ __name(function gatherEntries(key, value) {
1145
- rightHandItems.push([key, value]);
1146
- }, "gatherEntries"));
1147
- return iterableEqual(leftHandItems.sort(), rightHandItems.sort(), options);
1148
- }
1149
- __name(entriesEqual, "entriesEqual");
1150
- function iterableEqual(leftHandOperand, rightHandOperand, options) {
1151
- var length = leftHandOperand.length;
1152
- if (length !== rightHandOperand.length) {
1153
- return false;
1154
- }
1155
- if (length === 0) {
1156
- return true;
1157
- }
1158
- var index = -1;
1159
- while (++index < length) {
1160
- if (deepEqual(leftHandOperand[index], rightHandOperand[index], options) === false) {
1161
- return false;
1162
- }
1163
- }
1164
- return true;
1165
- }
1166
- __name(iterableEqual, "iterableEqual");
1167
- function generatorEqual(leftHandOperand, rightHandOperand, options) {
1168
- return iterableEqual(getGeneratorEntries(leftHandOperand), getGeneratorEntries(rightHandOperand), options);
1169
- }
1170
- __name(generatorEqual, "generatorEqual");
1171
- function hasIteratorFunction(target) {
1172
- return typeof Symbol !== "undefined" && typeof target === "object" && typeof Symbol.iterator !== "undefined" && typeof target[Symbol.iterator] === "function";
1173
- }
1174
- __name(hasIteratorFunction, "hasIteratorFunction");
1175
- function getIteratorEntries(target) {
1176
- if (hasIteratorFunction(target)) {
1177
- try {
1178
- return getGeneratorEntries(target[Symbol.iterator]());
1179
- } catch (iteratorError) {
1180
- return [];
1181
- }
1182
- }
1183
- return [];
1184
- }
1185
- __name(getIteratorEntries, "getIteratorEntries");
1186
- function getGeneratorEntries(generator) {
1187
- var generatorResult = generator.next();
1188
- var accumulator = [generatorResult.value];
1189
- while (generatorResult.done === false) {
1190
- generatorResult = generator.next();
1191
- accumulator.push(generatorResult.value);
1192
- }
1193
- return accumulator;
1194
- }
1195
- __name(getGeneratorEntries, "getGeneratorEntries");
1196
- function getEnumerableKeys(target) {
1197
- var keys = [];
1198
- for (var key in target) {
1199
- keys.push(key);
1200
- }
1201
- return keys;
1202
- }
1203
- __name(getEnumerableKeys, "getEnumerableKeys");
1204
- function getEnumerableSymbols(target) {
1205
- var keys = [];
1206
- var allKeys = Object.getOwnPropertySymbols(target);
1207
- for (var i = 0;i < allKeys.length; i += 1) {
1208
- var key = allKeys[i];
1209
- if (Object.getOwnPropertyDescriptor(target, key).enumerable) {
1210
- keys.push(key);
1211
- }
1212
- }
1213
- return keys;
1214
- }
1215
- __name(getEnumerableSymbols, "getEnumerableSymbols");
1216
- function keysEqual(leftHandOperand, rightHandOperand, keys, options) {
1217
- var length = keys.length;
1218
- if (length === 0) {
1219
- return true;
1220
- }
1221
- for (var i = 0;i < length; i += 1) {
1222
- if (deepEqual(leftHandOperand[keys[i]], rightHandOperand[keys[i]], options) === false) {
1223
- return false;
1224
- }
1225
- }
1226
- return true;
1227
- }
1228
- __name(keysEqual, "keysEqual");
1229
- function objectEqual(leftHandOperand, rightHandOperand, options) {
1230
- var leftHandKeys = getEnumerableKeys(leftHandOperand);
1231
- var rightHandKeys = getEnumerableKeys(rightHandOperand);
1232
- var leftHandSymbols = getEnumerableSymbols(leftHandOperand);
1233
- var rightHandSymbols = getEnumerableSymbols(rightHandOperand);
1234
- leftHandKeys = leftHandKeys.concat(leftHandSymbols);
1235
- rightHandKeys = rightHandKeys.concat(rightHandSymbols);
1236
- if (leftHandKeys.length && leftHandKeys.length === rightHandKeys.length) {
1237
- if (iterableEqual(mapSymbols(leftHandKeys).sort(), mapSymbols(rightHandKeys).sort()) === false) {
1238
- return false;
1239
- }
1240
- return keysEqual(leftHandOperand, rightHandOperand, leftHandKeys, options);
1241
- }
1242
- var leftHandEntries = getIteratorEntries(leftHandOperand);
1243
- var rightHandEntries = getIteratorEntries(rightHandOperand);
1244
- if (leftHandEntries.length && leftHandEntries.length === rightHandEntries.length) {
1245
- leftHandEntries.sort();
1246
- rightHandEntries.sort();
1247
- return iterableEqual(leftHandEntries, rightHandEntries, options);
1248
- }
1249
- if (leftHandKeys.length === 0 && leftHandEntries.length === 0 && rightHandKeys.length === 0 && rightHandEntries.length === 0) {
1250
- return true;
1251
- }
1252
- return false;
1253
- }
1254
- __name(objectEqual, "objectEqual");
1255
- function isPrimitive(value) {
1256
- return value === null || typeof value !== "object";
1257
- }
1258
- __name(isPrimitive, "isPrimitive");
1259
- function mapSymbols(arr) {
1260
- return arr.map(/* @__PURE__ */ __name(function mapSymbol(entry) {
1261
- if (typeof entry === "symbol") {
1262
- return entry.toString();
1263
- }
1264
- return entry;
1265
- }, "mapSymbol"));
1266
- }
1267
- __name(mapSymbols, "mapSymbols");
1268
- function hasProperty(obj, name) {
1269
- if (typeof obj === "undefined" || obj === null) {
1270
- return false;
1271
- }
1272
- return name in Object(obj);
1273
- }
1274
- __name(hasProperty, "hasProperty");
1275
- function parsePath(path) {
1276
- const str = path.replace(/([^\\])\[/g, "$1.[");
1277
- const parts = str.match(/(\\\.|[^.]+?)+/g);
1278
- return parts.map((value) => {
1279
- if (value === "constructor" || value === "__proto__" || value === "prototype") {
1280
- return {};
1281
- }
1282
- const regexp = /^\[(\d+)\]$/;
1283
- const mArr = regexp.exec(value);
1284
- let parsed = null;
1285
- if (mArr) {
1286
- parsed = { i: parseFloat(mArr[1]) };
1287
- } else {
1288
- parsed = { p: value.replace(/\\([.[\]])/g, "$1") };
1289
- }
1290
- return parsed;
1291
- });
1292
- }
1293
- __name(parsePath, "parsePath");
1294
- function internalGetPathValue(obj, parsed, pathDepth) {
1295
- let temporaryValue = obj;
1296
- let res = null;
1297
- pathDepth = typeof pathDepth === "undefined" ? parsed.length : pathDepth;
1298
- for (let i = 0;i < pathDepth; i++) {
1299
- const part = parsed[i];
1300
- if (temporaryValue) {
1301
- if (typeof part.p === "undefined") {
1302
- temporaryValue = temporaryValue[part.i];
1303
- } else {
1304
- temporaryValue = temporaryValue[part.p];
1305
- }
1306
- if (i === pathDepth - 1) {
1307
- res = temporaryValue;
1308
- }
1309
- }
1310
- }
1311
- return res;
1312
- }
1313
- __name(internalGetPathValue, "internalGetPathValue");
1314
- function getPathInfo(obj, path) {
1315
- const parsed = parsePath(path);
1316
- const last = parsed[parsed.length - 1];
1317
- const info = {
1318
- parent: parsed.length > 1 ? internalGetPathValue(obj, parsed, parsed.length - 1) : obj,
1319
- name: last.p || last.i,
1320
- value: internalGetPathValue(obj, parsed)
1321
- };
1322
- info.exists = hasProperty(info.parent, info.name);
1323
- return info;
1324
- }
1325
- __name(getPathInfo, "getPathInfo");
1326
- var _Assertion = class _Assertion2 {
1327
- constructor(obj, msg, ssfi, lockSsfi) {
1328
- __publicField(this, "__flags", {});
1329
- flag(this, "ssfi", ssfi || _Assertion2);
1330
- flag(this, "lockSsfi", lockSsfi);
1331
- flag(this, "object", obj);
1332
- flag(this, "message", msg);
1333
- flag(this, "eql", config.deepEqual || deep_eql_default);
1334
- return proxify(this);
1335
- }
1336
- static get includeStack() {
1337
- console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead.");
1338
- return config.includeStack;
1339
- }
1340
- static set includeStack(value) {
1341
- console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead.");
1342
- config.includeStack = value;
1343
- }
1344
- static get showDiff() {
1345
- console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead.");
1346
- return config.showDiff;
1347
- }
1348
- static set showDiff(value) {
1349
- console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead.");
1350
- config.showDiff = value;
1351
- }
1352
- static addProperty(name, fn) {
1353
- addProperty(this.prototype, name, fn);
1354
- }
1355
- static addMethod(name, fn) {
1356
- addMethod(this.prototype, name, fn);
1357
- }
1358
- static addChainableMethod(name, fn, chainingBehavior) {
1359
- addChainableMethod(this.prototype, name, fn, chainingBehavior);
1360
- }
1361
- static overwriteProperty(name, fn) {
1362
- overwriteProperty(this.prototype, name, fn);
1363
- }
1364
- static overwriteMethod(name, fn) {
1365
- overwriteMethod(this.prototype, name, fn);
1366
- }
1367
- static overwriteChainableMethod(name, fn, chainingBehavior) {
1368
- overwriteChainableMethod(this.prototype, name, fn, chainingBehavior);
1369
- }
1370
- assert(_expr, msg, _negateMsg, expected, _actual, showDiff) {
1371
- const ok = test(this, arguments);
1372
- if (showDiff !== false)
1373
- showDiff = true;
1374
- if (expected === undefined && _actual === undefined)
1375
- showDiff = false;
1376
- if (config.showDiff !== true)
1377
- showDiff = false;
1378
- if (!ok) {
1379
- msg = getMessage2(this, arguments);
1380
- const actual = getActual(this, arguments);
1381
- const assertionErrorObjectProperties = {
1382
- actual,
1383
- expected,
1384
- showDiff
1385
- };
1386
- const operator = getOperator(this, arguments);
1387
- if (operator) {
1388
- assertionErrorObjectProperties.operator = operator;
1389
- }
1390
- throw new AssertionError(msg, assertionErrorObjectProperties, config.includeStack ? this.assert : flag(this, "ssfi"));
1391
- }
1392
- }
1393
- get _obj() {
1394
- return flag(this, "object");
1395
- }
1396
- set _obj(val) {
1397
- flag(this, "object", val);
1398
- }
1399
- };
1400
- __name(_Assertion, "Assertion");
1401
- var Assertion = _Assertion;
1402
- var events = new EventTarget;
1403
- var _PluginEvent = class _PluginEvent2 extends Event {
1404
- constructor(type3, name, fn) {
1405
- super(type3);
1406
- this.name = String(name);
1407
- this.fn = fn;
1408
- }
1409
- };
1410
- __name(_PluginEvent, "PluginEvent");
1411
- var PluginEvent = _PluginEvent;
1412
- function isProxyEnabled() {
1413
- return config.useProxy && typeof Proxy !== "undefined" && typeof Reflect !== "undefined";
1414
- }
1415
- __name(isProxyEnabled, "isProxyEnabled");
1416
- function addProperty(ctx, name, getter) {
1417
- getter = getter === undefined ? function() {} : getter;
1418
- Object.defineProperty(ctx, name, {
1419
- get: /* @__PURE__ */ __name(function propertyGetter() {
1420
- if (!isProxyEnabled() && !flag(this, "lockSsfi")) {
1421
- flag(this, "ssfi", propertyGetter);
1422
- }
1423
- let result = getter.call(this);
1424
- if (result !== undefined)
1425
- return result;
1426
- let newAssertion = new Assertion;
1427
- transferFlags(this, newAssertion);
1428
- return newAssertion;
1429
- }, "propertyGetter"),
1430
- configurable: true
1431
- });
1432
- events.dispatchEvent(new PluginEvent("addProperty", name, getter));
1433
- }
1434
- __name(addProperty, "addProperty");
1435
- var fnLengthDesc = Object.getOwnPropertyDescriptor(function() {}, "length");
1436
- function addLengthGuard(fn, assertionName, isChainable) {
1437
- if (!fnLengthDesc.configurable)
1438
- return fn;
1439
- Object.defineProperty(fn, "length", {
1440
- get: /* @__PURE__ */ __name(function() {
1441
- if (isChainable) {
1442
- throw Error("Invalid Chai property: " + assertionName + '.length. Due to a compatibility issue, "length" cannot directly follow "' + assertionName + '". Use "' + assertionName + '.lengthOf" instead.');
1443
- }
1444
- throw Error("Invalid Chai property: " + assertionName + '.length. See docs for proper usage of "' + assertionName + '".');
1445
- }, "get")
1446
- });
1447
- return fn;
1448
- }
1449
- __name(addLengthGuard, "addLengthGuard");
1450
- function getProperties(object) {
1451
- let result = Object.getOwnPropertyNames(object);
1452
- function addProperty2(property) {
1453
- if (result.indexOf(property) === -1) {
1454
- result.push(property);
1455
- }
1456
- }
1457
- __name(addProperty2, "addProperty");
1458
- let proto = Object.getPrototypeOf(object);
1459
- while (proto !== null) {
1460
- Object.getOwnPropertyNames(proto).forEach(addProperty2);
1461
- proto = Object.getPrototypeOf(proto);
1462
- }
1463
- return result;
1464
- }
1465
- __name(getProperties, "getProperties");
1466
- var builtins = ["__flags", "__methods", "_obj", "assert"];
1467
- function proxify(obj, nonChainableMethodName) {
1468
- if (!isProxyEnabled())
1469
- return obj;
1470
- return new Proxy(obj, {
1471
- get: /* @__PURE__ */ __name(function proxyGetter(target, property) {
1472
- if (typeof property === "string" && config.proxyExcludedKeys.indexOf(property) === -1 && !Reflect.has(target, property)) {
1473
- if (nonChainableMethodName) {
1474
- throw Error("Invalid Chai property: " + nonChainableMethodName + "." + property + '. See docs for proper usage of "' + nonChainableMethodName + '".');
1475
- }
1476
- let suggestion = null;
1477
- let suggestionDistance = 4;
1478
- getProperties(target).forEach(function(prop) {
1479
- if (!Object.prototype.hasOwnProperty(prop) && builtins.indexOf(prop) === -1) {
1480
- let dist = stringDistanceCapped(property, prop, suggestionDistance);
1481
- if (dist < suggestionDistance) {
1482
- suggestion = prop;
1483
- suggestionDistance = dist;
1484
- }
1485
- }
1486
- });
1487
- if (suggestion !== null) {
1488
- throw Error("Invalid Chai property: " + property + '. Did you mean "' + suggestion + '"?');
1489
- } else {
1490
- throw Error("Invalid Chai property: " + property);
1491
- }
1492
- }
1493
- if (builtins.indexOf(property) === -1 && !flag(target, "lockSsfi")) {
1494
- flag(target, "ssfi", proxyGetter);
1495
- }
1496
- return Reflect.get(target, property);
1497
- }, "proxyGetter")
1498
- });
1499
- }
1500
- __name(proxify, "proxify");
1501
- function stringDistanceCapped(strA, strB, cap) {
1502
- if (Math.abs(strA.length - strB.length) >= cap) {
1503
- return cap;
1504
- }
1505
- let memo = [];
1506
- for (let i = 0;i <= strA.length; i++) {
1507
- memo[i] = Array(strB.length + 1).fill(0);
1508
- memo[i][0] = i;
1509
- }
1510
- for (let j = 0;j < strB.length; j++) {
1511
- memo[0][j] = j;
1512
- }
1513
- for (let i = 1;i <= strA.length; i++) {
1514
- let ch = strA.charCodeAt(i - 1);
1515
- for (let j = 1;j <= strB.length; j++) {
1516
- if (Math.abs(i - j) >= cap) {
1517
- memo[i][j] = cap;
1518
- continue;
1519
- }
1520
- 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));
1521
- }
1522
- }
1523
- return memo[strA.length][strB.length];
1524
- }
1525
- __name(stringDistanceCapped, "stringDistanceCapped");
1526
- function addMethod(ctx, name, method) {
1527
- let methodWrapper = /* @__PURE__ */ __name(function() {
1528
- if (!flag(this, "lockSsfi")) {
1529
- flag(this, "ssfi", methodWrapper);
1530
- }
1531
- let result = method.apply(this, arguments);
1532
- if (result !== undefined)
1533
- return result;
1534
- let newAssertion = new Assertion;
1535
- transferFlags(this, newAssertion);
1536
- return newAssertion;
1537
- }, "methodWrapper");
1538
- addLengthGuard(methodWrapper, name, false);
1539
- ctx[name] = proxify(methodWrapper, name);
1540
- events.dispatchEvent(new PluginEvent("addMethod", name, method));
1541
- }
1542
- __name(addMethod, "addMethod");
1543
- function overwriteProperty(ctx, name, getter) {
1544
- let _get = Object.getOwnPropertyDescriptor(ctx, name), _super = /* @__PURE__ */ __name(function() {}, "_super");
1545
- if (_get && typeof _get.get === "function")
1546
- _super = _get.get;
1547
- Object.defineProperty(ctx, name, {
1548
- get: /* @__PURE__ */ __name(function overwritingPropertyGetter() {
1549
- if (!isProxyEnabled() && !flag(this, "lockSsfi")) {
1550
- flag(this, "ssfi", overwritingPropertyGetter);
1551
- }
1552
- let origLockSsfi = flag(this, "lockSsfi");
1553
- flag(this, "lockSsfi", true);
1554
- let result = getter(_super).call(this);
1555
- flag(this, "lockSsfi", origLockSsfi);
1556
- if (result !== undefined) {
1557
- return result;
1558
- }
1559
- let newAssertion = new Assertion;
1560
- transferFlags(this, newAssertion);
1561
- return newAssertion;
1562
- }, "overwritingPropertyGetter"),
1563
- configurable: true
1564
- });
1565
- }
1566
- __name(overwriteProperty, "overwriteProperty");
1567
- function overwriteMethod(ctx, name, method) {
1568
- let _method = ctx[name], _super = /* @__PURE__ */ __name(function() {
1569
- throw new Error(name + " is not a function");
1570
- }, "_super");
1571
- if (_method && typeof _method === "function")
1572
- _super = _method;
1573
- let overwritingMethodWrapper = /* @__PURE__ */ __name(function() {
1574
- if (!flag(this, "lockSsfi")) {
1575
- flag(this, "ssfi", overwritingMethodWrapper);
1576
- }
1577
- let origLockSsfi = flag(this, "lockSsfi");
1578
- flag(this, "lockSsfi", true);
1579
- let result = method(_super).apply(this, arguments);
1580
- flag(this, "lockSsfi", origLockSsfi);
1581
- if (result !== undefined) {
1582
- return result;
1583
- }
1584
- let newAssertion = new Assertion;
1585
- transferFlags(this, newAssertion);
1586
- return newAssertion;
1587
- }, "overwritingMethodWrapper");
1588
- addLengthGuard(overwritingMethodWrapper, name, false);
1589
- ctx[name] = proxify(overwritingMethodWrapper, name);
1590
- }
1591
- __name(overwriteMethod, "overwriteMethod");
1592
- var canSetPrototype = typeof Object.setPrototypeOf === "function";
1593
- var testFn = /* @__PURE__ */ __name(function() {}, "testFn");
1594
- var excludeNames = Object.getOwnPropertyNames(testFn).filter(function(name) {
1595
- let propDesc = Object.getOwnPropertyDescriptor(testFn, name);
1596
- if (typeof propDesc !== "object")
1597
- return true;
1598
- return !propDesc.configurable;
1599
- });
1600
- var call = Function.prototype.call;
1601
- var apply = Function.prototype.apply;
1602
- var _PluginAddChainableMethodEvent = class _PluginAddChainableMethodEvent2 extends PluginEvent {
1603
- constructor(type3, name, fn, chainingBehavior) {
1604
- super(type3, name, fn);
1605
- this.chainingBehavior = chainingBehavior;
1606
- }
1607
- };
1608
- __name(_PluginAddChainableMethodEvent, "PluginAddChainableMethodEvent");
1609
- var PluginAddChainableMethodEvent = _PluginAddChainableMethodEvent;
1610
- function addChainableMethod(ctx, name, method, chainingBehavior) {
1611
- if (typeof chainingBehavior !== "function") {
1612
- chainingBehavior = /* @__PURE__ */ __name(function() {}, "chainingBehavior");
1613
- }
1614
- let chainableBehavior = {
1615
- method,
1616
- chainingBehavior
1617
- };
1618
- if (!ctx.__methods) {
1619
- ctx.__methods = {};
1620
- }
1621
- ctx.__methods[name] = chainableBehavior;
1622
- Object.defineProperty(ctx, name, {
1623
- get: /* @__PURE__ */ __name(function chainableMethodGetter() {
1624
- chainableBehavior.chainingBehavior.call(this);
1625
- let chainableMethodWrapper = /* @__PURE__ */ __name(function() {
1626
- if (!flag(this, "lockSsfi")) {
1627
- flag(this, "ssfi", chainableMethodWrapper);
1628
- }
1629
- let result = chainableBehavior.method.apply(this, arguments);
1630
- if (result !== undefined) {
1631
- return result;
1632
- }
1633
- let newAssertion = new Assertion;
1634
- transferFlags(this, newAssertion);
1635
- return newAssertion;
1636
- }, "chainableMethodWrapper");
1637
- addLengthGuard(chainableMethodWrapper, name, true);
1638
- if (canSetPrototype) {
1639
- let prototype = Object.create(this);
1640
- prototype.call = call;
1641
- prototype.apply = apply;
1642
- Object.setPrototypeOf(chainableMethodWrapper, prototype);
1643
- } else {
1644
- let asserterNames = Object.getOwnPropertyNames(ctx);
1645
- asserterNames.forEach(function(asserterName) {
1646
- if (excludeNames.indexOf(asserterName) !== -1) {
1647
- return;
1648
- }
1649
- let pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
1650
- Object.defineProperty(chainableMethodWrapper, asserterName, pd);
1651
- });
1652
- }
1653
- transferFlags(this, chainableMethodWrapper);
1654
- return proxify(chainableMethodWrapper);
1655
- }, "chainableMethodGetter"),
1656
- configurable: true
1657
- });
1658
- events.dispatchEvent(new PluginAddChainableMethodEvent("addChainableMethod", name, method, chainingBehavior));
1659
- }
1660
- __name(addChainableMethod, "addChainableMethod");
1661
- function overwriteChainableMethod(ctx, name, method, chainingBehavior) {
1662
- let chainableBehavior = ctx.__methods[name];
1663
- let _chainingBehavior = chainableBehavior.chainingBehavior;
1664
- chainableBehavior.chainingBehavior = /* @__PURE__ */ __name(function overwritingChainableMethodGetter() {
1665
- let result = chainingBehavior(_chainingBehavior).call(this);
1666
- if (result !== undefined) {
1667
- return result;
1668
- }
1669
- let newAssertion = new Assertion;
1670
- transferFlags(this, newAssertion);
1671
- return newAssertion;
1672
- }, "overwritingChainableMethodGetter");
1673
- let _method = chainableBehavior.method;
1674
- chainableBehavior.method = /* @__PURE__ */ __name(function overwritingChainableMethodWrapper() {
1675
- let result = method(_method).apply(this, arguments);
1676
- if (result !== undefined) {
1677
- return result;
1678
- }
1679
- let newAssertion = new Assertion;
1680
- transferFlags(this, newAssertion);
1681
- return newAssertion;
1682
- }, "overwritingChainableMethodWrapper");
1683
- }
1684
- __name(overwriteChainableMethod, "overwriteChainableMethod");
1685
- function compareByInspect(a, b) {
1686
- return inspect2(a) < inspect2(b) ? -1 : 1;
1687
- }
1688
- __name(compareByInspect, "compareByInspect");
1689
- function getOwnEnumerablePropertySymbols(obj) {
1690
- if (typeof Object.getOwnPropertySymbols !== "function")
1691
- return [];
1692
- return Object.getOwnPropertySymbols(obj).filter(function(sym) {
1693
- return Object.getOwnPropertyDescriptor(obj, sym).enumerable;
1694
- });
1695
- }
1696
- __name(getOwnEnumerablePropertySymbols, "getOwnEnumerablePropertySymbols");
1697
- function getOwnEnumerableProperties(obj) {
1698
- return Object.keys(obj).concat(getOwnEnumerablePropertySymbols(obj));
1699
- }
1700
- __name(getOwnEnumerableProperties, "getOwnEnumerableProperties");
1701
- var isNaN2 = Number.isNaN;
1702
- function isObjectType(obj) {
1703
- let objectType = type(obj);
1704
- let objectTypes = ["Array", "Object", "Function"];
1705
- return objectTypes.indexOf(objectType) !== -1;
1706
- }
1707
- __name(isObjectType, "isObjectType");
1708
- function getOperator(obj, args) {
1709
- let operator = flag(obj, "operator");
1710
- let negate = flag(obj, "negate");
1711
- let expected = args[3];
1712
- let msg = negate ? args[2] : args[1];
1713
- if (operator) {
1714
- return operator;
1715
- }
1716
- if (typeof msg === "function")
1717
- msg = msg();
1718
- msg = msg || "";
1719
- if (!msg) {
1720
- return;
1721
- }
1722
- if (/\shave\s/.test(msg)) {
1723
- return;
1724
- }
1725
- let isObject = isObjectType(expected);
1726
- if (/\snot\s/.test(msg)) {
1727
- return isObject ? "notDeepStrictEqual" : "notStrictEqual";
1728
- }
1729
- return isObject ? "deepStrictEqual" : "strictEqual";
1730
- }
1731
- __name(getOperator, "getOperator");
1732
- function getName(fn) {
1733
- return fn.name;
1734
- }
1735
- __name(getName, "getName");
1736
- function isRegExp2(obj) {
1737
- return Object.prototype.toString.call(obj) === "[object RegExp]";
1738
- }
1739
- __name(isRegExp2, "isRegExp");
1740
- function isNumeric(obj) {
1741
- return ["Number", "BigInt"].includes(type(obj));
1742
- }
1743
- __name(isNumeric, "isNumeric");
1744
- var { flag: flag2 } = utils_exports;
1745
- [
1746
- "to",
1747
- "be",
1748
- "been",
1749
- "is",
1750
- "and",
1751
- "has",
1752
- "have",
1753
- "with",
1754
- "that",
1755
- "which",
1756
- "at",
1757
- "of",
1758
- "same",
1759
- "but",
1760
- "does",
1761
- "still",
1762
- "also"
1763
- ].forEach(function(chain) {
1764
- Assertion.addProperty(chain);
1765
- });
1766
- Assertion.addProperty("not", function() {
1767
- flag2(this, "negate", true);
1768
- });
1769
- Assertion.addProperty("deep", function() {
1770
- flag2(this, "deep", true);
1771
- });
1772
- Assertion.addProperty("nested", function() {
1773
- flag2(this, "nested", true);
1774
- });
1775
- Assertion.addProperty("own", function() {
1776
- flag2(this, "own", true);
1777
- });
1778
- Assertion.addProperty("ordered", function() {
1779
- flag2(this, "ordered", true);
1780
- });
1781
- Assertion.addProperty("any", function() {
1782
- flag2(this, "any", true);
1783
- flag2(this, "all", false);
1784
- });
1785
- Assertion.addProperty("all", function() {
1786
- flag2(this, "all", true);
1787
- flag2(this, "any", false);
1788
- });
1789
- var functionTypes = {
1790
- function: [
1791
- "function",
1792
- "asyncfunction",
1793
- "generatorfunction",
1794
- "asyncgeneratorfunction"
1795
- ],
1796
- asyncfunction: ["asyncfunction", "asyncgeneratorfunction"],
1797
- generatorfunction: ["generatorfunction", "asyncgeneratorfunction"],
1798
- asyncgeneratorfunction: ["asyncgeneratorfunction"]
1799
- };
1800
- function an(type3, msg) {
1801
- if (msg)
1802
- flag2(this, "message", msg);
1803
- type3 = type3.toLowerCase();
1804
- let obj = flag2(this, "object"), article = ~["a", "e", "i", "o", "u"].indexOf(type3.charAt(0)) ? "an " : "a ";
1805
- const detectedType = type(obj).toLowerCase();
1806
- if (functionTypes["function"].includes(type3)) {
1807
- this.assert(functionTypes[type3].includes(detectedType), "expected #{this} to be " + article + type3, "expected #{this} not to be " + article + type3);
1808
- } else {
1809
- this.assert(type3 === detectedType, "expected #{this} to be " + article + type3, "expected #{this} not to be " + article + type3);
1810
- }
1811
- }
1812
- __name(an, "an");
1813
- Assertion.addChainableMethod("an", an);
1814
- Assertion.addChainableMethod("a", an);
1815
- function SameValueZero(a, b) {
1816
- return isNaN2(a) && isNaN2(b) || a === b;
1817
- }
1818
- __name(SameValueZero, "SameValueZero");
1819
- function includeChainingBehavior() {
1820
- flag2(this, "contains", true);
1821
- }
1822
- __name(includeChainingBehavior, "includeChainingBehavior");
1823
- function include(val, msg) {
1824
- if (msg)
1825
- flag2(this, "message", msg);
1826
- 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;
1827
- flagMsg = flagMsg ? flagMsg + ": " : "";
1828
- let included = false;
1829
- switch (objType) {
1830
- case "string":
1831
- included = obj.indexOf(val) !== -1;
1832
- break;
1833
- case "weakset":
1834
- if (isDeep) {
1835
- throw new AssertionError(flagMsg + "unable to use .deep.include with WeakSet", undefined, ssfi);
1836
- }
1837
- included = obj.has(val);
1838
- break;
1839
- case "map":
1840
- obj.forEach(function(item) {
1841
- included = included || isEql(item, val);
1842
- });
1843
- break;
1844
- case "set":
1845
- if (isDeep) {
1846
- obj.forEach(function(item) {
1847
- included = included || isEql(item, val);
1848
- });
1849
- } else {
1850
- included = obj.has(val);
1851
- }
1852
- break;
1853
- case "array":
1854
- if (isDeep) {
1855
- included = obj.some(function(item) {
1856
- return isEql(item, val);
1857
- });
1858
- } else {
1859
- included = obj.indexOf(val) !== -1;
1860
- }
1861
- break;
1862
- default: {
1863
- if (val !== Object(val)) {
1864
- 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);
1865
- }
1866
- let props = Object.keys(val);
1867
- let firstErr = null;
1868
- let numErrs = 0;
1869
- props.forEach(function(prop) {
1870
- let propAssertion = new Assertion(obj);
1871
- transferFlags(this, propAssertion, true);
1872
- flag2(propAssertion, "lockSsfi", true);
1873
- if (!negate || props.length === 1) {
1874
- propAssertion.property(prop, val[prop]);
1875
- return;
1876
- }
1877
- try {
1878
- propAssertion.property(prop, val[prop]);
1879
- } catch (err) {
1880
- if (!check_error_exports.compatibleConstructor(err, AssertionError)) {
1881
- throw err;
1882
- }
1883
- if (firstErr === null)
1884
- firstErr = err;
1885
- numErrs++;
1886
- }
1887
- }, this);
1888
- if (negate && props.length > 1 && numErrs === props.length) {
1889
- throw firstErr;
1890
- }
1891
- return;
1892
- }
1893
- }
1894
- this.assert(included, "expected #{this} to " + descriptor + "include " + inspect2(val), "expected #{this} to not " + descriptor + "include " + inspect2(val));
1895
- }
1896
- __name(include, "include");
1897
- Assertion.addChainableMethod("include", include, includeChainingBehavior);
1898
- Assertion.addChainableMethod("contain", include, includeChainingBehavior);
1899
- Assertion.addChainableMethod("contains", include, includeChainingBehavior);
1900
- Assertion.addChainableMethod("includes", include, includeChainingBehavior);
1901
- Assertion.addProperty("ok", function() {
1902
- this.assert(flag2(this, "object"), "expected #{this} to be truthy", "expected #{this} to be falsy");
1903
- });
1904
- Assertion.addProperty("true", function() {
1905
- this.assert(flag2(this, "object") === true, "expected #{this} to be true", "expected #{this} to be false", flag2(this, "negate") ? false : true);
1906
- });
1907
- Assertion.addProperty("numeric", function() {
1908
- const object = flag2(this, "object");
1909
- this.assert(["Number", "BigInt"].includes(type(object)), "expected #{this} to be numeric", "expected #{this} to not be numeric", flag2(this, "negate") ? false : true);
1910
- });
1911
- Assertion.addProperty("callable", function() {
1912
- const val = flag2(this, "object");
1913
- const ssfi = flag2(this, "ssfi");
1914
- const message = flag2(this, "message");
1915
- const msg = message ? `${message}: ` : "";
1916
- const negate = flag2(this, "negate");
1917
- const assertionMessage = negate ? `${msg}expected ${inspect2(val)} not to be a callable function` : `${msg}expected ${inspect2(val)} to be a callable function`;
1918
- const isCallable = [
1919
- "Function",
1920
- "AsyncFunction",
1921
- "GeneratorFunction",
1922
- "AsyncGeneratorFunction"
1923
- ].includes(type(val));
1924
- if (isCallable && negate || !isCallable && !negate) {
1925
- throw new AssertionError(assertionMessage, undefined, ssfi);
1926
- }
1927
- });
1928
- Assertion.addProperty("false", function() {
1929
- this.assert(flag2(this, "object") === false, "expected #{this} to be false", "expected #{this} to be true", flag2(this, "negate") ? true : false);
1930
- });
1931
- Assertion.addProperty("null", function() {
1932
- this.assert(flag2(this, "object") === null, "expected #{this} to be null", "expected #{this} not to be null");
1933
- });
1934
- Assertion.addProperty("undefined", function() {
1935
- this.assert(flag2(this, "object") === undefined, "expected #{this} to be undefined", "expected #{this} not to be undefined");
1936
- });
1937
- Assertion.addProperty("NaN", function() {
1938
- this.assert(isNaN2(flag2(this, "object")), "expected #{this} to be NaN", "expected #{this} not to be NaN");
1939
- });
1940
- function assertExist() {
1941
- let val = flag2(this, "object");
1942
- this.assert(val !== null && val !== undefined, "expected #{this} to exist", "expected #{this} to not exist");
1943
- }
1944
- __name(assertExist, "assertExist");
1945
- Assertion.addProperty("exist", assertExist);
1946
- Assertion.addProperty("exists", assertExist);
1947
- Assertion.addProperty("empty", function() {
1948
- let val = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), itemsCount;
1949
- flagMsg = flagMsg ? flagMsg + ": " : "";
1950
- switch (type(val).toLowerCase()) {
1951
- case "array":
1952
- case "string":
1953
- itemsCount = val.length;
1954
- break;
1955
- case "map":
1956
- case "set":
1957
- itemsCount = val.size;
1958
- break;
1959
- case "weakmap":
1960
- case "weakset":
1961
- throw new AssertionError(flagMsg + ".empty was passed a weak collection", undefined, ssfi);
1962
- case "function": {
1963
- const msg = flagMsg + ".empty was passed a function " + getName(val);
1964
- throw new AssertionError(msg.trim(), undefined, ssfi);
1965
- }
1966
- default:
1967
- if (val !== Object(val)) {
1968
- throw new AssertionError(flagMsg + ".empty was passed non-string primitive " + inspect2(val), undefined, ssfi);
1969
- }
1970
- itemsCount = Object.keys(val).length;
1971
- }
1972
- this.assert(itemsCount === 0, "expected #{this} to be empty", "expected #{this} not to be empty");
1973
- });
1974
- function checkArguments() {
1975
- let obj = flag2(this, "object"), type3 = type(obj);
1976
- this.assert(type3 === "Arguments", "expected #{this} to be arguments but got " + type3, "expected #{this} to not be arguments");
1977
- }
1978
- __name(checkArguments, "checkArguments");
1979
- Assertion.addProperty("arguments", checkArguments);
1980
- Assertion.addProperty("Arguments", checkArguments);
1981
- function assertEqual(val, msg) {
1982
- if (msg)
1983
- flag2(this, "message", msg);
1984
- let obj = flag2(this, "object");
1985
- if (flag2(this, "deep")) {
1986
- let prevLockSsfi = flag2(this, "lockSsfi");
1987
- flag2(this, "lockSsfi", true);
1988
- this.eql(val);
1989
- flag2(this, "lockSsfi", prevLockSsfi);
1990
- } else {
1991
- this.assert(val === obj, "expected #{this} to equal #{exp}", "expected #{this} to not equal #{exp}", val, this._obj, true);
1992
- }
1993
- }
1994
- __name(assertEqual, "assertEqual");
1995
- Assertion.addMethod("equal", assertEqual);
1996
- Assertion.addMethod("equals", assertEqual);
1997
- Assertion.addMethod("eq", assertEqual);
1998
- function assertEql(obj, msg) {
1999
- if (msg)
2000
- flag2(this, "message", msg);
2001
- let eql = flag2(this, "eql");
2002
- this.assert(eql(obj, flag2(this, "object")), "expected #{this} to deeply equal #{exp}", "expected #{this} to not deeply equal #{exp}", obj, this._obj, true);
2003
- }
2004
- __name(assertEql, "assertEql");
2005
- Assertion.addMethod("eql", assertEql);
2006
- Assertion.addMethod("eqls", assertEql);
2007
- function assertAbove(n, msg) {
2008
- if (msg)
2009
- flag2(this, "message", msg);
2010
- 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();
2011
- if (doLength && objType !== "map" && objType !== "set") {
2012
- new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
2013
- }
2014
- if (!doLength && objType === "date" && nType !== "date") {
2015
- throw new AssertionError(msgPrefix + "the argument to above must be a date", undefined, ssfi);
2016
- } else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
2017
- throw new AssertionError(msgPrefix + "the argument to above must be a number", undefined, ssfi);
2018
- } else if (!doLength && objType !== "date" && !isNumeric(obj)) {
2019
- let printObj = objType === "string" ? "'" + obj + "'" : obj;
2020
- throw new AssertionError(msgPrefix + "expected " + printObj + " to be a number or a date", undefined, ssfi);
2021
- }
2022
- if (doLength) {
2023
- let descriptor = "length", itemsCount;
2024
- if (objType === "map" || objType === "set") {
2025
- descriptor = "size";
2026
- itemsCount = obj.size;
2027
- } else {
2028
- itemsCount = obj.length;
2029
- }
2030
- 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);
2031
- } else {
2032
- this.assert(obj > n, "expected #{this} to be above #{exp}", "expected #{this} to be at most #{exp}", n);
2033
- }
2034
- }
2035
- __name(assertAbove, "assertAbove");
2036
- Assertion.addMethod("above", assertAbove);
2037
- Assertion.addMethod("gt", assertAbove);
2038
- Assertion.addMethod("greaterThan", assertAbove);
2039
- function assertLeast(n, msg) {
2040
- if (msg)
2041
- flag2(this, "message", msg);
2042
- 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;
2043
- if (doLength && objType !== "map" && objType !== "set") {
2044
- new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
2045
- }
2046
- if (!doLength && objType === "date" && nType !== "date") {
2047
- errorMessage = msgPrefix + "the argument to least must be a date";
2048
- } else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
2049
- errorMessage = msgPrefix + "the argument to least must be a number";
2050
- } else if (!doLength && objType !== "date" && !isNumeric(obj)) {
2051
- let printObj = objType === "string" ? "'" + obj + "'" : obj;
2052
- errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
2053
- } else {
2054
- shouldThrow = false;
2055
- }
2056
- if (shouldThrow) {
2057
- throw new AssertionError(errorMessage, undefined, ssfi);
2058
- }
2059
- if (doLength) {
2060
- let descriptor = "length", itemsCount;
2061
- if (objType === "map" || objType === "set") {
2062
- descriptor = "size";
2063
- itemsCount = obj.size;
2064
- } else {
2065
- itemsCount = obj.length;
2066
- }
2067
- 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);
2068
- } else {
2069
- this.assert(obj >= n, "expected #{this} to be at least #{exp}", "expected #{this} to be below #{exp}", n);
2070
- }
2071
- }
2072
- __name(assertLeast, "assertLeast");
2073
- Assertion.addMethod("least", assertLeast);
2074
- Assertion.addMethod("gte", assertLeast);
2075
- Assertion.addMethod("greaterThanOrEqual", assertLeast);
2076
- function assertBelow(n, msg) {
2077
- if (msg)
2078
- flag2(this, "message", msg);
2079
- 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;
2080
- if (doLength && objType !== "map" && objType !== "set") {
2081
- new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
2082
- }
2083
- if (!doLength && objType === "date" && nType !== "date") {
2084
- errorMessage = msgPrefix + "the argument to below must be a date";
2085
- } else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
2086
- errorMessage = msgPrefix + "the argument to below must be a number";
2087
- } else if (!doLength && objType !== "date" && !isNumeric(obj)) {
2088
- let printObj = objType === "string" ? "'" + obj + "'" : obj;
2089
- errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
2090
- } else {
2091
- shouldThrow = false;
2092
- }
2093
- if (shouldThrow) {
2094
- throw new AssertionError(errorMessage, undefined, ssfi);
2095
- }
2096
- if (doLength) {
2097
- let descriptor = "length", itemsCount;
2098
- if (objType === "map" || objType === "set") {
2099
- descriptor = "size";
2100
- itemsCount = obj.size;
2101
- } else {
2102
- itemsCount = obj.length;
2103
- }
2104
- 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);
2105
- } else {
2106
- this.assert(obj < n, "expected #{this} to be below #{exp}", "expected #{this} to be at least #{exp}", n);
2107
- }
2108
- }
2109
- __name(assertBelow, "assertBelow");
2110
- Assertion.addMethod("below", assertBelow);
2111
- Assertion.addMethod("lt", assertBelow);
2112
- Assertion.addMethod("lessThan", assertBelow);
2113
- function assertMost(n, msg) {
2114
- if (msg)
2115
- flag2(this, "message", msg);
2116
- 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;
2117
- if (doLength && objType !== "map" && objType !== "set") {
2118
- new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
2119
- }
2120
- if (!doLength && objType === "date" && nType !== "date") {
2121
- errorMessage = msgPrefix + "the argument to most must be a date";
2122
- } else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
2123
- errorMessage = msgPrefix + "the argument to most must be a number";
2124
- } else if (!doLength && objType !== "date" && !isNumeric(obj)) {
2125
- let printObj = objType === "string" ? "'" + obj + "'" : obj;
2126
- errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
2127
- } else {
2128
- shouldThrow = false;
2129
- }
2130
- if (shouldThrow) {
2131
- throw new AssertionError(errorMessage, undefined, ssfi);
2132
- }
2133
- if (doLength) {
2134
- let descriptor = "length", itemsCount;
2135
- if (objType === "map" || objType === "set") {
2136
- descriptor = "size";
2137
- itemsCount = obj.size;
2138
- } else {
2139
- itemsCount = obj.length;
2140
- }
2141
- 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);
2142
- } else {
2143
- this.assert(obj <= n, "expected #{this} to be at most #{exp}", "expected #{this} to be above #{exp}", n);
2144
- }
2145
- }
2146
- __name(assertMost, "assertMost");
2147
- Assertion.addMethod("most", assertMost);
2148
- Assertion.addMethod("lte", assertMost);
2149
- Assertion.addMethod("lessThanOrEqual", assertMost);
2150
- Assertion.addMethod("within", function(start, finish, msg) {
2151
- if (msg)
2152
- flag2(this, "message", msg);
2153
- 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;
2154
- if (doLength && objType !== "map" && objType !== "set") {
2155
- new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
2156
- }
2157
- if (!doLength && objType === "date" && (startType !== "date" || finishType !== "date")) {
2158
- errorMessage = msgPrefix + "the arguments to within must be dates";
2159
- } else if ((!isNumeric(start) || !isNumeric(finish)) && (doLength || isNumeric(obj))) {
2160
- errorMessage = msgPrefix + "the arguments to within must be numbers";
2161
- } else if (!doLength && objType !== "date" && !isNumeric(obj)) {
2162
- let printObj = objType === "string" ? "'" + obj + "'" : obj;
2163
- errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
2164
- } else {
2165
- shouldThrow = false;
2166
- }
2167
- if (shouldThrow) {
2168
- throw new AssertionError(errorMessage, undefined, ssfi);
2169
- }
2170
- if (doLength) {
2171
- let descriptor = "length", itemsCount;
2172
- if (objType === "map" || objType === "set") {
2173
- descriptor = "size";
2174
- itemsCount = obj.size;
2175
- } else {
2176
- itemsCount = obj.length;
2177
- }
2178
- this.assert(itemsCount >= start && itemsCount <= finish, "expected #{this} to have a " + descriptor + " within " + range, "expected #{this} to not have a " + descriptor + " within " + range);
2179
- } else {
2180
- this.assert(obj >= start && obj <= finish, "expected #{this} to be within " + range, "expected #{this} to not be within " + range);
2181
- }
2182
- });
2183
- function assertInstanceOf(constructor, msg) {
2184
- if (msg)
2185
- flag2(this, "message", msg);
2186
- let target = flag2(this, "object");
2187
- let ssfi = flag2(this, "ssfi");
2188
- let flagMsg = flag2(this, "message");
2189
- let isInstanceOf;
2190
- try {
2191
- isInstanceOf = target instanceof constructor;
2192
- } catch (err) {
2193
- if (err instanceof TypeError) {
2194
- flagMsg = flagMsg ? flagMsg + ": " : "";
2195
- throw new AssertionError(flagMsg + "The instanceof assertion needs a constructor but " + type(constructor) + " was given.", undefined, ssfi);
2196
- }
2197
- throw err;
2198
- }
2199
- let name = getName(constructor);
2200
- if (name == null) {
2201
- name = "an unnamed constructor";
2202
- }
2203
- this.assert(isInstanceOf, "expected #{this} to be an instance of " + name, "expected #{this} to not be an instance of " + name);
2204
- }
2205
- __name(assertInstanceOf, "assertInstanceOf");
2206
- Assertion.addMethod("instanceof", assertInstanceOf);
2207
- Assertion.addMethod("instanceOf", assertInstanceOf);
2208
- function assertProperty(name, val, msg) {
2209
- if (msg)
2210
- flag2(this, "message", msg);
2211
- let isNested = flag2(this, "nested"), isOwn = flag2(this, "own"), flagMsg = flag2(this, "message"), obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), nameType = typeof name;
2212
- flagMsg = flagMsg ? flagMsg + ": " : "";
2213
- if (isNested) {
2214
- if (nameType !== "string") {
2215
- throw new AssertionError(flagMsg + "the argument to property must be a string when using nested syntax", undefined, ssfi);
2216
- }
2217
- } else {
2218
- if (nameType !== "string" && nameType !== "number" && nameType !== "symbol") {
2219
- throw new AssertionError(flagMsg + "the argument to property must be a string, number, or symbol", undefined, ssfi);
2220
- }
2221
- }
2222
- if (isNested && isOwn) {
2223
- throw new AssertionError(flagMsg + 'The "nested" and "own" flags cannot be combined.', undefined, ssfi);
2224
- }
2225
- if (obj === null || obj === undefined) {
2226
- throw new AssertionError(flagMsg + "Target cannot be null or undefined.", undefined, ssfi);
2227
- }
2228
- 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;
2229
- let descriptor = "";
2230
- if (isDeep)
2231
- descriptor += "deep ";
2232
- if (isOwn)
2233
- descriptor += "own ";
2234
- if (isNested)
2235
- descriptor += "nested ";
2236
- descriptor += "property ";
2237
- let hasProperty2;
2238
- if (isOwn)
2239
- hasProperty2 = Object.prototype.hasOwnProperty.call(obj, name);
2240
- else if (isNested)
2241
- hasProperty2 = pathInfo.exists;
2242
- else
2243
- hasProperty2 = hasProperty(obj, name);
2244
- if (!negate || arguments.length === 1) {
2245
- this.assert(hasProperty2, "expected #{this} to have " + descriptor + inspect2(name), "expected #{this} to not have " + descriptor + inspect2(name));
2246
- }
2247
- if (arguments.length > 1) {
2248
- 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);
2249
- }
2250
- flag2(this, "object", value);
2251
- }
2252
- __name(assertProperty, "assertProperty");
2253
- Assertion.addMethod("property", assertProperty);
2254
- function assertOwnProperty(_name, _value, _msg) {
2255
- flag2(this, "own", true);
2256
- assertProperty.apply(this, arguments);
2257
- }
2258
- __name(assertOwnProperty, "assertOwnProperty");
2259
- Assertion.addMethod("ownProperty", assertOwnProperty);
2260
- Assertion.addMethod("haveOwnProperty", assertOwnProperty);
2261
- function assertOwnPropertyDescriptor(name, descriptor, msg) {
2262
- if (typeof descriptor === "string") {
2263
- msg = descriptor;
2264
- descriptor = null;
2265
- }
2266
- if (msg)
2267
- flag2(this, "message", msg);
2268
- let obj = flag2(this, "object");
2269
- let actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name);
2270
- let eql = flag2(this, "eql");
2271
- if (actualDescriptor && descriptor) {
2272
- 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);
2273
- } else {
2274
- 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));
2275
- }
2276
- flag2(this, "object", actualDescriptor);
2277
- }
2278
- __name(assertOwnPropertyDescriptor, "assertOwnPropertyDescriptor");
2279
- Assertion.addMethod("ownPropertyDescriptor", assertOwnPropertyDescriptor);
2280
- Assertion.addMethod("haveOwnPropertyDescriptor", assertOwnPropertyDescriptor);
2281
- function assertLengthChain() {
2282
- flag2(this, "doLength", true);
2283
- }
2284
- __name(assertLengthChain, "assertLengthChain");
2285
- function assertLength(n, msg) {
2286
- if (msg)
2287
- flag2(this, "message", msg);
2288
- let obj = flag2(this, "object"), objType = type(obj).toLowerCase(), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), descriptor = "length", itemsCount;
2289
- switch (objType) {
2290
- case "map":
2291
- case "set":
2292
- descriptor = "size";
2293
- itemsCount = obj.size;
2294
- break;
2295
- default:
2296
- new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
2297
- itemsCount = obj.length;
2298
- }
2299
- 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);
2300
- }
2301
- __name(assertLength, "assertLength");
2302
- Assertion.addChainableMethod("length", assertLength, assertLengthChain);
2303
- Assertion.addChainableMethod("lengthOf", assertLength, assertLengthChain);
2304
- function assertMatch(re, msg) {
2305
- if (msg)
2306
- flag2(this, "message", msg);
2307
- let obj = flag2(this, "object");
2308
- this.assert(re.exec(obj), "expected #{this} to match " + re, "expected #{this} not to match " + re);
2309
- }
2310
- __name(assertMatch, "assertMatch");
2311
- Assertion.addMethod("match", assertMatch);
2312
- Assertion.addMethod("matches", assertMatch);
2313
- Assertion.addMethod("string", function(str, msg) {
2314
- if (msg)
2315
- flag2(this, "message", msg);
2316
- let obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
2317
- new Assertion(obj, flagMsg, ssfi, true).is.a("string");
2318
- this.assert(~obj.indexOf(str), "expected #{this} to contain " + inspect2(str), "expected #{this} to not contain " + inspect2(str));
2319
- });
2320
- function assertKeys(keys) {
2321
- 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");
2322
- flagMsg = flagMsg ? flagMsg + ": " : "";
2323
- 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";
2324
- if (objType === "Map" || objType === "Set") {
2325
- deepStr = isDeep ? "deeply " : "";
2326
- actual = [];
2327
- obj.forEach(function(val, key) {
2328
- actual.push(key);
2329
- });
2330
- if (keysType !== "Array") {
2331
- keys = Array.prototype.slice.call(arguments);
2332
- }
2333
- } else {
2334
- actual = getOwnEnumerableProperties(obj);
2335
- switch (keysType) {
2336
- case "Array":
2337
- if (arguments.length > 1) {
2338
- throw new AssertionError(mixedArgsMsg, undefined, ssfi);
2339
- }
2340
- break;
2341
- case "Object":
2342
- if (arguments.length > 1) {
2343
- throw new AssertionError(mixedArgsMsg, undefined, ssfi);
2344
- }
2345
- keys = Object.keys(keys);
2346
- break;
2347
- default:
2348
- keys = Array.prototype.slice.call(arguments);
2349
- }
2350
- keys = keys.map(function(val) {
2351
- return typeof val === "symbol" ? val : String(val);
2352
- });
2353
- }
2354
- if (!keys.length) {
2355
- throw new AssertionError(flagMsg + "keys required", undefined, ssfi);
2356
- }
2357
- let len = keys.length, any = flag2(this, "any"), all = flag2(this, "all"), expected = keys, isEql = isDeep ? flag2(this, "eql") : (val1, val2) => val1 === val2;
2358
- if (!any && !all) {
2359
- all = true;
2360
- }
2361
- if (any) {
2362
- ok = expected.some(function(expectedKey) {
2363
- return actual.some(function(actualKey) {
2364
- return isEql(expectedKey, actualKey);
2365
- });
2366
- });
2367
- }
2368
- if (all) {
2369
- ok = expected.every(function(expectedKey) {
2370
- return actual.some(function(actualKey) {
2371
- return isEql(expectedKey, actualKey);
2372
- });
2373
- });
2374
- if (!flag2(this, "contains")) {
2375
- ok = ok && keys.length == actual.length;
2376
- }
2377
- }
2378
- if (len > 1) {
2379
- keys = keys.map(function(key) {
2380
- return inspect2(key);
2381
- });
2382
- let last = keys.pop();
2383
- if (all) {
2384
- str = keys.join(", ") + ", and " + last;
2385
- }
2386
- if (any) {
2387
- str = keys.join(", ") + ", or " + last;
2388
- }
2389
- } else {
2390
- str = inspect2(keys[0]);
2391
- }
2392
- str = (len > 1 ? "keys " : "key ") + str;
2393
- str = (flag2(this, "contains") ? "contain " : "have ") + str;
2394
- this.assert(ok, "expected #{this} to " + deepStr + str, "expected #{this} to not " + deepStr + str, expected.slice(0).sort(compareByInspect), actual.sort(compareByInspect), true);
2395
- }
2396
- __name(assertKeys, "assertKeys");
2397
- Assertion.addMethod("keys", assertKeys);
2398
- Assertion.addMethod("key", assertKeys);
2399
- function assertThrows(errorLike, errMsgMatcher, msg) {
2400
- if (msg)
2401
- flag2(this, "message", msg);
2402
- let obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), negate = flag2(this, "negate") || false;
2403
- new Assertion(obj, flagMsg, ssfi, true).is.a("function");
2404
- if (isRegExp2(errorLike) || typeof errorLike === "string") {
2405
- errMsgMatcher = errorLike;
2406
- errorLike = null;
2407
- }
2408
- let caughtErr;
2409
- let errorWasThrown = false;
2410
- try {
2411
- obj();
2412
- } catch (err) {
2413
- errorWasThrown = true;
2414
- caughtErr = err;
2415
- }
2416
- let everyArgIsUndefined = errorLike === undefined && errMsgMatcher === undefined;
2417
- let everyArgIsDefined = Boolean(errorLike && errMsgMatcher);
2418
- let errorLikeFail = false;
2419
- let errMsgMatcherFail = false;
2420
- if (everyArgIsUndefined || !everyArgIsUndefined && !negate) {
2421
- let errorLikeString = "an error";
2422
- if (errorLike instanceof Error) {
2423
- errorLikeString = "#{exp}";
2424
- } else if (errorLike) {
2425
- errorLikeString = check_error_exports.getConstructorName(errorLike);
2426
- }
2427
- let actual = caughtErr;
2428
- if (caughtErr instanceof Error) {
2429
- actual = caughtErr.toString();
2430
- } else if (typeof caughtErr === "string") {
2431
- actual = caughtErr;
2432
- } else if (caughtErr && (typeof caughtErr === "object" || typeof caughtErr === "function")) {
2433
- try {
2434
- actual = check_error_exports.getConstructorName(caughtErr);
2435
- } catch (_err) {}
2436
- }
2437
- this.assert(errorWasThrown, "expected #{this} to throw " + errorLikeString, "expected #{this} to not throw an error but #{act} was thrown", errorLike && errorLike.toString(), actual);
2438
- }
2439
- if (errorLike && caughtErr) {
2440
- if (errorLike instanceof Error) {
2441
- let isCompatibleInstance = check_error_exports.compatibleInstance(caughtErr, errorLike);
2442
- if (isCompatibleInstance === negate) {
2443
- if (everyArgIsDefined && negate) {
2444
- errorLikeFail = true;
2445
- } else {
2446
- 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());
2447
- }
2448
- }
2449
- }
2450
- let isCompatibleConstructor = check_error_exports.compatibleConstructor(caughtErr, errorLike);
2451
- if (isCompatibleConstructor === negate) {
2452
- if (everyArgIsDefined && negate) {
2453
- errorLikeFail = true;
2454
- } else {
2455
- 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));
2456
- }
2457
- }
2458
- }
2459
- if (caughtErr && errMsgMatcher !== undefined && errMsgMatcher !== null) {
2460
- let placeholder = "including";
2461
- if (isRegExp2(errMsgMatcher)) {
2462
- placeholder = "matching";
2463
- }
2464
- let isCompatibleMessage = check_error_exports.compatibleMessage(caughtErr, errMsgMatcher);
2465
- if (isCompatibleMessage === negate) {
2466
- if (everyArgIsDefined && negate) {
2467
- errMsgMatcherFail = true;
2468
- } else {
2469
- 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));
2470
- }
2471
- }
2472
- }
2473
- if (errorLikeFail && errMsgMatcherFail) {
2474
- 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));
2475
- }
2476
- flag2(this, "object", caughtErr);
2477
- }
2478
- __name(assertThrows, "assertThrows");
2479
- Assertion.addMethod("throw", assertThrows);
2480
- Assertion.addMethod("throws", assertThrows);
2481
- Assertion.addMethod("Throw", assertThrows);
2482
- function respondTo(method, msg) {
2483
- if (msg)
2484
- flag2(this, "message", msg);
2485
- let obj = flag2(this, "object"), itself = flag2(this, "itself"), context = typeof obj === "function" && !itself ? obj.prototype[method] : obj[method];
2486
- this.assert(typeof context === "function", "expected #{this} to respond to " + inspect2(method), "expected #{this} to not respond to " + inspect2(method));
2487
- }
2488
- __name(respondTo, "respondTo");
2489
- Assertion.addMethod("respondTo", respondTo);
2490
- Assertion.addMethod("respondsTo", respondTo);
2491
- Assertion.addProperty("itself", function() {
2492
- flag2(this, "itself", true);
2493
- });
2494
- function satisfy(matcher, msg) {
2495
- if (msg)
2496
- flag2(this, "message", msg);
2497
- let obj = flag2(this, "object");
2498
- let result = matcher(obj);
2499
- this.assert(result, "expected #{this} to satisfy " + objDisplay(matcher), "expected #{this} to not satisfy" + objDisplay(matcher), flag2(this, "negate") ? false : true, result);
2500
- }
2501
- __name(satisfy, "satisfy");
2502
- Assertion.addMethod("satisfy", satisfy);
2503
- Assertion.addMethod("satisfies", satisfy);
2504
- function closeTo(expected, delta, msg) {
2505
- if (msg)
2506
- flag2(this, "message", msg);
2507
- let obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
2508
- new Assertion(obj, flagMsg, ssfi, true).is.numeric;
2509
- let message = "A `delta` value is required for `closeTo`";
2510
- if (delta == undefined) {
2511
- throw new AssertionError(flagMsg ? `${flagMsg}: ${message}` : message, undefined, ssfi);
2512
- }
2513
- new Assertion(delta, flagMsg, ssfi, true).is.numeric;
2514
- message = "A `expected` value is required for `closeTo`";
2515
- if (expected == undefined) {
2516
- throw new AssertionError(flagMsg ? `${flagMsg}: ${message}` : message, undefined, ssfi);
2517
- }
2518
- new Assertion(expected, flagMsg, ssfi, true).is.numeric;
2519
- const abs = /* @__PURE__ */ __name((x) => x < 0 ? -x : x, "abs");
2520
- const strip = /* @__PURE__ */ __name((number) => parseFloat(parseFloat(number).toPrecision(12)), "strip");
2521
- this.assert(strip(abs(obj - expected)) <= delta, "expected #{this} to be close to " + expected + " +/- " + delta, "expected #{this} not to be close to " + expected + " +/- " + delta);
2522
- }
2523
- __name(closeTo, "closeTo");
2524
- Assertion.addMethod("closeTo", closeTo);
2525
- Assertion.addMethod("approximately", closeTo);
2526
- function isSubsetOf(_subset, _superset, cmp, contains, ordered) {
2527
- let superset = Array.from(_superset);
2528
- let subset = Array.from(_subset);
2529
- if (!contains) {
2530
- if (subset.length !== superset.length)
2531
- return false;
2532
- superset = superset.slice();
2533
- }
2534
- return subset.every(function(elem, idx) {
2535
- if (ordered)
2536
- return cmp ? cmp(elem, superset[idx]) : elem === superset[idx];
2537
- if (!cmp) {
2538
- let matchIdx = superset.indexOf(elem);
2539
- if (matchIdx === -1)
2540
- return false;
2541
- if (!contains)
2542
- superset.splice(matchIdx, 1);
2543
- return true;
2544
- }
2545
- return superset.some(function(elem2, matchIdx) {
2546
- if (!cmp(elem, elem2))
2547
- return false;
2548
- if (!contains)
2549
- superset.splice(matchIdx, 1);
2550
- return true;
2551
- });
2552
- });
2553
- }
2554
- __name(isSubsetOf, "isSubsetOf");
2555
- Assertion.addMethod("members", function(subset, msg) {
2556
- if (msg)
2557
- flag2(this, "message", msg);
2558
- let obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
2559
- new Assertion(obj, flagMsg, ssfi, true).to.be.iterable;
2560
- new Assertion(subset, flagMsg, ssfi, true).to.be.iterable;
2561
- let contains = flag2(this, "contains");
2562
- let ordered = flag2(this, "ordered");
2563
- let subject, failMsg, failNegateMsg;
2564
- if (contains) {
2565
- subject = ordered ? "an ordered superset" : "a superset";
2566
- failMsg = "expected #{this} to be " + subject + " of #{exp}";
2567
- failNegateMsg = "expected #{this} to not be " + subject + " of #{exp}";
2568
- } else {
2569
- subject = ordered ? "ordered members" : "members";
2570
- failMsg = "expected #{this} to have the same " + subject + " as #{exp}";
2571
- failNegateMsg = "expected #{this} to not have the same " + subject + " as #{exp}";
2572
- }
2573
- let cmp = flag2(this, "deep") ? flag2(this, "eql") : undefined;
2574
- this.assert(isSubsetOf(subset, obj, cmp, contains, ordered), failMsg, failNegateMsg, subset, obj, true);
2575
- });
2576
- Assertion.addProperty("iterable", function(msg) {
2577
- if (msg)
2578
- flag2(this, "message", msg);
2579
- let obj = flag2(this, "object");
2580
- this.assert(obj != null && obj[Symbol.iterator], "expected #{this} to be an iterable", "expected #{this} to not be an iterable", obj);
2581
- });
2582
- function oneOf(list, msg) {
2583
- if (msg)
2584
- flag2(this, "message", msg);
2585
- 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");
2586
- new Assertion(list, flagMsg, ssfi, true).to.be.an("array");
2587
- if (contains) {
2588
- this.assert(list.some(function(possibility) {
2589
- return expected.indexOf(possibility) > -1;
2590
- }), "expected #{this} to contain one of #{exp}", "expected #{this} to not contain one of #{exp}", list, expected);
2591
- } else {
2592
- if (isDeep) {
2593
- this.assert(list.some(function(possibility) {
2594
- return eql(expected, possibility);
2595
- }), "expected #{this} to deeply equal one of #{exp}", "expected #{this} to deeply equal one of #{exp}", list, expected);
2596
- } else {
2597
- this.assert(list.indexOf(expected) > -1, "expected #{this} to be one of #{exp}", "expected #{this} to not be one of #{exp}", list, expected);
2598
- }
2599
- }
2600
- }
2601
- __name(oneOf, "oneOf");
2602
- Assertion.addMethod("oneOf", oneOf);
2603
- function assertChanges(subject, prop, msg) {
2604
- if (msg)
2605
- flag2(this, "message", msg);
2606
- let fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
2607
- new Assertion(fn, flagMsg, ssfi, true).is.a("function");
2608
- let initial;
2609
- if (!prop) {
2610
- new Assertion(subject, flagMsg, ssfi, true).is.a("function");
2611
- initial = subject();
2612
- } else {
2613
- new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);
2614
- initial = subject[prop];
2615
- }
2616
- fn();
2617
- let final = prop === undefined || prop === null ? subject() : subject[prop];
2618
- let msgObj = prop === undefined || prop === null ? initial : "." + prop;
2619
- flag2(this, "deltaMsgObj", msgObj);
2620
- flag2(this, "initialDeltaValue", initial);
2621
- flag2(this, "finalDeltaValue", final);
2622
- flag2(this, "deltaBehavior", "change");
2623
- flag2(this, "realDelta", final !== initial);
2624
- this.assert(initial !== final, "expected " + msgObj + " to change", "expected " + msgObj + " to not change");
2625
- }
2626
- __name(assertChanges, "assertChanges");
2627
- Assertion.addMethod("change", assertChanges);
2628
- Assertion.addMethod("changes", assertChanges);
2629
- function assertIncreases(subject, prop, msg) {
2630
- if (msg)
2631
- flag2(this, "message", msg);
2632
- let fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
2633
- new Assertion(fn, flagMsg, ssfi, true).is.a("function");
2634
- let initial;
2635
- if (!prop) {
2636
- new Assertion(subject, flagMsg, ssfi, true).is.a("function");
2637
- initial = subject();
2638
- } else {
2639
- new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);
2640
- initial = subject[prop];
2641
- }
2642
- new Assertion(initial, flagMsg, ssfi, true).is.a("number");
2643
- fn();
2644
- let final = prop === undefined || prop === null ? subject() : subject[prop];
2645
- let msgObj = prop === undefined || prop === null ? initial : "." + prop;
2646
- flag2(this, "deltaMsgObj", msgObj);
2647
- flag2(this, "initialDeltaValue", initial);
2648
- flag2(this, "finalDeltaValue", final);
2649
- flag2(this, "deltaBehavior", "increase");
2650
- flag2(this, "realDelta", final - initial);
2651
- this.assert(final - initial > 0, "expected " + msgObj + " to increase", "expected " + msgObj + " to not increase");
2652
- }
2653
- __name(assertIncreases, "assertIncreases");
2654
- Assertion.addMethod("increase", assertIncreases);
2655
- Assertion.addMethod("increases", assertIncreases);
2656
- function assertDecreases(subject, prop, msg) {
2657
- if (msg)
2658
- flag2(this, "message", msg);
2659
- let fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
2660
- new Assertion(fn, flagMsg, ssfi, true).is.a("function");
2661
- let initial;
2662
- if (!prop) {
2663
- new Assertion(subject, flagMsg, ssfi, true).is.a("function");
2664
- initial = subject();
2665
- } else {
2666
- new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);
2667
- initial = subject[prop];
2668
- }
2669
- new Assertion(initial, flagMsg, ssfi, true).is.a("number");
2670
- fn();
2671
- let final = prop === undefined || prop === null ? subject() : subject[prop];
2672
- let msgObj = prop === undefined || prop === null ? initial : "." + prop;
2673
- flag2(this, "deltaMsgObj", msgObj);
2674
- flag2(this, "initialDeltaValue", initial);
2675
- flag2(this, "finalDeltaValue", final);
2676
- flag2(this, "deltaBehavior", "decrease");
2677
- flag2(this, "realDelta", initial - final);
2678
- this.assert(final - initial < 0, "expected " + msgObj + " to decrease", "expected " + msgObj + " to not decrease");
2679
- }
2680
- __name(assertDecreases, "assertDecreases");
2681
- Assertion.addMethod("decrease", assertDecreases);
2682
- Assertion.addMethod("decreases", assertDecreases);
2683
- function assertDelta(delta, msg) {
2684
- if (msg)
2685
- flag2(this, "message", msg);
2686
- let msgObj = flag2(this, "deltaMsgObj");
2687
- let initial = flag2(this, "initialDeltaValue");
2688
- let final = flag2(this, "finalDeltaValue");
2689
- let behavior = flag2(this, "deltaBehavior");
2690
- let realDelta = flag2(this, "realDelta");
2691
- let expression;
2692
- if (behavior === "change") {
2693
- expression = Math.abs(final - initial) === Math.abs(delta);
2694
- } else {
2695
- expression = realDelta === Math.abs(delta);
2696
- }
2697
- this.assert(expression, "expected " + msgObj + " to " + behavior + " by " + delta, "expected " + msgObj + " to not " + behavior + " by " + delta);
2698
- }
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
- function compareSubset(expected, actual) {
2721
- if (expected === actual) {
2722
- return true;
2723
- }
2724
- if (typeof actual !== typeof expected) {
2725
- return false;
2726
- }
2727
- if (typeof expected !== "object" || expected === null) {
2728
- return expected === actual;
2729
- }
2730
- if (!actual) {
2731
- return false;
2732
- }
2733
- if (Array.isArray(expected)) {
2734
- if (!Array.isArray(actual)) {
2735
- return false;
2736
- }
2737
- return expected.every(function(exp) {
2738
- return actual.some(function(act) {
2739
- return compareSubset(exp, act);
2740
- });
2741
- });
2742
- }
2743
- if (expected instanceof Date) {
2744
- if (actual instanceof Date) {
2745
- return expected.getTime() === actual.getTime();
2746
- } else {
2747
- return false;
2748
- }
2749
- }
2750
- return Object.keys(expected).every(function(key) {
2751
- let expectedValue = expected[key];
2752
- let actualValue = actual[key];
2753
- if (typeof expectedValue === "object" && expectedValue !== null && actualValue !== null) {
2754
- return compareSubset(expectedValue, actualValue);
2755
- }
2756
- if (typeof expectedValue === "function") {
2757
- return expectedValue(actualValue);
2758
- }
2759
- return actualValue === expectedValue;
2760
- });
2761
- }
2762
- __name(compareSubset, "compareSubset");
2763
- Assertion.addMethod("containSubset", function(expected) {
2764
- const actual = flag(this, "object");
2765
- const showDiff = config.showDiff;
2766
- this.assert(compareSubset(expected, actual), "expected #{act} to contain subset #{exp}", "expected #{act} to not contain subset #{exp}", expected, actual, showDiff);
2767
- });
2768
- function expect(val, message) {
2769
- return new Assertion(val, message);
2770
- }
2771
- __name(expect, "expect");
2772
- expect.fail = function(actual, expected, message, operator) {
2773
- if (arguments.length < 2) {
2774
- message = actual;
2775
- actual = undefined;
2776
- }
2777
- message = message || "expect.fail()";
2778
- throw new AssertionError(message, {
2779
- actual,
2780
- expected,
2781
- operator
2782
- }, expect.fail);
2783
- };
2784
- var should_exports = {};
2785
- __export2(should_exports, {
2786
- Should: () => Should,
2787
- should: () => should
2788
- });
2789
- function loadShould() {
2790
- function shouldGetter() {
2791
- if (this instanceof String || this instanceof Number || this instanceof Boolean || typeof Symbol === "function" && this instanceof Symbol || typeof BigInt === "function" && this instanceof BigInt) {
2792
- return new Assertion(this.valueOf(), null, shouldGetter);
2793
- }
2794
- return new Assertion(this, null, shouldGetter);
2795
- }
2796
- __name(shouldGetter, "shouldGetter");
2797
- function shouldSetter(value) {
2798
- Object.defineProperty(this, "should", {
2799
- value,
2800
- enumerable: true,
2801
- configurable: true,
2802
- writable: true
2803
- });
2804
- }
2805
- __name(shouldSetter, "shouldSetter");
2806
- Object.defineProperty(Object.prototype, "should", {
2807
- set: shouldSetter,
2808
- get: shouldGetter,
2809
- configurable: true
2810
- });
2811
- let should2 = {};
2812
- should2.fail = function(actual, expected, message, operator) {
2813
- if (arguments.length < 2) {
2814
- message = actual;
2815
- actual = undefined;
2816
- }
2817
- message = message || "should.fail()";
2818
- throw new AssertionError(message, {
2819
- actual,
2820
- expected,
2821
- operator
2822
- }, should2.fail);
2823
- };
2824
- should2.equal = function(actual, expected, message) {
2825
- new Assertion(actual, message).to.equal(expected);
2826
- };
2827
- should2.Throw = function(fn, errt, errs, msg) {
2828
- new Assertion(fn, msg).to.Throw(errt, errs);
2829
- };
2830
- should2.exist = function(val, msg) {
2831
- new Assertion(val, msg).to.exist;
2832
- };
2833
- should2.not = {};
2834
- should2.not.equal = function(actual, expected, msg) {
2835
- new Assertion(actual, msg).to.not.equal(expected);
2836
- };
2837
- should2.not.Throw = function(fn, errt, errs, msg) {
2838
- new Assertion(fn, msg).to.not.Throw(errt, errs);
2839
- };
2840
- should2.not.exist = function(val, msg) {
2841
- new Assertion(val, msg).to.not.exist;
2842
- };
2843
- should2["throw"] = should2["Throw"];
2844
- should2.not["throw"] = should2.not["Throw"];
2845
- return should2;
2846
- }
2847
- __name(loadShould, "loadShould");
2848
- var should = loadShould;
2849
- var Should = loadShould;
2850
- function assert(express, errmsg) {
2851
- let test2 = new Assertion(null, null, assert, true);
2852
- test2.assert(express, errmsg, "[ negation message unavailable ]");
2853
- }
2854
- __name(assert, "assert");
2855
- assert.fail = function(actual, expected, message, operator) {
2856
- if (arguments.length < 2) {
2857
- message = actual;
2858
- actual = undefined;
2859
- }
2860
- message = message || "assert.fail()";
2861
- throw new AssertionError(message, {
2862
- actual,
2863
- expected,
2864
- operator
2865
- }, assert.fail);
2866
- };
2867
- assert.isOk = function(val, msg) {
2868
- new Assertion(val, msg, assert.isOk, true).is.ok;
2869
- };
2870
- assert.isNotOk = function(val, msg) {
2871
- new Assertion(val, msg, assert.isNotOk, true).is.not.ok;
2872
- };
2873
- assert.equal = function(act, exp, msg) {
2874
- let test2 = new Assertion(act, msg, assert.equal, true);
2875
- test2.assert(exp == flag(test2, "object"), "expected #{this} to equal #{exp}", "expected #{this} to not equal #{act}", exp, act, true);
2876
- };
2877
- assert.notEqual = function(act, exp, msg) {
2878
- let test2 = new Assertion(act, msg, assert.notEqual, true);
2879
- test2.assert(exp != flag(test2, "object"), "expected #{this} to not equal #{exp}", "expected #{this} to equal #{act}", exp, act, true);
2880
- };
2881
- assert.strictEqual = function(act, exp, msg) {
2882
- new Assertion(act, msg, assert.strictEqual, true).to.equal(exp);
2883
- };
2884
- assert.notStrictEqual = function(act, exp, msg) {
2885
- new Assertion(act, msg, assert.notStrictEqual, true).to.not.equal(exp);
2886
- };
2887
- assert.deepEqual = assert.deepStrictEqual = function(act, exp, msg) {
2888
- new Assertion(act, msg, assert.deepEqual, true).to.eql(exp);
2889
- };
2890
- assert.notDeepEqual = function(act, exp, msg) {
2891
- new Assertion(act, msg, assert.notDeepEqual, true).to.not.eql(exp);
2892
- };
2893
- assert.isAbove = function(val, abv, msg) {
2894
- new Assertion(val, msg, assert.isAbove, true).to.be.above(abv);
2895
- };
2896
- assert.isAtLeast = function(val, atlst, msg) {
2897
- new Assertion(val, msg, assert.isAtLeast, true).to.be.least(atlst);
2898
- };
2899
- assert.isBelow = function(val, blw, msg) {
2900
- new Assertion(val, msg, assert.isBelow, true).to.be.below(blw);
2901
- };
2902
- assert.isAtMost = function(val, atmst, msg) {
2903
- new Assertion(val, msg, assert.isAtMost, true).to.be.most(atmst);
2904
- };
2905
- assert.isTrue = function(val, msg) {
2906
- new Assertion(val, msg, assert.isTrue, true).is["true"];
2907
- };
2908
- assert.isNotTrue = function(val, msg) {
2909
- new Assertion(val, msg, assert.isNotTrue, true).to.not.equal(true);
2910
- };
2911
- assert.isFalse = function(val, msg) {
2912
- new Assertion(val, msg, assert.isFalse, true).is["false"];
2913
- };
2914
- assert.isNotFalse = function(val, msg) {
2915
- new Assertion(val, msg, assert.isNotFalse, true).to.not.equal(false);
2916
- };
2917
- assert.isNull = function(val, msg) {
2918
- new Assertion(val, msg, assert.isNull, true).to.equal(null);
2919
- };
2920
- assert.isNotNull = function(val, msg) {
2921
- new Assertion(val, msg, assert.isNotNull, true).to.not.equal(null);
2922
- };
2923
- assert.isNaN = function(val, msg) {
2924
- new Assertion(val, msg, assert.isNaN, true).to.be.NaN;
2925
- };
2926
- assert.isNotNaN = function(value, message) {
2927
- new Assertion(value, message, assert.isNotNaN, true).not.to.be.NaN;
2928
- };
2929
- assert.exists = function(val, msg) {
2930
- new Assertion(val, msg, assert.exists, true).to.exist;
2931
- };
2932
- assert.notExists = function(val, msg) {
2933
- new Assertion(val, msg, assert.notExists, true).to.not.exist;
2934
- };
2935
- assert.isUndefined = function(val, msg) {
2936
- new Assertion(val, msg, assert.isUndefined, true).to.equal(undefined);
2937
- };
2938
- assert.isDefined = function(val, msg) {
2939
- new Assertion(val, msg, assert.isDefined, true).to.not.equal(undefined);
2940
- };
2941
- assert.isCallable = function(value, message) {
2942
- new Assertion(value, message, assert.isCallable, true).is.callable;
2943
- };
2944
- assert.isNotCallable = function(value, message) {
2945
- new Assertion(value, message, assert.isNotCallable, true).is.not.callable;
2946
- };
2947
- assert.isObject = function(val, msg) {
2948
- new Assertion(val, msg, assert.isObject, true).to.be.a("object");
2949
- };
2950
- assert.isNotObject = function(val, msg) {
2951
- new Assertion(val, msg, assert.isNotObject, true).to.not.be.a("object");
2952
- };
2953
- assert.isArray = function(val, msg) {
2954
- new Assertion(val, msg, assert.isArray, true).to.be.an("array");
2955
- };
2956
- assert.isNotArray = function(val, msg) {
2957
- new Assertion(val, msg, assert.isNotArray, true).to.not.be.an("array");
2958
- };
2959
- assert.isString = function(val, msg) {
2960
- new Assertion(val, msg, assert.isString, true).to.be.a("string");
2961
- };
2962
- assert.isNotString = function(val, msg) {
2963
- new Assertion(val, msg, assert.isNotString, true).to.not.be.a("string");
2964
- };
2965
- assert.isNumber = function(val, msg) {
2966
- new Assertion(val, msg, assert.isNumber, true).to.be.a("number");
2967
- };
2968
- assert.isNotNumber = function(val, msg) {
2969
- new Assertion(val, msg, assert.isNotNumber, true).to.not.be.a("number");
2970
- };
2971
- assert.isNumeric = function(val, msg) {
2972
- new Assertion(val, msg, assert.isNumeric, true).is.numeric;
2973
- };
2974
- assert.isNotNumeric = function(val, msg) {
2975
- new Assertion(val, msg, assert.isNotNumeric, true).is.not.numeric;
2976
- };
2977
- assert.isFinite = function(val, msg) {
2978
- new Assertion(val, msg, assert.isFinite, true).to.be.finite;
2979
- };
2980
- assert.isBoolean = function(val, msg) {
2981
- new Assertion(val, msg, assert.isBoolean, true).to.be.a("boolean");
2982
- };
2983
- assert.isNotBoolean = function(val, msg) {
2984
- new Assertion(val, msg, assert.isNotBoolean, true).to.not.be.a("boolean");
2985
- };
2986
- assert.typeOf = function(val, type3, msg) {
2987
- new Assertion(val, msg, assert.typeOf, true).to.be.a(type3);
2988
- };
2989
- assert.notTypeOf = function(value, type3, message) {
2990
- new Assertion(value, message, assert.notTypeOf, true).to.not.be.a(type3);
2991
- };
2992
- assert.instanceOf = function(val, type3, msg) {
2993
- new Assertion(val, msg, assert.instanceOf, true).to.be.instanceOf(type3);
2994
- };
2995
- assert.notInstanceOf = function(val, type3, msg) {
2996
- new Assertion(val, msg, assert.notInstanceOf, true).to.not.be.instanceOf(type3);
2997
- };
2998
- assert.include = function(exp, inc, msg) {
2999
- new Assertion(exp, msg, assert.include, true).include(inc);
3000
- };
3001
- assert.notInclude = function(exp, inc, msg) {
3002
- new Assertion(exp, msg, assert.notInclude, true).not.include(inc);
3003
- };
3004
- assert.deepInclude = function(exp, inc, msg) {
3005
- new Assertion(exp, msg, assert.deepInclude, true).deep.include(inc);
3006
- };
3007
- assert.notDeepInclude = function(exp, inc, msg) {
3008
- new Assertion(exp, msg, assert.notDeepInclude, true).not.deep.include(inc);
3009
- };
3010
- assert.nestedInclude = function(exp, inc, msg) {
3011
- new Assertion(exp, msg, assert.nestedInclude, true).nested.include(inc);
3012
- };
3013
- assert.notNestedInclude = function(exp, inc, msg) {
3014
- new Assertion(exp, msg, assert.notNestedInclude, true).not.nested.include(inc);
3015
- };
3016
- assert.deepNestedInclude = function(exp, inc, msg) {
3017
- new Assertion(exp, msg, assert.deepNestedInclude, true).deep.nested.include(inc);
3018
- };
3019
- assert.notDeepNestedInclude = function(exp, inc, msg) {
3020
- new Assertion(exp, msg, assert.notDeepNestedInclude, true).not.deep.nested.include(inc);
3021
- };
3022
- assert.ownInclude = function(exp, inc, msg) {
3023
- new Assertion(exp, msg, assert.ownInclude, true).own.include(inc);
3024
- };
3025
- assert.notOwnInclude = function(exp, inc, msg) {
3026
- new Assertion(exp, msg, assert.notOwnInclude, true).not.own.include(inc);
3027
- };
3028
- assert.deepOwnInclude = function(exp, inc, msg) {
3029
- new Assertion(exp, msg, assert.deepOwnInclude, true).deep.own.include(inc);
3030
- };
3031
- assert.notDeepOwnInclude = function(exp, inc, msg) {
3032
- new Assertion(exp, msg, assert.notDeepOwnInclude, true).not.deep.own.include(inc);
3033
- };
3034
- assert.match = function(exp, re, msg) {
3035
- new Assertion(exp, msg, assert.match, true).to.match(re);
3036
- };
3037
- assert.notMatch = function(exp, re, msg) {
3038
- new Assertion(exp, msg, assert.notMatch, true).to.not.match(re);
3039
- };
3040
- assert.property = function(obj, prop, msg) {
3041
- new Assertion(obj, msg, assert.property, true).to.have.property(prop);
3042
- };
3043
- assert.notProperty = function(obj, prop, msg) {
3044
- new Assertion(obj, msg, assert.notProperty, true).to.not.have.property(prop);
3045
- };
3046
- assert.propertyVal = function(obj, prop, val, msg) {
3047
- new Assertion(obj, msg, assert.propertyVal, true).to.have.property(prop, val);
3048
- };
3049
- assert.notPropertyVal = function(obj, prop, val, msg) {
3050
- new Assertion(obj, msg, assert.notPropertyVal, true).to.not.have.property(prop, val);
3051
- };
3052
- assert.deepPropertyVal = function(obj, prop, val, msg) {
3053
- new Assertion(obj, msg, assert.deepPropertyVal, true).to.have.deep.property(prop, val);
3054
- };
3055
- assert.notDeepPropertyVal = function(obj, prop, val, msg) {
3056
- new Assertion(obj, msg, assert.notDeepPropertyVal, true).to.not.have.deep.property(prop, val);
3057
- };
3058
- assert.ownProperty = function(obj, prop, msg) {
3059
- new Assertion(obj, msg, assert.ownProperty, true).to.have.own.property(prop);
3060
- };
3061
- assert.notOwnProperty = function(obj, prop, msg) {
3062
- new Assertion(obj, msg, assert.notOwnProperty, true).to.not.have.own.property(prop);
3063
- };
3064
- assert.ownPropertyVal = function(obj, prop, value, msg) {
3065
- new Assertion(obj, msg, assert.ownPropertyVal, true).to.have.own.property(prop, value);
3066
- };
3067
- assert.notOwnPropertyVal = function(obj, prop, value, msg) {
3068
- new Assertion(obj, msg, assert.notOwnPropertyVal, true).to.not.have.own.property(prop, value);
3069
- };
3070
- assert.deepOwnPropertyVal = function(obj, prop, value, msg) {
3071
- new Assertion(obj, msg, assert.deepOwnPropertyVal, true).to.have.deep.own.property(prop, value);
3072
- };
3073
- assert.notDeepOwnPropertyVal = function(obj, prop, value, msg) {
3074
- new Assertion(obj, msg, assert.notDeepOwnPropertyVal, true).to.not.have.deep.own.property(prop, value);
3075
- };
3076
- assert.nestedProperty = function(obj, prop, msg) {
3077
- new Assertion(obj, msg, assert.nestedProperty, true).to.have.nested.property(prop);
3078
- };
3079
- assert.notNestedProperty = function(obj, prop, msg) {
3080
- new Assertion(obj, msg, assert.notNestedProperty, true).to.not.have.nested.property(prop);
3081
- };
3082
- assert.nestedPropertyVal = function(obj, prop, val, msg) {
3083
- new Assertion(obj, msg, assert.nestedPropertyVal, true).to.have.nested.property(prop, val);
3084
- };
3085
- assert.notNestedPropertyVal = function(obj, prop, val, msg) {
3086
- new Assertion(obj, msg, assert.notNestedPropertyVal, true).to.not.have.nested.property(prop, val);
3087
- };
3088
- assert.deepNestedPropertyVal = function(obj, prop, val, msg) {
3089
- new Assertion(obj, msg, assert.deepNestedPropertyVal, true).to.have.deep.nested.property(prop, val);
3090
- };
3091
- assert.notDeepNestedPropertyVal = function(obj, prop, val, msg) {
3092
- new Assertion(obj, msg, assert.notDeepNestedPropertyVal, true).to.not.have.deep.nested.property(prop, val);
3093
- };
3094
- assert.lengthOf = function(exp, len, msg) {
3095
- new Assertion(exp, msg, assert.lengthOf, true).to.have.lengthOf(len);
3096
- };
3097
- assert.hasAnyKeys = function(obj, keys, msg) {
3098
- new Assertion(obj, msg, assert.hasAnyKeys, true).to.have.any.keys(keys);
3099
- };
3100
- assert.hasAllKeys = function(obj, keys, msg) {
3101
- new Assertion(obj, msg, assert.hasAllKeys, true).to.have.all.keys(keys);
3102
- };
3103
- assert.containsAllKeys = function(obj, keys, msg) {
3104
- new Assertion(obj, msg, assert.containsAllKeys, true).to.contain.all.keys(keys);
3105
- };
3106
- assert.doesNotHaveAnyKeys = function(obj, keys, msg) {
3107
- new Assertion(obj, msg, assert.doesNotHaveAnyKeys, true).to.not.have.any.keys(keys);
3108
- };
3109
- assert.doesNotHaveAllKeys = function(obj, keys, msg) {
3110
- new Assertion(obj, msg, assert.doesNotHaveAllKeys, true).to.not.have.all.keys(keys);
3111
- };
3112
- assert.hasAnyDeepKeys = function(obj, keys, msg) {
3113
- new Assertion(obj, msg, assert.hasAnyDeepKeys, true).to.have.any.deep.keys(keys);
3114
- };
3115
- assert.hasAllDeepKeys = function(obj, keys, msg) {
3116
- new Assertion(obj, msg, assert.hasAllDeepKeys, true).to.have.all.deep.keys(keys);
3117
- };
3118
- assert.containsAllDeepKeys = function(obj, keys, msg) {
3119
- new Assertion(obj, msg, assert.containsAllDeepKeys, true).to.contain.all.deep.keys(keys);
3120
- };
3121
- assert.doesNotHaveAnyDeepKeys = function(obj, keys, msg) {
3122
- new Assertion(obj, msg, assert.doesNotHaveAnyDeepKeys, true).to.not.have.any.deep.keys(keys);
3123
- };
3124
- assert.doesNotHaveAllDeepKeys = function(obj, keys, msg) {
3125
- new Assertion(obj, msg, assert.doesNotHaveAllDeepKeys, true).to.not.have.all.deep.keys(keys);
3126
- };
3127
- assert.throws = function(fn, errorLike, errMsgMatcher, msg) {
3128
- if (typeof errorLike === "string" || errorLike instanceof RegExp) {
3129
- errMsgMatcher = errorLike;
3130
- errorLike = null;
3131
- }
3132
- let assertErr = new Assertion(fn, msg, assert.throws, true).to.throw(errorLike, errMsgMatcher);
3133
- return flag(assertErr, "object");
3134
- };
3135
- assert.doesNotThrow = function(fn, errorLike, errMsgMatcher, message) {
3136
- if (typeof errorLike === "string" || errorLike instanceof RegExp) {
3137
- errMsgMatcher = errorLike;
3138
- errorLike = null;
3139
- }
3140
- new Assertion(fn, message, assert.doesNotThrow, true).to.not.throw(errorLike, errMsgMatcher);
3141
- };
3142
- assert.operator = function(val, operator, val2, msg) {
3143
- let ok;
3144
- switch (operator) {
3145
- case "==":
3146
- ok = val == val2;
3147
- break;
3148
- case "===":
3149
- ok = val === val2;
3150
- break;
3151
- case ">":
3152
- ok = val > val2;
3153
- break;
3154
- case ">=":
3155
- ok = val >= val2;
3156
- break;
3157
- case "<":
3158
- ok = val < val2;
3159
- break;
3160
- case "<=":
3161
- ok = val <= val2;
3162
- break;
3163
- case "!=":
3164
- ok = val != val2;
3165
- break;
3166
- case "!==":
3167
- ok = val !== val2;
3168
- break;
3169
- default:
3170
- msg = msg ? msg + ": " : msg;
3171
- throw new AssertionError(msg + 'Invalid operator "' + operator + '"', undefined, assert.operator);
3172
- }
3173
- let test2 = new Assertion(ok, msg, assert.operator, true);
3174
- test2.assert(flag(test2, "object") === true, "expected " + inspect2(val) + " to be " + operator + " " + inspect2(val2), "expected " + inspect2(val) + " to not be " + operator + " " + inspect2(val2));
3175
- };
3176
- assert.closeTo = function(act, exp, delta, msg) {
3177
- new Assertion(act, msg, assert.closeTo, true).to.be.closeTo(exp, delta);
3178
- };
3179
- assert.approximately = function(act, exp, delta, msg) {
3180
- new Assertion(act, msg, assert.approximately, true).to.be.approximately(exp, delta);
3181
- };
3182
- assert.sameMembers = function(set1, set2, msg) {
3183
- new Assertion(set1, msg, assert.sameMembers, true).to.have.same.members(set2);
3184
- };
3185
- assert.notSameMembers = function(set1, set2, msg) {
3186
- new Assertion(set1, msg, assert.notSameMembers, true).to.not.have.same.members(set2);
3187
- };
3188
- assert.sameDeepMembers = function(set1, set2, msg) {
3189
- new Assertion(set1, msg, assert.sameDeepMembers, true).to.have.same.deep.members(set2);
3190
- };
3191
- assert.notSameDeepMembers = function(set1, set2, msg) {
3192
- new Assertion(set1, msg, assert.notSameDeepMembers, true).to.not.have.same.deep.members(set2);
3193
- };
3194
- assert.sameOrderedMembers = function(set1, set2, msg) {
3195
- new Assertion(set1, msg, assert.sameOrderedMembers, true).to.have.same.ordered.members(set2);
3196
- };
3197
- assert.notSameOrderedMembers = function(set1, set2, msg) {
3198
- new Assertion(set1, msg, assert.notSameOrderedMembers, true).to.not.have.same.ordered.members(set2);
3199
- };
3200
- assert.sameDeepOrderedMembers = function(set1, set2, msg) {
3201
- new Assertion(set1, msg, assert.sameDeepOrderedMembers, true).to.have.same.deep.ordered.members(set2);
3202
- };
3203
- assert.notSameDeepOrderedMembers = function(set1, set2, msg) {
3204
- new Assertion(set1, msg, assert.notSameDeepOrderedMembers, true).to.not.have.same.deep.ordered.members(set2);
3205
- };
3206
- assert.includeMembers = function(superset, subset, msg) {
3207
- new Assertion(superset, msg, assert.includeMembers, true).to.include.members(subset);
3208
- };
3209
- assert.notIncludeMembers = function(superset, subset, msg) {
3210
- new Assertion(superset, msg, assert.notIncludeMembers, true).to.not.include.members(subset);
3211
- };
3212
- assert.includeDeepMembers = function(superset, subset, msg) {
3213
- new Assertion(superset, msg, assert.includeDeepMembers, true).to.include.deep.members(subset);
3214
- };
3215
- assert.notIncludeDeepMembers = function(superset, subset, msg) {
3216
- new Assertion(superset, msg, assert.notIncludeDeepMembers, true).to.not.include.deep.members(subset);
3217
- };
3218
- assert.includeOrderedMembers = function(superset, subset, msg) {
3219
- new Assertion(superset, msg, assert.includeOrderedMembers, true).to.include.ordered.members(subset);
3220
- };
3221
- assert.notIncludeOrderedMembers = function(superset, subset, msg) {
3222
- new Assertion(superset, msg, assert.notIncludeOrderedMembers, true).to.not.include.ordered.members(subset);
3223
- };
3224
- assert.includeDeepOrderedMembers = function(superset, subset, msg) {
3225
- new Assertion(superset, msg, assert.includeDeepOrderedMembers, true).to.include.deep.ordered.members(subset);
3226
- };
3227
- assert.notIncludeDeepOrderedMembers = function(superset, subset, msg) {
3228
- new Assertion(superset, msg, assert.notIncludeDeepOrderedMembers, true).to.not.include.deep.ordered.members(subset);
3229
- };
3230
- assert.oneOf = function(inList, list, msg) {
3231
- new Assertion(inList, msg, assert.oneOf, true).to.be.oneOf(list);
3232
- };
3233
- assert.isIterable = function(obj, msg) {
3234
- if (obj == undefined || !obj[Symbol.iterator]) {
3235
- msg = msg ? `${msg} expected ${inspect2(obj)} to be an iterable` : `expected ${inspect2(obj)} to be an iterable`;
3236
- throw new AssertionError(msg, undefined, assert.isIterable);
3237
- }
3238
- };
3239
- assert.changes = function(fn, obj, prop, msg) {
3240
- if (arguments.length === 3 && typeof obj === "function") {
3241
- msg = prop;
3242
- prop = null;
3243
- }
3244
- new Assertion(fn, msg, assert.changes, true).to.change(obj, prop);
3245
- };
3246
- assert.changesBy = function(fn, obj, prop, delta, msg) {
3247
- if (arguments.length === 4 && typeof obj === "function") {
3248
- let tmpMsg = delta;
3249
- delta = prop;
3250
- msg = tmpMsg;
3251
- } else if (arguments.length === 3) {
3252
- delta = prop;
3253
- prop = null;
3254
- }
3255
- new Assertion(fn, msg, assert.changesBy, true).to.change(obj, prop).by(delta);
3256
- };
3257
- assert.doesNotChange = function(fn, obj, prop, msg) {
3258
- if (arguments.length === 3 && typeof obj === "function") {
3259
- msg = prop;
3260
- prop = null;
3261
- }
3262
- return new Assertion(fn, msg, assert.doesNotChange, true).to.not.change(obj, prop);
3263
- };
3264
- assert.changesButNotBy = function(fn, obj, prop, delta, msg) {
3265
- if (arguments.length === 4 && typeof obj === "function") {
3266
- let tmpMsg = delta;
3267
- delta = prop;
3268
- msg = tmpMsg;
3269
- } else if (arguments.length === 3) {
3270
- delta = prop;
3271
- prop = null;
3272
- }
3273
- new Assertion(fn, msg, assert.changesButNotBy, true).to.change(obj, prop).but.not.by(delta);
3274
- };
3275
- assert.increases = function(fn, obj, prop, msg) {
3276
- if (arguments.length === 3 && typeof obj === "function") {
3277
- msg = prop;
3278
- prop = null;
3279
- }
3280
- return new Assertion(fn, msg, assert.increases, true).to.increase(obj, prop);
3281
- };
3282
- assert.increasesBy = function(fn, obj, prop, delta, msg) {
3283
- if (arguments.length === 4 && typeof obj === "function") {
3284
- let tmpMsg = delta;
3285
- delta = prop;
3286
- msg = tmpMsg;
3287
- } else if (arguments.length === 3) {
3288
- delta = prop;
3289
- prop = null;
3290
- }
3291
- new Assertion(fn, msg, assert.increasesBy, true).to.increase(obj, prop).by(delta);
3292
- };
3293
- assert.doesNotIncrease = function(fn, obj, prop, msg) {
3294
- if (arguments.length === 3 && typeof obj === "function") {
3295
- msg = prop;
3296
- prop = null;
3297
- }
3298
- return new Assertion(fn, msg, assert.doesNotIncrease, true).to.not.increase(obj, prop);
3299
- };
3300
- assert.increasesButNotBy = function(fn, obj, prop, delta, msg) {
3301
- if (arguments.length === 4 && typeof obj === "function") {
3302
- let tmpMsg = delta;
3303
- delta = prop;
3304
- msg = tmpMsg;
3305
- } else if (arguments.length === 3) {
3306
- delta = prop;
3307
- prop = null;
3308
- }
3309
- new Assertion(fn, msg, assert.increasesButNotBy, true).to.increase(obj, prop).but.not.by(delta);
3310
- };
3311
- assert.decreases = function(fn, obj, prop, msg) {
3312
- if (arguments.length === 3 && typeof obj === "function") {
3313
- msg = prop;
3314
- prop = null;
3315
- }
3316
- return new Assertion(fn, msg, assert.decreases, true).to.decrease(obj, prop);
3317
- };
3318
- assert.decreasesBy = function(fn, obj, prop, delta, msg) {
3319
- if (arguments.length === 4 && typeof obj === "function") {
3320
- let tmpMsg = delta;
3321
- delta = prop;
3322
- msg = tmpMsg;
3323
- } else if (arguments.length === 3) {
3324
- delta = prop;
3325
- prop = null;
3326
- }
3327
- new Assertion(fn, msg, assert.decreasesBy, true).to.decrease(obj, prop).by(delta);
3328
- };
3329
- assert.doesNotDecrease = function(fn, obj, prop, msg) {
3330
- if (arguments.length === 3 && typeof obj === "function") {
3331
- msg = prop;
3332
- prop = null;
3333
- }
3334
- return new Assertion(fn, msg, assert.doesNotDecrease, true).to.not.decrease(obj, prop);
3335
- };
3336
- assert.doesNotDecreaseBy = function(fn, obj, prop, delta, msg) {
3337
- if (arguments.length === 4 && typeof obj === "function") {
3338
- let tmpMsg = delta;
3339
- delta = prop;
3340
- msg = tmpMsg;
3341
- } else if (arguments.length === 3) {
3342
- delta = prop;
3343
- prop = null;
3344
- }
3345
- return new Assertion(fn, msg, assert.doesNotDecreaseBy, true).to.not.decrease(obj, prop).by(delta);
3346
- };
3347
- assert.decreasesButNotBy = function(fn, obj, prop, delta, msg) {
3348
- if (arguments.length === 4 && typeof obj === "function") {
3349
- let tmpMsg = delta;
3350
- delta = prop;
3351
- msg = tmpMsg;
3352
- } else if (arguments.length === 3) {
3353
- delta = prop;
3354
- prop = null;
3355
- }
3356
- new Assertion(fn, msg, assert.decreasesButNotBy, true).to.decrease(obj, prop).but.not.by(delta);
3357
- };
3358
- assert.ifError = function(val) {
3359
- if (val) {
3360
- throw val;
3361
- }
3362
- };
3363
- assert.isExtensible = function(obj, msg) {
3364
- new Assertion(obj, msg, assert.isExtensible, true).to.be.extensible;
3365
- };
3366
- assert.isNotExtensible = function(obj, msg) {
3367
- new Assertion(obj, msg, assert.isNotExtensible, true).to.not.be.extensible;
3368
- };
3369
- assert.isSealed = function(obj, msg) {
3370
- new Assertion(obj, msg, assert.isSealed, true).to.be.sealed;
3371
- };
3372
- assert.isNotSealed = function(obj, msg) {
3373
- new Assertion(obj, msg, assert.isNotSealed, true).to.not.be.sealed;
3374
- };
3375
- assert.isFrozen = function(obj, msg) {
3376
- new Assertion(obj, msg, assert.isFrozen, true).to.be.frozen;
3377
- };
3378
- assert.isNotFrozen = function(obj, msg) {
3379
- new Assertion(obj, msg, assert.isNotFrozen, true).to.not.be.frozen;
3380
- };
3381
- assert.isEmpty = function(val, msg) {
3382
- new Assertion(val, msg, assert.isEmpty, true).to.be.empty;
3383
- };
3384
- assert.isNotEmpty = function(val, msg) {
3385
- new Assertion(val, msg, assert.isNotEmpty, true).to.not.be.empty;
3386
- };
3387
- assert.containsSubset = function(val, exp, msg) {
3388
- new Assertion(val, msg).to.containSubset(exp);
3389
- };
3390
- assert.doesNotContainSubset = function(val, exp, msg) {
3391
- new Assertion(val, msg).to.not.containSubset(exp);
3392
- };
3393
- var aliases = [
3394
- ["isOk", "ok"],
3395
- ["isNotOk", "notOk"],
3396
- ["throws", "throw"],
3397
- ["throws", "Throw"],
3398
- ["isExtensible", "extensible"],
3399
- ["isNotExtensible", "notExtensible"],
3400
- ["isSealed", "sealed"],
3401
- ["isNotSealed", "notSealed"],
3402
- ["isFrozen", "frozen"],
3403
- ["isNotFrozen", "notFrozen"],
3404
- ["isEmpty", "empty"],
3405
- ["isNotEmpty", "notEmpty"],
3406
- ["isCallable", "isFunction"],
3407
- ["isNotCallable", "isNotFunction"],
3408
- ["containsSubset", "containSubset"]
3409
- ];
3410
- for (const [name, as] of aliases) {
3411
- assert[as] = assert[name];
3412
- }
3413
- var used = [];
3414
- function use(fn) {
3415
- const exports = {
3416
- use,
3417
- AssertionError,
3418
- util: utils_exports,
3419
- config,
3420
- expect,
3421
- assert,
3422
- Assertion,
3423
- ...should_exports
3424
- };
3425
- if (!~used.indexOf(fn)) {
3426
- fn(exports, utils_exports);
3427
- used.push(fn);
3428
- }
3429
- return exports;
3430
- }
3431
- __name(use, "use");
3432
-
3433
- // src/anode.js
3434
- var exports_anode = {};
3435
- __export(exports_anode, {
3436
- compileModifiers: () => compileModifiers,
3437
- WrapperNode: () => WrapperNode,
3438
- View: () => View,
3439
- TextNode: () => TextNode,
3440
- SlotNode: () => SlotNode,
3441
- ShowNode: () => ShowNode,
3442
- ScopeNode: () => ScopeNode,
3443
- RenderTextNode: () => RenderTextNode,
3444
- RenderOnceNode: () => RenderOnceNode,
3445
- RenderNode: () => RenderNode,
3446
- RenderItNode: () => RenderItNode,
3447
- RenderEachNode: () => RenderEachNode,
3448
- PushViewNameNode: () => PushViewNameNode,
3449
- ParseContext: () => ParseContext,
3450
- NodeEvents: () => NodeEvents,
3451
- MacroNode: () => MacroNode,
3452
- Macro: () => Macro,
3453
- MOD_WRAPPERS_BY_EVENT: () => MOD_WRAPPERS_BY_EVENT,
3454
- IterInfo: () => IterInfo,
3455
- HideNode: () => HideNode,
3456
- FragmentNode: () => FragmentNode,
3457
- EachNode: () => EachNode,
3458
- DomNode: () => DomNode,
3459
- CommentNode: () => CommentNode,
3460
- BaseNode: () => BaseNode,
3461
- ANode: () => ANode
3462
- });
1
+ // dev.js
2
+ import { expect } from "chai";
3463
3
 
3464
4
  // src/value.js
3465
5
  import { is } from "immutable";
@@ -3800,8 +340,8 @@ class Path {
3800
340
  return [new Path(pathSteps.reverse()), handlers];
3801
341
  }
3802
342
  static fromEvent(e, rNode, maxDepth, comps, stopOnNoEvent = true) {
3803
- const { type: type3, target } = e;
3804
- return Path.fromNodeAndEventName(target, type3, rNode, maxDepth, comps, stopOnNoEvent);
343
+ const { type, target } = e;
344
+ return Path.fromNodeAndEventName(target, type, rNode, maxDepth, comps, stopOnNoEvent);
3805
345
  }
3806
346
  }
3807
347
  function metaChain(n) {
@@ -4242,8 +782,8 @@ class HandlerNameVal extends NameVal {
4242
782
  return stack.getHandlerFor(this.name, this.namespace) ?? mk404Handler(this.namespace, this.name);
4243
783
  }
4244
784
  }
4245
- var mk404Handler = (type3, name) => function(...args) {
4246
- console.warn("handler not found", { type: type3, name, args }, this);
785
+ var mk404Handler = (type, name) => function(...args) {
786
+ console.warn("handler not found", { type, name, args }, this);
4247
787
  return this;
4248
788
  };
4249
789
 
@@ -4860,13 +1400,13 @@ function diffProps(a, b) {
4860
1400
  function morphNode(domNode, source, target, opts) {
4861
1401
  if (source === target || source.isEqualTo(target))
4862
1402
  return domNode;
4863
- const type3 = source.nodeType;
4864
- if (type3 === target.nodeType) {
4865
- if (type3 === 3 || type3 === 8) {
1403
+ const type = source.nodeType;
1404
+ if (type === target.nodeType) {
1405
+ if (type === 3 || type === 8) {
4866
1406
  domNode.data = target.text;
4867
1407
  return domNode;
4868
1408
  }
4869
- if (type3 === 1 && source.isSameKind(target)) {
1409
+ if (type === 1 && source.isSameKind(target)) {
4870
1410
  const propsDiff = diffProps(source.attrs, target.attrs);
4871
1411
  let pendingValue;
4872
1412
  let pendingChecked;
@@ -4901,7 +1441,7 @@ function morphNode(domNode, source, target, opts) {
4901
1441
  setProp(domNode, "checked", pendingChecked, false);
4902
1442
  return domNode;
4903
1443
  }
4904
- if (type3 === 11) {
1444
+ if (type === 11) {
4905
1445
  morphChildren(domNode, source.childs, target.childs, opts);
4906
1446
  return domNode;
4907
1447
  }
@@ -4944,18 +1484,18 @@ function morphChildren(parentDom, oldChilds, newChilds, opts) {
4944
1484
  if (key != null)
4945
1485
  oldKeyMap[key] = i;
4946
1486
  }
4947
- const used2 = new Uint8Array(oldChilds.length);
1487
+ const used = new Uint8Array(oldChilds.length);
4948
1488
  let unkeyedCursor = 0;
4949
1489
  for (let j = 0;j < newChilds.length; j++) {
4950
1490
  const newChild = newChilds[j];
4951
1491
  const newKey = getKey(newChild);
4952
1492
  let oldIdx = -1;
4953
1493
  if (newKey != null) {
4954
- if (newKey in oldKeyMap && !used2[oldKeyMap[newKey]])
1494
+ if (newKey in oldKeyMap && !used[oldKeyMap[newKey]])
4955
1495
  oldIdx = oldKeyMap[newKey];
4956
1496
  } else {
4957
1497
  while (unkeyedCursor < oldChilds.length) {
4958
- if (!used2[unkeyedCursor] && getKey(oldChilds[unkeyedCursor]) == null) {
1498
+ if (!used[unkeyedCursor] && getKey(oldChilds[unkeyedCursor]) == null) {
4959
1499
  oldIdx = unkeyedCursor++;
4960
1500
  break;
4961
1501
  }
@@ -4963,7 +1503,7 @@ function morphChildren(parentDom, oldChilds, newChilds, opts) {
4963
1503
  }
4964
1504
  }
4965
1505
  if (oldIdx >= 0) {
4966
- used2[oldIdx] = 1;
1506
+ used[oldIdx] = 1;
4967
1507
  const newDom = morphNode(domNodes[oldIdx], oldChilds[oldIdx], newChild, opts);
4968
1508
  const ref = parentDom.childNodes[j] ?? null;
4969
1509
  if (newDom !== ref)
@@ -4974,7 +1514,7 @@ function morphChildren(parentDom, oldChilds, newChilds, opts) {
4974
1514
  }
4975
1515
  }
4976
1516
  for (let i = oldChilds.length - 1;i >= 0; i--)
4977
- if (!used2[i] && domNodes[i].parentNode === parentDom)
1517
+ if (!used[i] && domNodes[i].parentNode === parentDom)
4978
1518
  parentDom.removeChild(domNodes[i]);
4979
1519
  }
4980
1520
  function render(vnode, container, options, prev) {
@@ -5566,9 +2106,9 @@ var WRAPPER_NODES = {
5566
2106
  };
5567
2107
 
5568
2108
  class ParseContext {
5569
- constructor(document2, Text, Comment, nodes, events2, macroNodes, frame, parent) {
2109
+ constructor(document2, Text, Comment, nodes, events, macroNodes, frame, parent) {
5570
2110
  this.nodes = nodes ?? [];
5571
- this.events = events2 ?? [];
2111
+ this.events = events ?? [];
5572
2112
  this.macroNodes = macroNodes ?? [];
5573
2113
  this.parent = parent ?? null;
5574
2114
  this.frame = frame ?? {};
@@ -5582,9 +2122,9 @@ class ParseContext {
5582
2122
  return this.frame.macroName === name || this.parent?.isInsideMacro(name);
5583
2123
  }
5584
2124
  enterMacro(macroName, macroVars, macroSlots) {
5585
- const { document: document2, Text, Comment, nodes, events: events2, macroNodes } = this;
2125
+ const { document: document2, Text, Comment, nodes, events, macroNodes } = this;
5586
2126
  const frame = { macroName, macroVars, macroSlots };
5587
- return new ParseContext(document2, Text, Comment, nodes, events2, macroNodes, frame, this);
2127
+ return new ParseContext(document2, Text, Comment, nodes, events, macroNodes, frame, this);
5588
2128
  }
5589
2129
  parseHTML(html) {
5590
2130
  const t = this.document.createElement("template");
@@ -5602,9 +2142,9 @@ class ParseContext {
5602
2142
  }
5603
2143
  registerEvents() {
5604
2144
  const id = this.events.length;
5605
- const events2 = new NodeEvents(id);
5606
- this.events.push(events2);
5607
- return events2;
2145
+ const events = new NodeEvents(id);
2146
+ this.events.push(events);
2147
+ return events;
5608
2148
  }
5609
2149
  newMacroNode(macroName, mAttrs, childs) {
5610
2150
  const anySlot = [];
@@ -5762,11 +2302,6 @@ function compileModifiers(eventName, names) {
5762
2302
  }
5763
2303
 
5764
2304
  // src/util/parsectx.js
5765
- var exports_parsectx = {};
5766
- __export(exports_parsectx, {
5767
- collectAppClassesInSet: () => collectAppClassesInSet,
5768
- ParseCtxClassSetCollector: () => ParseCtxClassSetCollector
5769
- });
5770
2305
  class ParseCtxClassSetCollector extends ParseContext {
5771
2306
  constructor(...args) {
5772
2307
  super(...args);
@@ -5778,9 +2313,9 @@ class ParseCtxClassSetCollector extends ParseContext {
5778
2313
  }
5779
2314
  }
5780
2315
  enterMacro(macroName, macroVars, macroSlots) {
5781
- const { document: document2, Text, Comment, nodes, events: events2, macroNodes } = this;
2316
+ const { document: document2, Text, Comment, nodes, events, macroNodes } = this;
5782
2317
  const frame = { macroName, macroVars, macroSlots };
5783
- const v = new ParseCtxClassSetCollector(document2, Text, Comment, nodes, events2, macroNodes, frame, this);
2318
+ const v = new ParseCtxClassSetCollector(document2, Text, Comment, nodes, events, macroNodes, frame, this);
5784
2319
  v.classes = this.classes;
5785
2320
  return v;
5786
2321
  }
@@ -5822,58 +2357,6 @@ class ParseCtxClassSetCollector extends ParseContext {
5822
2357
  return false;
5823
2358
  }
5824
2359
  }
5825
- function collectAppClassesInSet(app) {
5826
- const classes = new Set;
5827
- for (const Comp of app.comps.byId.values()) {
5828
- for (const key in Comp.views) {
5829
- const view = Comp.views[key];
5830
- for (const name of view.ctx.classes) {
5831
- classes.add(name);
5832
- }
5833
- }
5834
- }
5835
- return classes;
5836
- }
5837
-
5838
- // tools/core/lint-check.js
5839
- var exports_lint_check = {};
5840
- __export(exports_lint_check, {
5841
- checkComponent: () => checkComponent,
5842
- UNSUPPORTED_EXPR_SYNTAX: () => UNSUPPORTED_EXPR_SYNTAX,
5843
- UNKNOWN_X_OP: () => UNKNOWN_X_OP,
5844
- UNKNOWN_X_ATTR: () => UNKNOWN_X_ATTR,
5845
- UNKNOWN_REQUEST_NAME: () => UNKNOWN_REQUEST_NAME,
5846
- UNKNOWN_MACRO_ARG: () => UNKNOWN_MACRO_ARG,
5847
- UNKNOWN_HANDLER_ARG_NAME: () => UNKNOWN_HANDLER_ARG_NAME,
5848
- UNKNOWN_EVENT_MODIFIER: () => UNKNOWN_EVENT_MODIFIER,
5849
- UNKNOWN_DIRECTIVE: () => UNKNOWN_DIRECTIVE,
5850
- UNKNOWN_COMPONENT_SPEC_KEY: () => UNKNOWN_COMPONENT_SPEC_KEY,
5851
- UNKNOWN_COMPONENT_NAME: () => UNKNOWN_COMPONENT_NAME,
5852
- RENDER_IT_OUTSIDE_OF_LOOP: () => RENDER_IT_OUTSIDE_OF_LOOP,
5853
- REDUNDANT_TEMPLATE_STRING: () => REDUNDANT_TEMPLATE_STRING,
5854
- PLACEHOLDERLESS_TEMPLATE_STRING: () => PLACEHOLDERLESS_TEMPLATE_STRING,
5855
- METHOD_VAL_NOT_DEFINED: () => METHOD_VAL_NOT_DEFINED,
5856
- METHOD_VAL_IS_FIELD: () => METHOD_VAL_IS_FIELD,
5857
- MAYBE_DROP_AT_PREFIX: () => MAYBE_DROP_AT_PREFIX,
5858
- MAYBE_ADD_AT_PREFIX: () => MAYBE_ADD_AT_PREFIX,
5859
- LintParseContext: () => LintParseContext,
5860
- LintContext: () => LintContext,
5861
- INPUT_HANDLER_NOT_REFERENCED: () => INPUT_HANDLER_NOT_REFERENCED,
5862
- INPUT_HANDLER_NOT_IMPLEMENTED: () => INPUT_HANDLER_NOT_IMPLEMENTED,
5863
- INPUT_HANDLER_METHOD_NOT_IMPLEMENTED: () => INPUT_HANDLER_METHOD_NOT_IMPLEMENTED,
5864
- INPUT_HANDLER_METHOD_FOR_INPUT_HANDLER: () => INPUT_HANDLER_METHOD_FOR_INPUT_HANDLER,
5865
- INPUT_HANDLER_FOR_INPUT_HANDLER_METHOD: () => INPUT_HANDLER_FOR_INPUT_HANDLER_METHOD,
5866
- IF_NO_BRANCH_SET: () => IF_NO_BRANCH_SET,
5867
- FIELD_VAL_NOT_DEFINED: () => FIELD_VAL_NOT_DEFINED,
5868
- FIELD_VAL_IS_METHOD: () => FIELD_VAL_IS_METHOD,
5869
- DYN_VAL_NOT_DEFINED: () => DYN_VAL_NOT_DEFINED,
5870
- DYN_ALIAS_NOT_REFERENCED: () => DYN_ALIAS_NOT_REFERENCED,
5871
- DUPLICATE_ATTR_DEFINITION: () => DUPLICATE_ATTR_DEFINITION,
5872
- COMP_FIELD_BAD_SHAPE: () => COMP_FIELD_BAD_SHAPE,
5873
- BAD_VALUE: () => BAD_VALUE,
5874
- ALT_HANDLER_NOT_REFERENCED: () => ALT_HANDLER_NOT_REFERENCED,
5875
- ALT_HANDLER_NOT_DEFINED: () => ALT_HANDLER_NOT_DEFINED
5876
- });
5877
2360
 
5878
2361
  // tools/core/html-tokenizer.js
5879
2362
  var CharCodes = {
@@ -7681,8 +4164,8 @@ class LinterCtx {
7681
4164
  return this.startInBody(name, raw, selfClosing, start, endIndex);
7682
4165
  }
7683
4166
  if (name === "input") {
7684
- const type3 = (this.getAttr("type") ?? "").toLowerCase();
7685
- if (type3 === "hidden")
4167
+ const type = (this.getAttr("type") ?? "").toLowerCase();
4168
+ if (type === "hidden")
7686
4169
  return;
7687
4170
  this.report(HTML_TAG_NOT_ALLOWED_IN_PARENT, LEVEL_WARN, start, {
7688
4171
  tag: raw,
@@ -8813,32 +5296,7 @@ class LintParseContext extends ParseContext {
8813
5296
  }
8814
5297
  }
8815
5298
 
8816
- // tools/core/test.js
8817
- var exports_test = {};
8818
- __export(exports_test, {
8819
- runTests: () => runTests
8820
- });
8821
-
8822
5299
  // tools/core/results.js
8823
- var exports_results = {};
8824
- __export(exports_results, {
8825
- TestResult: () => TestResult,
8826
- TestReport: () => TestReport,
8827
- RenderedSection: () => RenderedSection,
8828
- RenderedExample: () => RenderedExample,
8829
- RenderBatch: () => RenderBatch,
8830
- ModuleTestReport: () => ModuleTestReport,
8831
- ModuleInfo: () => ModuleInfo,
8832
- LintReport: () => LintReport,
8833
- LintFinding: () => LintFinding,
8834
- LintComponentResult: () => LintComponentResult,
8835
- ExampleIndex: () => ExampleIndex,
8836
- DescribeResult: () => DescribeResult,
8837
- ComponentSummary: () => ComponentSummary,
8838
- ComponentList: () => ComponentList,
8839
- ComponentDocs: () => ComponentDocs
8840
- });
8841
-
8842
5300
  class ModuleInfo {
8843
5301
  constructor({ path = null, present = new Set, counts = {}, warnings = [] }) {
8844
5302
  this.path = path;
@@ -8989,15 +5447,6 @@ class TestReport {
8989
5447
  }
8990
5448
 
8991
5449
  // tools/core/tests.js
8992
- var exports_tests = {};
8993
- __export(exports_tests, {
8994
- makeCollector: () => makeCollector,
8995
- TestIndex: () => TestIndex,
8996
- Test: () => Test,
8997
- ModuleTests: () => ModuleTests,
8998
- Describe: () => Describe
8999
- });
9000
-
9001
5450
  class Describe {
9002
5451
  constructor({ title, componentName = null, parent = null }) {
9003
5452
  this.title = title;
@@ -9096,7 +5545,7 @@ function makeCollector({ path = null, components = [] } = {}) {
9096
5545
  stack.pop();
9097
5546
  }
9098
5547
  }
9099
- function test2(title, fn) {
5548
+ function test(title, fn) {
9100
5549
  if (typeof title !== "string") {
9101
5550
  throw new Error("test(title, fn): title must be a string");
9102
5551
  }
@@ -9114,7 +5563,7 @@ function makeCollector({ path = null, components = [] } = {}) {
9114
5563
  parent
9115
5564
  }));
9116
5565
  }
9117
- return { describe, test: test2, moduleTests };
5566
+ return { describe, test, moduleTests };
9118
5567
  }
9119
5568
 
9120
5569
  // tools/core/test.js
@@ -9139,7 +5588,7 @@ async function runTests({
9139
5588
  getTests,
9140
5589
  components = [],
9141
5590
  path = null,
9142
- expect: expect2,
5591
+ expect,
9143
5592
  name = null,
9144
5593
  grep = null,
9145
5594
  bail = false
@@ -9150,11 +5599,11 @@ async function runTests({
9150
5599
  modules: [new ModuleTestReport({ path, suites: [], counts })]
9151
5600
  });
9152
5601
  }
9153
- if (typeof expect2 !== "function") {
5602
+ if (typeof expect !== "function") {
9154
5603
  throw new Error("runTests: expect must be provided (e.g. chai's expect)");
9155
5604
  }
9156
- const { describe, test: test2, moduleTests } = makeCollector({ path, components });
9157
- await getTests({ describe, test: test2, expect: expect2 });
5605
+ const { describe, test, moduleTests } = makeCollector({ path, components });
5606
+ await getTests({ describe, test, expect });
9158
5607
  let bailed = false;
9159
5608
  async function visit(node) {
9160
5609
  if (node instanceof Test) {
@@ -9224,10 +5673,6 @@ async function runTests({
9224
5673
  }
9225
5674
 
9226
5675
  // tools/core/test-console.js
9227
- var exports_test_console = {};
9228
- __export(exports_test_console, {
9229
- reportTestReportToConsole: () => reportTestReportToConsole
9230
- });
9231
5676
  var PASS = "color: #0a0; font-weight: bold";
9232
5677
  var FAIL = "color: #c00; font-weight: bold";
9233
5678
  var SKIP = "color: #888";
@@ -9283,11 +5728,6 @@ function reportTestReportToConsole(report) {
9283
5728
  }
9284
5729
 
9285
5730
  // tools/format/lint.js
9286
- var exports_lint = {};
9287
- __export(exports_lint, {
9288
- suggestionToMessage: () => suggestionToMessage,
9289
- lintIdToMessage: () => lintIdToMessage
9290
- });
9291
5731
  var UNSUPPORTED_EXPR_LABEL = {
9292
5732
  "legacy-template": "string template",
9293
5733
  ternary: "ternary expression",
@@ -9523,47 +5963,7 @@ function htmlActionPhrase(action, tag, parent) {
9523
5963
  }
9524
5964
  }
9525
5965
 
9526
- // extra.js
9527
- var exports_extra = {};
9528
- __export(exports_extra, {
9529
- tutuca: () => tutuca,
9530
- test: () => test2,
9531
- macro: () => macro,
9532
- isOMap: () => isOrderedMap,
9533
- isIMap: () => isMap,
9534
- injectCss: () => injectCss,
9535
- html: () => html,
9536
- css: () => css,
9537
- component: () => component,
9538
- compileClassesToStyleText: () => compileClassesToStyleText,
9539
- compileClassesToStyle: () => compileClassesToStyle,
9540
- collectIterBindings: () => collectIterBindings,
9541
- check: () => check,
9542
- SEQ_INFO: () => SEQ_INFO,
9543
- ParseContext: () => ParseContext,
9544
- OMap: () => OrderedMap2,
9545
- KList: () => KList,
9546
- ISet: () => Set2,
9547
- IMap: () => Map2,
9548
- FIELD_CLASS: () => FIELD_CLASS
9549
- });
9550
-
9551
- // src/app.js
9552
- var exports_app = {};
9553
- __export(exports_app, {
9554
- injectCss: () => injectCss,
9555
- App: () => App
9556
- });
9557
-
9558
5966
  // src/components.js
9559
- var exports_components = {};
9560
- __export(exports_components, {
9561
- DynamicAlias: () => DynamicAlias,
9562
- Dynamic: () => Dynamic,
9563
- Components: () => Components,
9564
- ComponentStack: () => ComponentStack,
9565
- Component: () => Component
9566
- });
9567
5967
  class Components {
9568
5968
  constructor() {
9569
5969
  this.getComponentSymbol = Symbol("getComponent");
@@ -9589,10 +5989,10 @@ class Components {
9589
5989
  return this.getCompFor(v)?.scope.lookupRequest(name) ?? null;
9590
5990
  }
9591
5991
  compileStyles() {
9592
- const styles2 = [];
5992
+ const styles = [];
9593
5993
  for (const comp of this.byId.values())
9594
- styles2.push(comp.compileStyle());
9595
- return styles2.join(`
5994
+ styles.push(comp.compileStyle());
5995
+ return styles.join(`
9596
5996
  `);
9597
5997
  }
9598
5998
  }
@@ -9609,20 +6009,20 @@ class ComponentStack {
9609
6009
  return new ComponentStack(this.comps, this);
9610
6010
  }
9611
6011
  registerComponents(comps, opts) {
9612
- const { aliases: aliases2 = {} } = opts ?? {};
6012
+ const { aliases = {} } = opts ?? {};
9613
6013
  for (let i = 0;i < comps.length; i++) {
9614
6014
  const comp = comps[i];
9615
6015
  comp.scope = this.enter();
9616
6016
  this.comps.registerComponent(comp);
9617
6017
  this.byName[comp.name] = comp;
9618
6018
  }
9619
- for (const alias in aliases2) {
9620
- const comp = this.byName[aliases2[alias]];
6019
+ for (const alias in aliases) {
6020
+ const comp = this.byName[aliases[alias]];
9621
6021
  console.assert(this.byName[alias] === undefined, "alias overrides component", alias);
9622
6022
  if (comp !== undefined)
9623
6023
  this.byName[alias] = comp;
9624
6024
  else
9625
- console.warn("alias", alias, "to inexistent component", aliases2[alias]);
6025
+ console.warn("alias", alias, "to inexistent component", aliases[alias]);
9626
6026
  }
9627
6027
  }
9628
6028
  registerMacros(macros) {
@@ -9740,15 +6140,15 @@ class Component {
9740
6140
  }
9741
6141
  compileStyle() {
9742
6142
  const { id, commonStyle, globalStyle, views } = this;
9743
- const styles2 = commonStyle ? [`[data-cid="${id}"]{${commonStyle}}`] : [];
6143
+ const styles = commonStyle ? [`[data-cid="${id}"]{${commonStyle}}`] : [];
9744
6144
  if (globalStyle !== "")
9745
- styles2.push(globalStyle);
6145
+ styles.push(globalStyle);
9746
6146
  for (const name in views) {
9747
6147
  const { style } = views[name];
9748
6148
  if (style !== "")
9749
- styles2.push(`[data-cid="${id}"][data-vid="${name}"]{${style}}`);
6149
+ styles.push(`[data-cid="${id}"][data-vid="${name}"]{${style}}`);
9750
6150
  }
9751
- return styles2.join(`
6151
+ return styles.join(`
9752
6152
  `);
9753
6153
  }
9754
6154
  }
@@ -10256,27 +6656,27 @@ class App {
10256
6656
  return this.transactor.state;
10257
6657
  }
10258
6658
  handleEvent(e) {
10259
- const { type: type3 } = e;
10260
- if (type3[0] === "t" && type3.startsWith("touch")) {
6659
+ const { type } = e;
6660
+ if (type[0] === "t" && type.startsWith("touch")) {
10261
6661
  this._handleTouchEvent(e);
10262
6662
  return;
10263
6663
  }
10264
6664
  this._dispatchEvent(e);
10265
6665
  }
10266
6666
  _dispatchEvent(e) {
10267
- const { type: type3 } = e;
10268
- const isDrag = type3 === "dragover" || type3 === "dragstart" || type3 === "dragend" || type3 === "drop";
6667
+ const { type } = e;
6668
+ const isDrag = type === "dragover" || type === "dragstart" || type === "dragend" || type === "drop";
10269
6669
  const { rootNode: root, maxEventNodeDepth: maxDepth, comps, transactor } = this;
10270
6670
  const [path, handlers] = Path.fromEvent(e, root, maxDepth, comps, !isDrag);
10271
6671
  if (isDrag)
10272
- this._handleDragEvent(e, type3, path);
6672
+ this._handleDragEvent(e, type, path);
10273
6673
  if (path !== null && handlers !== null)
10274
6674
  for (const handler of handlers)
10275
6675
  transactor.transactInputNow(path, e, handler, this.dragInfo);
10276
6676
  }
10277
6677
  _handleTouchEvent(e) {
10278
- const { type: type3 } = e;
10279
- if (type3 === "touchstart") {
6678
+ const { type } = e;
6679
+ if (type === "touchstart") {
10280
6680
  if (this._touch !== null || e.touches.length !== 1)
10281
6681
  return;
10282
6682
  const t = e.touches[0];
@@ -10293,11 +6693,11 @@ class App {
10293
6693
  return;
10294
6694
  const { rootNode, _touch } = this;
10295
6695
  const { clientX, clientY } = touch;
10296
- const fire = (type4, target) => {
10297
- const e2 = { type: type4, target, clientX, clientY, preventDefault: NOOP };
6696
+ const fire = (type2, target) => {
6697
+ const e2 = { type: type2, target, clientX, clientY, preventDefault: NOOP };
10298
6698
  this._dispatchEvent(e2);
10299
6699
  };
10300
- if (type3 === "touchmove") {
6700
+ if (type === "touchmove") {
10301
6701
  if (!_touch.active) {
10302
6702
  const dx = clientX - _touch.startX;
10303
6703
  const dy = clientY - _touch.startY;
@@ -10312,17 +6712,17 @@ class App {
10312
6712
  }
10313
6713
  return;
10314
6714
  }
10315
- if (type3 === "touchend" || type3 === "touchcancel") {
6715
+ if (type === "touchend" || type === "touchcancel") {
10316
6716
  if (_touch.active) {
10317
- if (type3 === "touchend")
6717
+ if (type === "touchend")
10318
6718
  fire("drop", hitTest(rootNode, clientX, clientY));
10319
6719
  fire("dragend", _touch.target);
10320
6720
  }
10321
6721
  this._touch = null;
10322
6722
  }
10323
6723
  }
10324
- _handleDragEvent(e, type3, path) {
10325
- if (type3 === "dragover") {
6724
+ _handleDragEvent(e, type, path) {
6725
+ if (type === "dragover") {
10326
6726
  const dropTarget = getClosestDropTarget(e.target, this.rootNode, Infinity);
10327
6727
  if (dropTarget !== null) {
10328
6728
  e.preventDefault();
@@ -10330,7 +6730,7 @@ class App {
10330
6730
  this.curDragOver = dropTarget;
10331
6731
  dropTarget.dataset.draggingover = this.dragInfo?.type ?? "_external";
10332
6732
  }
10333
- } else if (type3 === "dragstart") {
6733
+ } else if (type === "dragstart") {
10334
6734
  e.target.dataset.dragging = 1;
10335
6735
  const rootValue = this.state.val;
10336
6736
  const txnPath = path.compact().toTransactionPath();
@@ -10338,7 +6738,7 @@ class App {
10338
6738
  const dragType = e.target.dataset.dragtype ?? "?";
10339
6739
  const stack = path.toTransactionPath().buildStack(this.makeStack(rootValue));
10340
6740
  this.dragInfo = new DragInfo(txnPath, stack, e, value, dragType, e.target);
10341
- } else if (type3 === "drop") {
6741
+ } else if (type === "drop") {
10342
6742
  e.preventDefault();
10343
6743
  this._cleanDragOverAttrs();
10344
6744
  } else {
@@ -10478,12 +6878,12 @@ function getClosestDropTarget(target, rootNode, count) {
10478
6878
  }
10479
6879
 
10480
6880
  class DragInfo {
10481
- constructor(path, stack, e, val, type3, node) {
6881
+ constructor(path, stack, e, val, type, node) {
10482
6882
  this.path = path;
10483
6883
  this.stack = stack;
10484
6884
  this.e = e;
10485
6885
  this.val = val;
10486
- this.type = type3;
6886
+ this.type = type;
10487
6887
  this.node = node;
10488
6888
  }
10489
6889
  lookupBind(name) {
@@ -10492,41 +6892,16 @@ class DragInfo {
10492
6892
  }
10493
6893
 
10494
6894
  // extra/klist.js
10495
- var exports_klist = {};
10496
- __export(exports_klist, {
10497
- KList: () => KList,
10498
- FieldKList: () => FieldKList
10499
- });
10500
6895
  import { Map as IMap2, List as List2 } from "immutable";
10501
6896
 
10502
6897
  // src/oo.js
10503
- var exports_oo = {};
10504
- __export(exports_oo, {
10505
- getTypeName: () => getTypeName,
10506
- fieldsByTypeName: () => fieldsByTypeName,
10507
- extendProtoForKeyed: () => extendProtoForKeyed,
10508
- component: () => component,
10509
- classFromData: () => classFromData,
10510
- FieldString: () => FieldString,
10511
- FieldSet: () => FieldSet,
10512
- FieldOMap: () => FieldOMap,
10513
- FieldMap: () => FieldMap,
10514
- FieldList: () => FieldList,
10515
- FieldInt: () => FieldInt,
10516
- FieldFloat: () => FieldFloat,
10517
- FieldComp: () => FieldComp,
10518
- FieldBool: () => FieldBool,
10519
- FieldAny: () => FieldAny,
10520
- Field: () => Field,
10521
- FIELD_CLASS: () => FIELD_CLASS
10522
- });
10523
6898
  import { Map as IMap, Set as ISet, List, OrderedMap, Record } from "immutable";
10524
6899
  var BAD_VALUE2 = Symbol("BadValue");
10525
6900
  var nullCoercer = (v) => v;
10526
6901
 
10527
6902
  class Field {
10528
- constructor(type3, name, typeCheck, coercer, defaultValue = null) {
10529
- this.type = type3;
6903
+ constructor(type, name, typeCheck, coercer, defaultValue = null) {
6904
+ this.type = type;
10530
6905
  this.name = name;
10531
6906
  this.typeCheck = typeCheck;
10532
6907
  this.coercer = coercer;
@@ -10534,8 +6909,8 @@ class Field {
10534
6909
  this.defaultValue = defaultValue;
10535
6910
  }
10536
6911
  toDataDef() {
10537
- const { type: type3, defaultValue: dv } = this;
10538
- return { type: type3, defaultValue: dv?.toJS ? dv.toJS() : dv };
6912
+ const { type, defaultValue: dv } = this;
6913
+ return { type, defaultValue: dv?.toJS ? dv.toJS() : dv };
10539
6914
  }
10540
6915
  getFirstFailingCheck(v) {
10541
6916
  if (!this.typeCheck.isValid(v))
@@ -10642,8 +7017,8 @@ class FieldAny extends Field {
10642
7017
  }
10643
7018
  toDataDef() {
10644
7019
  const { defaultValue: dv } = this;
10645
- const type3 = getTypeName(dv) ?? "any";
10646
- return { type: type3, defaultValue: dv?.toJS ? dv.toJS() : dv };
7020
+ const type = getTypeName(dv) ?? "any";
7021
+ return { type, defaultValue: dv?.toJS ? dv.toJS() : dv };
10647
7022
  }
10648
7023
  }
10649
7024
  var stringCoercer = (v) => v?.toString?.() ?? "";
@@ -10686,8 +7061,8 @@ class CheckTypeName {
10686
7061
  }
10687
7062
 
10688
7063
  class FieldComp extends Field {
10689
- constructor(type3, name, args) {
10690
- super(type3, name, new CheckTypeName(type3), nullCoercer, null);
7064
+ constructor(type, name, args) {
7065
+ super(type, name, new CheckTypeName(type), nullCoercer, null);
10691
7066
  this.args = args;
10692
7067
  }
10693
7068
  toDataDef() {
@@ -10846,8 +7221,8 @@ class ClassBuilder {
10846
7221
  this.fields[name] = field;
10847
7222
  return field;
10848
7223
  }
10849
- addCompField(name, type3, args) {
10850
- const field = new FieldComp(type3, name, args);
7224
+ addCompField(name, type, args) {
7225
+ const field = new FieldComp(type, name, args);
10851
7226
  this.compFields.add(name);
10852
7227
  this.fields[name] = field;
10853
7228
  return field;
@@ -10869,12 +7244,12 @@ function classFromData(name, { fields = {}, methods, statics }) {
10869
7244
  const b = new ClassBuilder(name);
10870
7245
  for (const field in fields) {
10871
7246
  const value = fields[field];
10872
- const type3 = typeof value;
10873
- if (type3 === "string")
7247
+ const type = typeof value;
7248
+ if (type === "string")
10874
7249
  b.addField(field, value, FieldString);
10875
- else if (type3 === "number")
7250
+ else if (type === "number")
10876
7251
  b.addField(field, value, FieldFloat);
10877
- else if (type3 === "boolean")
7252
+ else if (type === "boolean")
10878
7253
  b.addField(field, value, FieldBool);
10879
7254
  else if (List.isList(value) || Array.isArray(value))
10880
7255
  b.addField(field, List(value), FieldList);
@@ -10903,15 +7278,6 @@ function classFromData(name, { fields = {}, methods, statics }) {
10903
7278
  var component = (opts) => new Component(classFromData(opts.name, opts), opts);
10904
7279
 
10905
7280
  // src/renderer.js
10906
- var exports_renderer = {};
10907
- __export(exports_renderer, {
10908
- unpackLoopResult: () => unpackLoopResult,
10909
- normalizeRange: () => normalizeRange,
10910
- getSeqInfo: () => getSeqInfo,
10911
- SEQ_INFO: () => SEQ_INFO,
10912
- Renderer: () => Renderer,
10913
- DATASET_ATTRS: () => DATASET_ATTRS
10914
- });
10915
7281
  import { isIndexed, isKeyed } from "immutable";
10916
7282
 
10917
7283
  // src/cache.js
@@ -11230,48 +7596,62 @@ KList.prototype[SEQ_INFO] = (seq, visit) => {
11230
7596
  visit(k, seq.items.get(k), "data-sk");
11231
7597
  };
11232
7598
  // index.js
11233
- var exports_tutuca = {};
11234
- __export(exports_tutuca, {
11235
- tutuca: () => tutuca,
11236
- test: () => test2,
11237
- macro: () => macro,
11238
- isOMap: () => isOrderedMap,
11239
- isIMap: () => isMap,
11240
- injectCss: () => injectCss,
11241
- html: () => html,
11242
- css: () => css,
11243
- component: () => component,
11244
- collectIterBindings: () => collectIterBindings,
11245
- check: () => check,
11246
- SEQ_INFO: () => SEQ_INFO,
11247
- ParseContext: () => ParseContext,
11248
- OMap: () => OrderedMap2,
11249
- ISet: () => Set2,
11250
- IMap: () => Map2,
11251
- FIELD_CLASS: () => FIELD_CLASS
11252
- });
11253
- __reExport(exports_tutuca, immutable);
11254
- import"immutable";
11255
7599
  import {
11256
- isMap,
11257
- isOrderedMap,
7600
+ Collection,
7601
+ List as List3,
11258
7602
  Map as Map2,
11259
7603
  OrderedMap as OrderedMap2,
11260
- Set as Set2
7604
+ OrderedSet,
7605
+ PairSorting,
7606
+ Range,
7607
+ Record as Record2,
7608
+ Repeat,
7609
+ Seq,
7610
+ Set as Set2,
7611
+ Stack as Stack2,
7612
+ fromJS,
7613
+ get,
7614
+ getIn,
7615
+ has,
7616
+ hasIn,
7617
+ hash,
7618
+ is as is2,
7619
+ isAssociative,
7620
+ isCollection,
7621
+ isImmutable,
7622
+ isIndexed as isIndexed2,
7623
+ isKeyed as isKeyed2,
7624
+ isList,
7625
+ isMap,
7626
+ isOrdered,
7627
+ isOrderedMap,
7628
+ isOrderedSet,
7629
+ isPlainObject,
7630
+ isRecord,
7631
+ isSeq,
7632
+ isSet,
7633
+ isStack,
7634
+ isValueObject,
7635
+ merge,
7636
+ mergeDeep,
7637
+ mergeDeepWith,
7638
+ mergeWith,
7639
+ remove,
7640
+ removeIn,
7641
+ set,
7642
+ setIn,
7643
+ update,
7644
+ updateIn,
7645
+ version,
7646
+ isMap as isMap2,
7647
+ isOrderedMap as isOrderedMap2,
7648
+ Map as Map3,
7649
+ OrderedMap as OrderedMap3,
7650
+ Set as Set3
11261
7651
  } from "immutable";
11262
7652
  var css = String.raw;
11263
7653
  var html = String.raw;
11264
7654
  var macro = (defaults, rawView) => new Macro(defaults, rawView);
11265
- function check(_app) {
11266
- return { error: 0, warn: 0, hint: 0, dummyCheck: true };
11267
- }
11268
- async function test2(_opts) {
11269
- return null;
11270
- }
11271
- function collectIterBindings() {
11272
- console.warn("collectIterBindings is a no-op in the core tutuca build; use the tutuca-dev build for a functional implementation");
11273
- return [];
11274
- }
11275
7655
  function tutuca(nodeOrSelector) {
11276
7656
  const rootNode = typeof nodeOrSelector === "string" ? document.querySelector(nodeOrSelector) : nodeOrSelector;
11277
7657
  const comps = new Components;
@@ -11280,7 +7660,6 @@ function tutuca(nodeOrSelector) {
11280
7660
  }
11281
7661
 
11282
7662
  // extra.js
11283
- __reExport(exports_extra, exports_tutuca);
11284
7663
  async function compileClassesToStyle(app, compileClasses, styleId = "margaui-css") {
11285
7664
  const t1 = performance.now();
11286
7665
  const css2 = await compileClassesToStyleText(app, compileClasses);
@@ -11301,16 +7680,7 @@ async function compileClassesToStyleText(app, compileClasses, Ctx = ParseCtxClas
11301
7680
  }
11302
7681
  return await compileClasses(Array.from(classes));
11303
7682
  }
11304
-
11305
- // dev.js
11306
- __reExport(exports_dev, exports_extra);
11307
-
11308
7683
  // tools/core/docs.js
11309
- var exports_docs = {};
11310
- __export(exports_docs, {
11311
- getComponentsDocs: () => getComponentsDocs,
11312
- docComponents: () => docComponents
11313
- });
11314
7684
  function getSignature(name, fn) {
11315
7685
  const s = fn.toString();
11316
7686
  const m = s.match(/^(?:\w+|function\s*\w*)\s*\(([^)]*)\)/);
@@ -11318,7 +7688,7 @@ function getSignature(name, fn) {
11318
7688
  return `${name}(${params})`;
11319
7689
  }
11320
7690
  function getFieldMethods(field) {
11321
- const { name, type: type3 } = field;
7691
+ const { name, type } = field;
11322
7692
  const uname = name[0].toUpperCase() + name.slice(1);
11323
7693
  const methods = [
11324
7694
  { name: `set${uname}`, sig: `set${uname}(v)`, desc: "Set value" },
@@ -11333,7 +7703,7 @@ function getFieldMethods(field) {
11333
7703
  desc: "Reset to default value"
11334
7704
  }
11335
7705
  ];
11336
- switch (type3) {
7706
+ switch (type) {
11337
7707
  case "bool":
11338
7708
  methods[0].desc = "Set value (coerces to boolean)";
11339
7709
  methods.push({
@@ -11386,7 +7756,7 @@ function getFieldMethods(field) {
11386
7756
  break;
11387
7757
  case "map":
11388
7758
  case "omap": {
11389
- const label = type3 === "omap" ? "ordered map" : "map";
7759
+ const label = type === "omap" ? "ordered map" : "map";
11390
7760
  methods.push({
11391
7761
  name: `${name}Len`,
11392
7762
  sig: `${name}Len()`,
@@ -11481,10 +7851,6 @@ function docComponents(normalized, { name = null } = {}) {
11481
7851
  return new ComponentDocs({ items: getComponentsDocs(picked) });
11482
7852
  }
11483
7853
  // src/util/testing.js
11484
- var exports_testing = {};
11485
- __export(exports_testing, {
11486
- collectIterBindings: () => collectIterBindings2
11487
- });
11488
7854
  var filterAlwaysTrue2 = () => true;
11489
7855
  var nullLoopWith2 = (seq) => ({ iterData: { seq } });
11490
7856
  var plainArrayIter = (seq, visit, start, end) => {
@@ -11519,7 +7885,7 @@ function resolveAlter(Comp, name) {
11519
7885
  }
11520
7886
  return fn;
11521
7887
  }
11522
- function collectIterBindings2(Comp, compInstance, seq, opts = {}) {
7888
+ function collectIterBindings(Comp, compInstance, seq, opts = {}) {
11523
7889
  const whenFn = resolveAlter(Comp, opts.when) ?? filterAlwaysTrue2;
11524
7890
  const loopWithFn = resolveAlter(Comp, opts.loopWith) ?? nullLoopWith2;
11525
7891
  const enrichFn = resolveAlter(Comp, opts.enrichWith);
@@ -11539,12 +7905,12 @@ function collectIterBindings2(Comp, compInstance, seq, opts = {}) {
11539
7905
  }
11540
7906
 
11541
7907
  // dev.js
11542
- async function test4(opts = {}) {
7908
+ async function test2(opts = {}) {
11543
7909
  const report = await runTests({ expect, ...opts });
11544
7910
  reportTestReportToConsole(report);
11545
7911
  return report;
11546
7912
  }
11547
- function check2(app) {
7913
+ function check(app) {
11548
7914
  const counts = { error: 0, warn: 0, hint: 0 };
11549
7915
  for (const Comp of app.comps.byId.values()) {
11550
7916
  const shadowViews = {};
@@ -11587,9 +7953,9 @@ class LintClassCollectorCtx extends ParseCtxClassSetCollector {
11587
7953
  this.parseIssues = [];
11588
7954
  }
11589
7955
  enterMacro(macroName, macroVars, macroSlots) {
11590
- const { document: document2, Text, Comment, nodes, events: events2, macroNodes } = this;
7956
+ const { document: document2, Text, Comment, nodes, events, macroNodes } = this;
11591
7957
  const frame = { macroName, macroVars, macroSlots };
11592
- const v = new LintClassCollectorCtx(document2, Text, Comment, nodes, events2, macroNodes, frame, this);
7958
+ const v = new LintClassCollectorCtx(document2, Text, Comment, nodes, events, macroNodes, frame, this);
11593
7959
  v.classes = this.classes;
11594
7960
  v.attrs = this.attrs;
11595
7961
  v.parseIssues = this.parseIssues;
@@ -11605,27 +7971,61 @@ class LintClassCollectorCtx extends ParseCtxClassSetCollector {
11605
7971
  }
11606
7972
  }
11607
7973
  export {
7974
+ version,
7975
+ updateIn,
7976
+ update,
11608
7977
  tutuca,
11609
- test4 as test,
7978
+ test2 as test,
11610
7979
  suggestionToMessage,
7980
+ setIn,
7981
+ set,
11611
7982
  runTests,
11612
7983
  reportTestReportToConsole,
7984
+ removeIn,
7985
+ remove,
7986
+ mergeWith,
7987
+ mergeDeepWith,
7988
+ mergeDeep,
7989
+ merge,
11613
7990
  makeCollector,
11614
7991
  macro,
11615
7992
  lintIdToMessage,
11616
- isOrderedMap as isOMap,
11617
- isMap as isIMap,
7993
+ isValueObject,
7994
+ isStack,
7995
+ isSet,
7996
+ isSeq,
7997
+ isRecord,
7998
+ isPlainObject,
7999
+ isOrderedSet,
8000
+ isOrderedMap,
8001
+ isOrdered,
8002
+ isOrderedMap2 as isOMap,
8003
+ isMap,
8004
+ isList,
8005
+ isKeyed2 as isKeyed,
8006
+ isIndexed2 as isIndexed,
8007
+ isImmutable,
8008
+ isMap2 as isIMap,
8009
+ isCollection,
8010
+ isAssociative,
8011
+ is2 as is,
11618
8012
  injectCss,
11619
8013
  html,
8014
+ hash,
8015
+ hasIn,
8016
+ has,
8017
+ getIn,
11620
8018
  getComponentsDocs,
8019
+ get,
8020
+ fromJS,
11621
8021
  docComponents,
11622
8022
  css,
11623
8023
  component,
11624
8024
  compileClassesToStyleText,
11625
8025
  compileClassesToStyle,
11626
- collectIterBindings2 as collectIterBindings,
8026
+ collectIterBindings,
11627
8027
  checkComponent,
11628
- check2 as check,
8028
+ check,
11629
8029
  UNSUPPORTED_EXPR_SYNTAX,
11630
8030
  UNKNOWN_X_OP,
11631
8031
  UNKNOWN_X_ATTR,
@@ -11640,22 +8040,33 @@ export {
11640
8040
  TestReport,
11641
8041
  TestIndex,
11642
8042
  Test,
8043
+ Stack2 as Stack,
8044
+ Set2 as Set,
8045
+ Seq,
11643
8046
  SEQ_INFO,
8047
+ Repeat,
11644
8048
  RenderedSection,
11645
8049
  RenderedExample,
11646
8050
  RenderBatch,
8051
+ Record2 as Record,
8052
+ Range,
11647
8053
  RENDER_IT_OUTSIDE_OF_LOOP,
11648
8054
  REDUNDANT_TEMPLATE_STRING,
11649
8055
  ParseContext,
8056
+ PairSorting,
11650
8057
  PLACEHOLDERLESS_TEMPLATE_STRING,
11651
- OrderedMap2 as OMap,
8058
+ OrderedSet,
8059
+ OrderedMap2 as OrderedMap,
8060
+ OrderedMap3 as OMap,
11652
8061
  ModuleTests,
11653
8062
  ModuleTestReport,
11654
8063
  ModuleInfo,
8064
+ Map2 as Map,
11655
8065
  METHOD_VAL_NOT_DEFINED,
11656
8066
  METHOD_VAL_IS_FIELD,
11657
8067
  MAYBE_DROP_AT_PREFIX,
11658
8068
  MAYBE_ADD_AT_PREFIX,
8069
+ List3 as List,
11659
8070
  LintReport,
11660
8071
  LintParseContext,
11661
8072
  LintFinding,
@@ -11663,13 +8074,13 @@ export {
11663
8074
  LintComponentResult,
11664
8075
  LintClassCollectorCtx,
11665
8076
  KList,
11666
- Set2 as ISet,
8077
+ Set3 as ISet,
11667
8078
  INPUT_HANDLER_NOT_REFERENCED,
11668
8079
  INPUT_HANDLER_NOT_IMPLEMENTED,
11669
8080
  INPUT_HANDLER_METHOD_NOT_IMPLEMENTED,
11670
8081
  INPUT_HANDLER_METHOD_FOR_INPUT_HANDLER,
11671
8082
  INPUT_HANDLER_FOR_INPUT_HANDLER_METHOD,
11672
- Map2 as IMap,
8083
+ Map3 as IMap,
11673
8084
  IF_NO_BRANCH_SET,
11674
8085
  FIELD_VAL_NOT_DEFINED,
11675
8086
  FIELD_VAL_IS_METHOD,
@@ -11683,6 +8094,7 @@ export {
11683
8094
  ComponentSummary,
11684
8095
  ComponentList,
11685
8096
  ComponentDocs,
8097
+ Collection,
11686
8098
  COMP_FIELD_BAD_SHAPE,
11687
8099
  BAD_VALUE,
11688
8100
  ALT_HANDLER_NOT_REFERENCED,