UNPKG

twd-js

Version:

Test While Developing (TWD) - in-browser testing

1,642 lines 476 kB
import am, { useState as na } from "react"; const im = (e, t = 2e3, r = 50) => new Promise((n, o) => { const a = Date.now(), i = () => { const s = e(); if (s) return n(s); if (Date.now() - a > t) return o(new Error("Timeout waiting for element")); setTimeout(i, r); }; i(); }), sm = (e, t = 2e3, r = 50) => new Promise((n, o) => { const a = Date.now(), i = () => { const s = e(); if (s && s.length > 0) return n(Array.from(s)); if (Date.now() - a > t) return o(new Error("Timeout waiting for elements")); setTimeout(i, r); }; i(); }), Pa = (e) => new Promise((t) => setTimeout(t, e)), Ze = []; let _i = []; const Pi = (e, t, r = {}) => { Ze.push({ name: e, fn: t, status: "idle", logs: [], suite: [..._i], ...r }); }, lm = (e) => { _i.push(e); }, um = () => { _i.pop(); }, ge = (e, t, r, n) => { if (!e && !t) throw new Error(n); if (e && t) throw new Error( n.replace("to be", "to not be").replace("to have", "to not have").replace("to contain", "to not contain") ); return r; }; function cm(e) { if (!e.isConnected) return !1; let t = e; for (; t; ) { const r = getComputedStyle(t); if (r.display === "none" || r.visibility === "hidden" || r.visibility === "collapse") return !1; t = t.parentElement; } return !0; } const Ts = (e, t, ...r) => { const n = t.startsWith("not."), o = n ? t.slice(4) : t, a = (e.textContent || "").trim(); switch (o) { // Content case "have.text": return ge( a === r[0], n, `Assertion passed: Text is exactly "${r[0]}"`, `Assertion failed: Expected text to be "${r[0]}", but got "${a}"` ); case "contain.text": return ge( a.includes(r[0]), n, `Assertion passed: Text contains "${r[0]}"`, `Assertion failed: Expected text to contain "${r[0]}", but got "${a}"` ); case "be.empty": return ge( a.length === 0, n, "Assertion passed: Text is empty", `Assertion failed: Expected text to be empty, but got "${a}"` ); // Attributes case "have.attr": return ge( e.getAttribute(r[0]) === r[1], n, `Assertion passed: Attribute "${r[0]}" is "${r[1]}"`, `Assertion failed: Expected attribute "${r[0]}" to be "${r[1]}", but got "${e.getAttribute(r[0])}"` ); case "have.value": return ge( e.value === r[0], n, `Assertion passed: Value is "${r[0]}"`, `Assertion failed: Expected value to be "${r[0]}", but got "${e.value}"` ); // State case "be.disabled": return ge( e.disabled === !0, n, "Assertion passed: Element is disabled", "Assertion failed: Expected element to be disabled" ); case "be.enabled": return ge( e.disabled === !1, n, "Assertion passed: Element is enabled", "Assertion failed: Expected element to be enabled" ); case "be.checked": return ge( e.checked === !0, n, "Assertion passed: Element is checked", "Assertion failed: Expected element to be checked" ); case "be.selected": return ge( e.selected === !0, n, "Assertion passed: Element is selected", "Assertion failed: Expected element to be selected" ); case "be.focused": return ge( document.activeElement === e, n, "Assertion passed: Element is focused", "Assertion failed: Expected element to be focused" ); // Visibility case "be.visible": return ge( cm(e), n, "Assertion passed: Element is visible", "Assertion failed: Expected element to be visible" ); // Classes case "have.class": return ge( e.classList.contains(r[0]), n, `Assertion passed: Element has class "${r[0]}"`, `Assertion failed: Expected element to have class "${r[0]}"` ); default: throw new Error(`Unknown assertion: ${o}`); } }, ut = (e) => { const t = Ze.find((r) => r.status === "running"); t && t.logs?.push(e); }, ct = [], Cd = 100, dm = async () => { "serviceWorker" in navigator && (await navigator.serviceWorker.register("/mock-sw.js?v=1"), navigator.serviceWorker.addEventListener("message", (e) => { if (e.data?.type === "EXECUTED") { const { alias: t, request: r } = e.data, n = ct.find((o) => o.alias === t); n && (n.executed = !0, n.request = r); } })); }, fm = async (e, t) => { const r = { alias: e, ...t, executed: !1 }, n = ct.findIndex((o) => o.alias === e); n !== -1 ? ct[n] = r : ct.push(r), navigator.serviceWorker.controller?.postMessage({ type: "ADD_RULE", rule: r }), await Pa(Cd), await Promise.resolve(); }, pm = async (e) => await Promise.all( e.map((r) => xd(r)) ), xd = async (e) => { await Pa(Cd); const t = ct.find((r) => r.alias === e && r.executed); if (!t) throw new Error(`Rule ${e} not found or not executed`); return Promise.resolve(t); }, mm = () => ct, hm = () => { navigator.serviceWorker.controller?.postMessage({ type: "CLEAR_RULES" }), ct.length = 0; }, bm = (e, t) => { const r = e.startsWith("not."); switch (r ? e.slice(4) : e) { case "eq": return ge( window.location.href === t, r, `Assertion passed: URL is ${t}`, `Assertion failed: Expected URL to be ${t}, but got ${window.location.href}` ); case "contain.url": return ge( window.location.href.includes(t), r, `Assertion passed: URL contains ${t}`, `Assertion failed: Expected URL to contain ${t}, but got ${window.location.href}` ); default: throw new Error(`Unknown assertion: ${e}`); } }, vm = () => ({ location: window.location, should: (e, t) => { const r = bm(e, t); return ut(r), r; } }), ym = 100, gm = async (e) => { ut(`visit("${e}")`), window.history.pushState({}, "", e), window.dispatchEvent(new PopStateEvent("popstate")), await Pa(ym); }; let Oo = null; const MC = (e) => { Oo = e; }, IC = (e, t) => { lm(e), t(), um(); }, NC = (e, t) => { Pi(e, async () => { Oo && await Oo(), await t(); }); }, kC = (e, t) => { Pi(e, async () => { Oo && await Oo(), await t(); }, { only: !0 }); }, DC = (e, t) => { Pi(e, async () => { }, { skip: !0 }); }, jC = { get: async (e) => { ut(`Searching get("${e}")`); const t = await im(() => document.querySelector(e)), r = { el: t, should: (n, ...o) => { const a = Ts(t, n, ...o); return ut(a), r; } }; return r; }, getAll: async (e) => (ut(`Searching getAll("${e}")`), (await sm(() => document.querySelectorAll(e))).map((r) => { const n = { el: r, should: (o, ...a) => { const i = Ts(r, o, ...a); return ut(i), n; } }; return n; })), visit: gm, url: vm, mockRequest: fm, waitForRequest: xd, waitForRequests: pm, initRequestMocking: dm, clearRequestMockRules: hm, getRequestMockRules: mm, wait: Pa }; var qd = Object.defineProperty, x = (e, t) => qd(e, "name", { value: t, configurable: !0 }), Ti = (e, t) => { for (var r in t) qd(e, r, { get: t[r], enumerable: !0 }); }, ua = {}; Ti(ua, { addChainableMethod: () => Li, addLengthGuard: () => $o, addMethod: () => ji, addProperty: () => Di, checkError: () => we, compareByInspect: () => pa, eql: () => Qd, expectTypes: () => Md, flag: () => z, getActual: () => Sa, getMessage: () => Ai, getName: () => Aa, getOperator: () => Vi, getOwnEnumerableProperties: () => zi, getOwnEnumerablePropertySymbols: () => Ui, getPathInfo: () => ki, hasProperty: () => Oa, inspect: () => K, isNaN: () => ma, isNumeric: () => ue, isProxyEnabled: () => Bo, isRegExp: () => ha, objDisplay: () => dt, overwriteChainableMethod: () => Fi, overwriteMethod: () => $i, overwriteProperty: () => Bi, proxify: () => At, test: () => Si, transferFlags: () => Te, type: () => re }); var we = {}; Ti(we, { compatibleConstructor: () => Td, compatibleInstance: () => Pd, compatibleMessage: () => Sd, getConstructorName: () => Od, getMessage: () => Ad }); function Ta(e) { return e instanceof Error || Object.prototype.toString.call(e) === "[object Error]"; } x(Ta, "isErrorInstance"); function _d(e) { return Object.prototype.toString.call(e) === "[object RegExp]"; } x(_d, "isRegExp"); function Pd(e, t) { return Ta(t) && e === t; } x(Pd, "compatibleInstance"); function Td(e, t) { return Ta(t) ? e.constructor === t.constructor || e instanceof t.constructor : (typeof t == "object" || typeof t == "function") && t.prototype ? e.constructor === t || e instanceof t : !1; } x(Td, "compatibleConstructor"); function Sd(e, t) { const r = typeof e == "string" ? e : e.message; return _d(t) ? t.test(r) : typeof t == "string" ? r.indexOf(t) !== -1 : !1; } x(Sd, "compatibleMessage"); function Od(e) { let t = e; return Ta(e) ? t = e.constructor.name : typeof e == "function" && (t = e.name, t === "" && (t = new e().name || t)), t; } x(Od, "getConstructorName"); function Ad(e) { let t = ""; return e && e.message ? t = e.message : typeof e == "string" && (t = e), t; } x(Ad, "getMessage"); function z(e, t, r) { let n = e.__flags || (e.__flags = /* @__PURE__ */ Object.create(null)); if (arguments.length === 3) n[t] = r; else return n[t]; } x(z, "flag"); function Si(e, t) { let r = z(e, "negate"), n = t[0]; return r ? !n : n; } x(Si, "test"); function re(e) { if (typeof e > "u") return "undefined"; if (e === null) return "null"; const t = e[Symbol.toStringTag]; return typeof t == "string" ? t : Object.prototype.toString.call(e).slice(8, -1); } x(re, "type"); var Rm = "captureStackTrace" in Error, ft, J = (ft = class extends Error { message; get name() { return "AssertionError"; } get ok() { return !1; } constructor(t = "Unspecified AssertionError", r, n) { super(t), this.message = t, Rm && Error.captureStackTrace(this, n || ft); for (const o in r) o in this || (this[o] = r[o]); } toJSON(t) { return { ...this, name: this.name, message: this.message, ok: !1, stack: t !== !1 ? this.stack : void 0 }; } }, x(ft, "AssertionError"), ft); function Md(e, t) { let r = z(e, "message"), n = z(e, "ssfi"); r = r ? r + ": " : "", e = z(e, "object"), t = t.map(function(i) { return i.toLowerCase(); }), t.sort(); let o = t.map(function(i, s) { let l = ~["a", "e", "i", "o", "u"].indexOf(i.charAt(0)) ? "an" : "a"; return (t.length > 1 && s === t.length - 1 ? "or " : "") + l + " " + i; }).join(", "), a = re(e).toLowerCase(); if (!t.some(function(i) { return a === i; })) throw new J( r + "object tested must be " + o + ", but " + a + " given", void 0, n ); } x(Md, "expectTypes"); function Sa(e, t) { return t.length > 4 ? t[4] : e._obj; } x(Sa, "getActual"); var Ss = { bold: ["1", "22"], dim: ["2", "22"], italic: ["3", "23"], underline: ["4", "24"], // 5 & 6 are blinking inverse: ["7", "27"], hidden: ["8", "28"], strike: ["9", "29"], // 10-20 are fonts // 21-29 are resets for 1-9 black: ["30", "39"], red: ["31", "39"], green: ["32", "39"], yellow: ["33", "39"], blue: ["34", "39"], magenta: ["35", "39"], cyan: ["36", "39"], white: ["37", "39"], brightblack: ["30;1", "39"], brightred: ["31;1", "39"], brightgreen: ["32;1", "39"], brightyellow: ["33;1", "39"], brightblue: ["34;1", "39"], brightmagenta: ["35;1", "39"], brightcyan: ["36;1", "39"], brightwhite: ["37;1", "39"], grey: ["90", "39"] }, wm = { special: "cyan", number: "yellow", bigint: "yellow", boolean: "yellow", undefined: "grey", null: "bold", string: "green", symbol: "green", date: "magenta", regexp: "red" }, Ct = "…"; function Id(e, t) { const r = Ss[wm[t]] || Ss[t] || ""; return r ? `\x1B[${r[0]}m${String(e)}\x1B[${r[1]}m` : String(e); } x(Id, "colorise"); function Nd({ showHidden: e = !1, depth: t = 2, colors: r = !1, customInspect: n = !0, showProxy: o = !1, maxArrayLength: a = 1 / 0, breakLength: i = 1 / 0, seen: s = [], // eslint-disable-next-line no-shadow truncate: l = 1 / 0, stylize: u = String } = {}, f) { const d = { showHidden: !!e, depth: Number(t), colors: !!r, customInspect: !!n, showProxy: !!o, maxArrayLength: Number(a), breakLength: Number(i), truncate: Number(l), seen: s, inspect: f, stylize: u }; return d.colors && (d.stylize = Id), d; } x(Nd, "normaliseOptions"); function kd(e) { return e >= "\uD800" && e <= "\uDBFF"; } x(kd, "isHighSurrogate"); function Ke(e, t, r = Ct) { e = String(e); const n = r.length, o = e.length; if (n > t && o > n) return r; if (o > t && o > n) { let a = t - n; return a > 0 && kd(e[a - 1]) && (a = a - 1), `${e.slice(0, a)}${r}`; } return e; } x(Ke, "truncate"); function xe(e, t, r, n = ", ") { r = r || t.inspect; const o = e.length; if (o === 0) return ""; const a = t.truncate; let i = "", s = "", l = ""; for (let u = 0; u < o; u += 1) { const f = u + 1 === e.length, d = u + 2 === e.length; l = `${Ct}(${e.length - u})`; const c = e[u]; t.truncate = a - i.length - (f ? 0 : n.length); const h = s || r(c, t) + (f ? "" : n), v = i.length + h.length, R = v + l.length; if (f && v > a && i.length + l.length <= a || !f && !d && R > a || (s = f ? "" : r(e[u + 1], t) + (d ? "" : n), !f && d && R > a && v + s.length > a)) break; if (i += h, !f && !d && v + s.length >= a) { l = `${Ct}(${e.length - u - 1})`; break; } l = ""; } return `${i}${l}`; } x(xe, "inspectList"); function Dd(e) { return e.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/) ? e : JSON.stringify(e).replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"); } x(Dd, "quoteComplexKey"); function xt([e, t], r) { return r.truncate -= 2, typeof e == "string" ? e = Dd(e) : typeof e != "number" && (e = `[${r.inspect(e, r)}]`), r.truncate -= e.length, t = r.inspect(t, r), `${e}: ${t}`; } x(xt, "inspectProperty"); function jd(e, t) { const r = Object.keys(e).slice(e.length); if (!e.length && !r.length) return "[]"; t.truncate -= 4; const n = xe(e, t); t.truncate -= n.length; let o = ""; return r.length && (o = xe(r.map((a) => [a, e[a]]), t, xt)), `[ ${n}${o ? `, ${o}` : ""} ]`; } x(jd, "inspectArray"); var Em = /* @__PURE__ */ x((e) => typeof Buffer == "function" && e instanceof Buffer ? "Buffer" : e[Symbol.toStringTag] ? e[Symbol.toStringTag] : e.constructor.name, "getArrayName"); function Ae(e, t) { const r = Em(e); t.truncate -= r.length + 4; const n = Object.keys(e).slice(e.length); if (!e.length && !n.length) return `${r}[]`; let o = ""; for (let i = 0; i < e.length; i++) { const s = `${t.stylize(Ke(e[i], t.truncate), "number")}${i === e.length - 1 ? "" : ", "}`; if (t.truncate -= s.length, e[i] !== e.length && t.truncate <= 3) { o += `${Ct}(${e.length - e[i] + 1})`; break; } o += s; } let a = ""; return n.length && (a = xe(n.map((i) => [i, e[i]]), t, xt)), `${r}[ ${o}${a ? `, ${a}` : ""} ]`; } x(Ae, "inspectTypedArray"); function Bd(e, t) { const r = e.toJSON(); if (r === null) return "Invalid Date"; const n = r.split("T"), o = n[0]; return t.stylize(`${o}T${Ke(n[1], t.truncate - o.length - 1)}`, "date"); } x(Bd, "inspectDate"); function Za(e, t) { const r = e[Symbol.toStringTag] || "Function", n = e.name; return n ? t.stylize(`[${r} ${Ke(n, t.truncate - 11)}]`, "special") : t.stylize(`[${r}]`, "special"); } x(Za, "inspectFunction"); function $d([e, t], r) { return r.truncate -= 4, e = r.inspect(e, r), r.truncate -= e.length, t = r.inspect(t, r), `${e} => ${t}`; } x($d, "inspectMapEntry"); function Ld(e) { const t = []; return e.forEach((r, n) => { t.push([n, r]); }), t; } x(Ld, "mapToEntries"); function Fd(e, t) { return e.size === 0 ? "Map{}" : (t.truncate -= 7, `Map{ ${xe(Ld(e), t, $d)} }`); } x(Fd, "inspectMap"); var Cm = Number.isNaN || ((e) => e !== e); function ei(e, t) { return Cm(e) ? t.stylize("NaN", "number") : e === 1 / 0 ? t.stylize("Infinity", "number") : e === -1 / 0 ? t.stylize("-Infinity", "number") : e === 0 ? t.stylize(1 / e === 1 / 0 ? "+0" : "-0", "number") : t.stylize(Ke(String(e), t.truncate), "number"); } x(ei, "inspectNumber"); function ti(e, t) { let r = Ke(e.toString(), t.truncate - 1); return r !== Ct && (r += "n"), t.stylize(r, "bigint"); } x(ti, "inspectBigInt"); function Ud(e, t) { const r = e.toString().split("/")[2], n = t.truncate - (2 + r.length), o = e.source; return t.stylize(`/${Ke(o, n)}/${r}`, "regexp"); } x(Ud, "inspectRegExp"); function zd(e) { const t = []; return e.forEach((r) => { t.push(r); }), t; } x(zd, "arrayFromSet"); function Vd(e, t) { return e.size === 0 ? "Set{}" : (t.truncate -= 7, `Set{ ${xe(zd(e), t)} }`); } x(Vd, "inspectSet"); var Os = new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", "g"), xm = { "\b": "\\b", " ": "\\t", "\n": "\\n", "\f": "\\f", "\r": "\\r", "'": "\\'", "\\": "\\\\" }, qm = 16; function Hd(e) { return xm[e] || `\\u${`0000${e.charCodeAt(0).toString(qm)}`.slice(-4)}`; } x(Hd, "escape"); function ri(e, t) { return Os.test(e) && (e = e.replace(Os, Hd)), t.stylize(`'${Ke(e, t.truncate - 2)}'`, "string"); } x(ri, "inspectString"); function ni(e) { return "description" in Symbol.prototype ? e.description ? `Symbol(${e.description})` : "Symbol()" : e.toString(); } x(ni, "inspectSymbol"); var _m = /* @__PURE__ */ x(() => "Promise{…}", "getPromiseValue"), Pm = _m; function To(e, t) { const r = Object.getOwnPropertyNames(e), n = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(e) : []; if (r.length === 0 && n.length === 0) return "{}"; if (t.truncate -= 4, t.seen = t.seen || [], t.seen.includes(e)) return "[Circular]"; t.seen.push(e); const o = xe(r.map((s) => [s, e[s]]), t, xt), a = xe(n.map((s) => [s, e[s]]), t, xt); t.seen.pop(); let i = ""; return o && a && (i = ", "), `{ ${o}${i}${a} }`; } x(To, "inspectObject"); var Fa = typeof Symbol < "u" && Symbol.toStringTag ? Symbol.toStringTag : !1; function Wd(e, t) { let r = ""; return Fa && Fa in e && (r = e[Fa]), r = r || e.constructor.name, (!r || r === "_class") && (r = "<Anonymous Class>"), t.truncate -= r.length, `${r}${To(e, t)}`; } x(Wd, "inspectClass"); function Gd(e, t) { return e.length === 0 ? "Arguments[]" : (t.truncate -= 13, `Arguments[ ${xe(e, t)} ]`); } x(Gd, "inspectArguments"); var Tm = [ "stack", "line", "column", "name", "message", "fileName", "lineNumber", "columnNumber", "number", "description", "cause" ]; function Kd(e, t) { const r = Object.getOwnPropertyNames(e).filter((i) => Tm.indexOf(i) === -1), n = e.name; t.truncate -= n.length; let o = ""; if (typeof e.message == "string" ? o = Ke(e.message, t.truncate) : r.unshift("message"), o = o ? `: ${o}` : "", t.truncate -= o.length + 5, t.seen = t.seen || [], t.seen.includes(e)) return "[Circular]"; t.seen.push(e); const a = xe(r.map((i) => [i, e[i]]), t, xt); return `${n}${o}${a ? ` { ${a} }` : ""}`; } x(Kd, "inspectObject"); function Yd([e, t], r) { return r.truncate -= 3, t ? `${r.stylize(String(e), "yellow")}=${r.stylize(`"${t}"`, "string")}` : `${r.stylize(String(e), "yellow")}`; } x(Yd, "inspectAttribute"); function ca(e, t) { return xe(e, t, Xd, ` `); } x(ca, "inspectNodeCollection"); function Xd(e, t) { switch (e.nodeType) { case 1: return Oi(e, t); case 3: return t.inspect(e.data, t); default: return t.inspect(e, t); } } x(Xd, "inspectNode"); function Oi(e, t) { const r = e.getAttributeNames(), n = e.tagName.toLowerCase(), o = t.stylize(`<${n}`, "special"), a = t.stylize(">", "special"), i = t.stylize(`</${n}>`, "special"); t.truncate -= n.length * 2 + 5; let s = ""; r.length > 0 && (s += " ", s += xe(r.map((f) => [f, e.getAttribute(f)]), t, Yd, " ")), t.truncate -= s.length; const l = t.truncate; let u = ca(e.children, t); return u && u.length > l && (u = `${Ct}(${e.children.length})`), `${o}${s}${a}${u}${i}`; } x(Oi, "inspectHTML"); var Sm = typeof Symbol == "function" && typeof Symbol.for == "function", Ua = Sm ? Symbol.for("chai/inspect") : "@@chai/inspect", za = Symbol.for("nodejs.util.inspect.custom"), As = /* @__PURE__ */ new WeakMap(), Ms = {}, Is = { undefined: /* @__PURE__ */ x((e, t) => t.stylize("undefined", "undefined"), "undefined"), null: /* @__PURE__ */ x((e, t) => t.stylize("null", "null"), "null"), boolean: /* @__PURE__ */ x((e, t) => t.stylize(String(e), "boolean"), "boolean"), Boolean: /* @__PURE__ */ x((e, t) => t.stylize(String(e), "boolean"), "Boolean"), number: ei, Number: ei, bigint: ti, BigInt: ti, string: ri, String: ri, function: Za, Function: Za, symbol: ni, // A Symbol polyfill will return `Symbol` not `symbol` from typedetect Symbol: ni, Array: jd, Date: Bd, Map: Fd, Set: Vd, RegExp: Ud, Promise: Pm, // WeakSet, WeakMap are totally opaque to us WeakSet: /* @__PURE__ */ x((e, t) => t.stylize("WeakSet{…}", "special"), "WeakSet"), WeakMap: /* @__PURE__ */ x((e, t) => t.stylize("WeakMap{…}", "special"), "WeakMap"), Arguments: Gd, Int8Array: Ae, Uint8Array: Ae, Uint8ClampedArray: Ae, Int16Array: Ae, Uint16Array: Ae, Int32Array: Ae, Uint32Array: Ae, Float32Array: Ae, Float64Array: Ae, Generator: /* @__PURE__ */ x(() => "", "Generator"), DataView: /* @__PURE__ */ x(() => "", "DataView"), ArrayBuffer: /* @__PURE__ */ x(() => "", "ArrayBuffer"), Error: Kd, HTMLCollection: ca, NodeList: ca }, Om = /* @__PURE__ */ x((e, t, r) => Ua in e && typeof e[Ua] == "function" ? e[Ua](t) : za in e && typeof e[za] == "function" ? e[za](t.depth, t) : "inspect" in e && typeof e.inspect == "function" ? e.inspect(t.depth, t) : "constructor" in e && As.has(e.constructor) ? As.get(e.constructor)(e, t) : Ms[r] ? Ms[r](e, t) : "", "inspectCustom"), Am = Object.prototype.toString; function da(e, t = {}) { const r = Nd(t, da), { customInspect: n } = r; let o = e === null ? "null" : typeof e; if (o === "object" && (o = Am.call(e).slice(8, -1)), o in Is) return Is[o](e, r); if (n && e) { const i = Om(e, r, o); if (i) return typeof i == "string" ? i : da(i, r); } const a = e ? Object.getPrototypeOf(e) : !1; return a === Object.prototype || a === null ? To(e, r) : e && typeof HTMLElement == "function" && e instanceof HTMLElement ? Oi(e, r) : "constructor" in e ? e.constructor !== Object ? Wd(e, r) : To(e, r) : e === Object(e) ? To(e, r) : r.stylize(String(e), o); } x(da, "inspect"); var fe = { /** * ### config.includeStack * * User configurable property, influences whether stack trace * is included in Assertion error message. Default of false * suppresses stack trace in the error message. * * chai.config.includeStack = true; // enable stack on error * * @param {boolean} * @public */ includeStack: !1, /** * ### config.showDiff * * User configurable property, influences whether or not * the `showDiff` flag should be included in the thrown * AssertionErrors. `false` will always be `false`; `true` * will be true when the assertion has requested a diff * be shown. * * @param {boolean} * @public */ showDiff: !0, /** * ### config.truncateThreshold * * User configurable property, sets length threshold for actual and * expected values in assertion errors. If this threshold is exceeded, for * example for large data structures, the value is replaced with something * like `[ Array(3) ]` or `{ Object (prop1, prop2) }`. * * Set it to zero if you want to disable truncating altogether. * * This is especially userful when doing assertions on arrays: having this * set to a reasonable large value makes the failure messages readily * inspectable. * * chai.config.truncateThreshold = 0; // disable truncating * * @param {number} * @public */ truncateThreshold: 40, /** * ### config.useProxy * * User configurable property, defines if chai will use a Proxy to throw * an error when a non-existent property is read, which protects users * from typos when using property-based assertions. * * Set it to false if you want to disable this feature. * * chai.config.useProxy = false; // disable use of Proxy * * This feature is automatically disabled regardless of this config value * in environments that don't support proxies. * * @param {boolean} * @public */ useProxy: !0, /** * ### config.proxyExcludedKeys * * User configurable property, defines which properties should be ignored * instead of throwing an error if they do not exist on the assertion. * This is only applied if the environment Chai is running in supports proxies and * if the `useProxy` configuration setting is enabled. * By default, `then` and `inspect` will not throw an error if they do not exist on the * assertion object because the `.inspect` property is read by `util.inspect` (for example, when * using `console.log` on the assertion object) and `.then` is necessary for promise type-checking. * * // By default these keys will not throw an error if they do not exist on the assertion object * chai.config.proxyExcludedKeys = ['then', 'inspect']; * * @param {Array} * @public */ proxyExcludedKeys: ["then", "catch", "inspect", "toJSON"], /** * ### config.deepEqual * * User configurable property, defines which a custom function to use for deepEqual * comparisons. * By default, the function used is the one from the `deep-eql` package without custom comparator. * * // use a custom comparator * chai.config.deepEqual = (expected, actual) => { * return chai.util.eql(expected, actual, { * comparator: (expected, actual) => { * // for non number comparison, use the default behavior * if(typeof expected !== 'number') return null; * // allow a difference of 10 between compared numbers * return typeof actual === 'number' && Math.abs(actual - expected) < 10 * } * }) * }; * * @param {Function} * @public */ deepEqual: null }; function K(e, t, r, n) { let o = { colors: n, depth: typeof r > "u" ? 2 : r, showHidden: t, truncate: fe.truncateThreshold ? fe.truncateThreshold : 1 / 0 }; return da(e, o); } x(K, "inspect"); function dt(e) { let t = K(e), r = Object.prototype.toString.call(e); if (fe.truncateThreshold && t.length >= fe.truncateThreshold) { if (r === "[object Function]") return !e.name || e.name === "" ? "[Function]" : "[Function: " + e.name + "]"; if (r === "[object Array]") return "[ Array(" + e.length + ") ]"; if (r === "[object Object]") { let n = Object.keys(e); return "{ Object (" + (n.length > 2 ? n.splice(0, 2).join(", ") + ", ..." : n.join(", ")) + ") }"; } else return t; } else return t; } x(dt, "objDisplay"); function Ai(e, t) { let r = z(e, "negate"), n = z(e, "object"), o = t[3], a = Sa(e, t), i = r ? t[2] : t[1], s = z(e, "message"); return typeof i == "function" && (i = i()), i = i || "", i = i.replace(/#\{this\}/g, function() { return dt(n); }).replace(/#\{act\}/g, function() { return dt(a); }).replace(/#\{exp\}/g, function() { return dt(o); }), s ? s + ": " + i : i; } x(Ai, "getMessage"); function Te(e, t, r) { let n = e.__flags || (e.__flags = /* @__PURE__ */ Object.create(null)); t.__flags || (t.__flags = /* @__PURE__ */ Object.create(null)), r = arguments.length === 3 ? r : !0; for (let o in n) (r || o !== "object" && o !== "ssfi" && o !== "lockSsfi" && o != "message") && (t.__flags[o] = n[o]); } x(Te, "transferFlags"); function oi(e) { if (typeof e > "u") return "undefined"; if (e === null) return "null"; const t = e[Symbol.toStringTag]; return typeof t == "string" ? t : Object.prototype.toString.call(e).slice(8, -1); } x(oi, "type"); function Mi() { this._key = "chai/deep-eql__" + Math.random() + Date.now(); } x(Mi, "FakeMap"); Mi.prototype = { get: /* @__PURE__ */ x(function(t) { return t[this._key]; }, "get"), set: /* @__PURE__ */ x(function(t, r) { Object.isExtensible(t) && Object.defineProperty(t, this._key, { value: r, configurable: !0 }); }, "set") }; var Jd = typeof WeakMap == "function" ? WeakMap : Mi; function ai(e, t, r) { if (!r || mt(e) || mt(t)) return null; var n = r.get(e); if (n) { var o = n.get(t); if (typeof o == "boolean") return o; } return null; } x(ai, "memoizeCompare"); function xo(e, t, r, n) { if (!(!r || mt(e) || mt(t))) { var o = r.get(e); o ? o.set(t, n) : (o = new Jd(), o.set(t, n), r.set(e, o)); } } x(xo, "memoizeSet"); var Qd = jo; function jo(e, t, r) { if (r && r.comparator) return ii(e, t, r); var n = Ii(e, t); return n !== null ? n : ii(e, t, r); } x(jo, "deepEqual"); function Ii(e, t) { return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && // eslint-disable-line no-self-compare t !== t ? !0 : mt(e) || mt(t) ? !1 : null; } x(Ii, "simpleEqual"); function ii(e, t, r) { r = r || {}, r.memoize = r.memoize === !1 ? !1 : r.memoize || new Jd(); var n = r && r.comparator, o = ai(e, t, r.memoize); if (o !== null) return o; var a = ai(t, e, r.memoize); if (a !== null) return a; if (n) { var i = n(e, t); if (i === !1 || i === !0) return xo(e, t, r.memoize, i), i; var s = Ii(e, t); if (s !== null) return s; } var l = oi(e); if (l !== oi(t)) return xo(e, t, r.memoize, !1), !1; xo(e, t, r.memoize, !0); var u = Zd(e, t, l, r); return xo(e, t, r.memoize, u), u; } x(ii, "extensiveDeepEqual"); function Zd(e, t, r, n) { switch (r) { case "String": case "Number": case "Boolean": case "Date": return jo(e.valueOf(), t.valueOf()); case "Promise": case "Symbol": case "function": case "WeakMap": case "WeakSet": return e === t; case "Error": return Ni(e, t, ["name", "message", "code"], n); case "Arguments": case "Int8Array": case "Uint8Array": case "Uint8ClampedArray": case "Int16Array": case "Uint16Array": case "Int32Array": case "Uint32Array": case "Float32Array": case "Float64Array": case "Array": return tt(e, t, n); case "RegExp": return ef(e, t); case "Generator": return tf(e, t, n); case "DataView": return tt(new Uint8Array(e.buffer), new Uint8Array(t.buffer), n); case "ArrayBuffer": return tt(new Uint8Array(e), new Uint8Array(t), n); case "Set": return si(e, t, n); case "Map": return si(e, t, n); case "Temporal.PlainDate": case "Temporal.PlainTime": case "Temporal.PlainDateTime": case "Temporal.Instant": case "Temporal.ZonedDateTime": case "Temporal.PlainYearMonth": case "Temporal.PlainMonthDay": return e.equals(t); case "Temporal.Duration": return e.total("nanoseconds") === t.total("nanoseconds"); case "Temporal.TimeZone": case "Temporal.Calendar": return e.toString() === t.toString(); default: return nf(e, t, n); } } x(Zd, "extensiveDeepEqualByType"); function ef(e, t) { return e.toString() === t.toString(); } x(ef, "regexpEqual"); function si(e, t, r) { try { if (e.size !== t.size) return !1; if (e.size === 0) return !0; } catch { return !1; } var n = [], o = []; return e.forEach(/* @__PURE__ */ x(function(i, s) { n.push([i, s]); }, "gatherEntries")), t.forEach(/* @__PURE__ */ x(function(i, s) { o.push([i, s]); }, "gatherEntries")), tt(n.sort(), o.sort(), r); } x(si, "entriesEqual"); function tt(e, t, r) { var n = e.length; if (n !== t.length) return !1; if (n === 0) return !0; for (var o = -1; ++o < n; ) if (jo(e[o], t[o], r) === !1) return !1; return !0; } x(tt, "iterableEqual"); function tf(e, t, r) { return tt(fa(e), fa(t), r); } x(tf, "generatorEqual"); function rf(e) { return typeof Symbol < "u" && typeof e == "object" && typeof Symbol.iterator < "u" && typeof e[Symbol.iterator] == "function"; } x(rf, "hasIteratorFunction"); function li(e) { if (rf(e)) try { return fa(e[Symbol.iterator]()); } catch { return []; } return []; } x(li, "getIteratorEntries"); function fa(e) { for (var t = e.next(), r = [t.value]; t.done === !1; ) t = e.next(), r.push(t.value); return r; } x(fa, "getGeneratorEntries"); function ui(e) { var t = []; for (var r in e) t.push(r); return t; } x(ui, "getEnumerableKeys"); function ci(e) { for (var t = [], r = Object.getOwnPropertySymbols(e), n = 0; n < r.length; n += 1) { var o = r[n]; Object.getOwnPropertyDescriptor(e, o).enumerable && t.push(o); } return t; } x(ci, "getEnumerableSymbols"); function Ni(e, t, r, n) { var o = r.length; if (o === 0) return !0; for (var a = 0; a < o; a += 1) if (jo(e[r[a]], t[r[a]], n) === !1) return !1; return !0; } x(Ni, "keysEqual"); function nf(e, t, r) { var n = ui(e), o = ui(t), a = ci(e), i = ci(t); if (n = n.concat(a), o = o.concat(i), n.length && n.length === o.length) return tt(di(n).sort(), di(o).sort()) === !1 ? !1 : Ni(e, t, n, r); var s = li(e), l = li(t); return s.length && s.length === l.length ? (s.sort(), l.sort(), tt(s, l, r)) : n.length === 0 && s.length === 0 && o.length === 0 && l.length === 0; } x(nf, "objectEqual"); function mt(e) { return e === null || typeof e != "object"; } x(mt, "isPrimitive"); function di(e) { return e.map(/* @__PURE__ */ x(function(r) { return typeof r == "symbol" ? r.toString() : r; }, "mapSymbol")); } x(di, "mapSymbols"); function Oa(e, t) { return typeof e > "u" || e === null ? !1 : t in Object(e); } x(Oa, "hasProperty"); function of(e) { return e.replace(/([^\\])\[/g, "$1.[").match(/(\\\.|[^.]+?)+/g).map((n) => { if (n === "constructor" || n === "__proto__" || n === "prototype") return {}; const a = /^\[(\d+)\]$/.exec(n); let i = null; return a ? i = { i: parseFloat(a[1]) } : i = { p: n.replace(/\\([.[\]])/g, "$1") }, i; }); } x(of, "parsePath"); function fi(e, t, r) { let n = e, o = null; r = typeof r > "u" ? t.length : r; for (let a = 0; a < r; a++) { const i = t[a]; n && (typeof i.p > "u" ? n = n[i.i] : n = n[i.p], a === r - 1 && (o = n)); } return o; } x(fi, "internalGetPathValue"); function ki(e, t) { const r = of(t), n = r[r.length - 1], o = { parent: r.length > 1 ? fi(e, r, r.length - 1) : e, name: n.p || n.i, value: fi(e, r) }; return o.exists = Oa(o.parent, o.name), o; } x(ki, "getPathInfo"); var pt, b = (pt = class { /** @type {{}} */ __flags = {}; /** * Creates object for chaining. * `Assertion` objects contain metadata in the form of flags. Three flags can * be assigned during instantiation by passing arguments to this constructor: * * - `object`: This flag contains the target of the assertion. For example, in * the assertion `expect(numKittens).to.equal(7);`, the `object` flag will * contain `numKittens` so that the `equal` assertion can reference it when * needed. * * - `message`: This flag contains an optional custom error message to be * prepended to the error message that's generated by the assertion when it * fails. * * - `ssfi`: This flag stands for "start stack function indicator". It * contains a function reference that serves as the starting point for * removing frames from the stack trace of the error that's created by the * assertion when it fails. The goal is to provide a cleaner stack trace to * end users by removing Chai's internal functions. Note that it only works * in environments that support `Error.captureStackTrace`, and only when * `Chai.config.includeStack` hasn't been set to `false`. * * - `lockSsfi`: This flag controls whether or not the given `ssfi` flag * should retain its current value, even as assertions are chained off of * this object. This is usually set to `true` when creating a new assertion * from within another assertion. It's also temporarily set to `true` before * an overwritten assertion gets called by the overwriting assertion. * * - `eql`: This flag contains the deepEqual function to be used by the assertion. * * @param {unknown} obj target of the assertion * @param {string} [msg] (optional) custom error message * @param {Function} [ssfi] (optional) starting point for removing stack frames * @param {boolean} [lockSsfi] (optional) whether or not the ssfi flag is locked */ constructor(t, r, n, o) { return z(this, "ssfi", n || pt), z(this, "lockSsfi", o), z(this, "object", t), z(this, "message", r), z(this, "eql", fe.deepEqual || Qd), At(this); } /** @returns {boolean} */ static get includeStack() { return console.warn( "Assertion.includeStack is deprecated, use chai.config.includeStack instead." ), fe.includeStack; } /** @param {boolean} value */ static set includeStack(t) { console.warn( "Assertion.includeStack is deprecated, use chai.config.includeStack instead." ), fe.includeStack = t; } /** @returns {boolean} */ static get showDiff() { return console.warn( "Assertion.showDiff is deprecated, use chai.config.showDiff instead." ), fe.showDiff; } /** @param {boolean} value */ static set showDiff(t) { console.warn( "Assertion.showDiff is deprecated, use chai.config.showDiff instead." ), fe.showDiff = t; } /** * @param {string} name * @param {Function} fn */ static addProperty(t, r) { Di(this.prototype, t, r); } /** * @param {string} name * @param {Function} fn */ static addMethod(t, r) { ji(this.prototype, t, r); } /** * @param {string} name * @param {Function} fn * @param {Function} chainingBehavior */ static addChainableMethod(t, r, n) { Li(this.prototype, t, r, n); } /** * @param {string} name * @param {Function} fn */ static overwriteProperty(t, r) { Bi(this.prototype, t, r); } /** * @param {string} name * @param {Function} fn */ static overwriteMethod(t, r) { $i(this.prototype, t, r); } /** * @param {string} name * @param {Function} fn * @param {Function} chainingBehavior */ static overwriteChainableMethod(t, r, n) { Fi(this.prototype, t, r, n); } /** * ### .assert(expression, message, negateMessage, expected, actual, showDiff) * * Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass. * * @name assert * @param {unknown} _expr to be tested * @param {string | Function} msg or function that returns message to display if expression fails * @param {string | Function} _negateMsg or function that returns negatedMessage to display if negated expression fails * @param {unknown} expected value (remember to check for negation) * @param {unknown} _actual (optional) will default to `this.obj` * @param {boolean} showDiff (optional) when set to `true`, assert will display a diff in addition to the message if expression fails * @returns {void} */ assert(t, r, n, o, a, i) { const s = Si(this, arguments); if (i !== !1 && (i = !0), o === void 0 && a === void 0 && (i = !1), fe.showDiff !== !0 && (i = !1), !s) { r = Ai(this, arguments); const u = { actual: Sa(this, arguments), expected: o, showDiff: i }, f = Vi(this, arguments); throw f && (u.operator = f), new J( r, u, // @ts-expect-error Not sure what to do about these types yet fe.includeStack ? this.assert : z(this, "ssfi") ); } } /** * Quick reference to stored `actual` value for plugin developers. * * @returns {unknown} */ get _obj() { return z(this, "object"); } /** * Quick reference to stored `actual` value for plugin developers. * * @param {unknown} val */ set _obj(t) { z(this, "object", t); } }, x(pt, "Assertion"), pt); function Bo() { return fe.useProxy && typeof Proxy < "u" && typeof Reflect < "u"; } x(Bo, "isProxyEnabled"); function Di(e, t, r) { r = r === void 0 ? function() { } : r, Object.defineProperty(e, t, { get: /* @__PURE__ */ x(function n() { !Bo() && !z(this, "lockSsfi") && z(this, "ssfi", n); let o = r.call(this); if (o !== void 0) return o; let a = new b(); return Te(this, a), a; }, "propertyGetter"), configurable: !0 }); } x(Di, "addProperty"); var Mm = Object.getOwnPropertyDescriptor(function() { }, "length"); function $o(e, t, r) { return Mm.configurable && Object.defineProperty(e, "length", { get: /* @__PURE__ */ x(function() { throw Error( r ? "Invalid Chai property: " + t + '.length. Due to a compatibility issue, "length" cannot directly follow "' + t + '". Use "' + t + '.lengthOf" instead.' : "Invalid Chai property: " + t + '.length. See docs for proper usage of "' + t + '".' ); }, "get") }), e; } x($o, "addLengthGuard"); function af(e) { let t = Object.getOwnPropertyNames(e); function r(o) { t.indexOf(o) === -1 && t.push(o); } x(r, "addProperty"); let n = Object.getPrototypeOf(e); for (; n !== null; ) Object.getOwnPropertyNames(n).forEach(r), n = Object.getPrototypeOf(n); return t; } x(af, "getProperties"); var Ns = ["__flags", "__methods", "_obj", "assert"]; function At(e, t) { return Bo() ? new Proxy(e, { get: /* @__PURE__ */ x(function r(n, o) { if (typeof o == "string" && fe.proxyExcludedKeys.indexOf(o) === -1 && !Reflect.has(n, o)) { if (t) throw Error( "Invalid Chai property: " + t + "." + o + '. See docs for proper usage of "' + t + '".' ); let a = null, i = 4; throw af(n).forEach(function(s) { if ( // we actually mean to check `Object.prototype` here // eslint-disable-next-line no-prototype-builtins !Object.prototype.hasOwnProperty(s) && Ns.indexOf(s) === -1 ) { let l = sf(o, s, i); l < i && (a = s, i = l); } }), Error( a !== null ? "Invalid Chai property: " + o + '. Did you mean "' + a + '"?' : "Invalid Chai property: " + o ); } return Ns.indexOf(o) === -1 && !z(n, "lockSsfi") && z(n, "ssfi", r), Reflect.get(n, o); }, "proxyGetter") }) : e; } x(At, "proxify"); function sf(e, t, r) { if (Math.abs(e.length - t.length) >= r) return r; let n = []; for (let o = 0; o <= e.length; o++) n[o] = Array(t.length + 1).fill(0), n[o][0] = o; for (let o = 0; o < t.length; o++) n[0][o] = o; for (let o = 1; o <= e.length; o++) { let a = e.charCodeAt(o - 1); for (let i = 1; i <= t.length; i++) { if (Math.abs(o - i) >= r) { n[o][i] = r; continue; } n[o][i] = Math.min( n[o - 1][i] + 1, n[o][i - 1] + 1, n[o - 1][i - 1] + (a === t.charCodeAt(i - 1) ? 0 : 1) ); } } return n[e.length][t.length]; } x(sf, "stringDistanceCapped"); function ji(e, t, r) { let n = /* @__PURE__ */ x(function() { z(this, "lockSsfi") || z(this, "ssfi", n); let o = r.apply(this, arguments); if (o !== void 0) return o; let a = new b(); return Te(this, a), a; }, "methodWrapper"); $o(n, t, !1), e[t] = At(n, t); } x(ji, "addMethod"); function Bi(e, t, r) { let n = Object.getOwnPropertyDescriptor(e, t), o = /* @__PURE__ */ x(function() { }, "_super"); n && typeof n.get == "function" && (o = n.get), Object.defineProperty(e, t, { get: /* @__PURE__ */ x(function a() { !Bo() && !z(this, "lockSsfi") && z(this, "ssfi", a); let i = z(this, "lockSsfi"); z(this, "lockSsfi", !0); let s = r(o).call(this); if (z(this, "lockSsfi", i), s !== void 0) return s; let l = new b(); return Te(this, l), l; }, "overwritingPropertyGetter"), configurable: !0 }); } x(Bi, "overwriteProperty"); function $i(e, t, r) { let n = e[t], o = /* @__PURE__ */ x(function() { throw new Error(t + " is not a function"); }, "_super"); n && typeof n == "function" && (o = n); let a = /* @__PURE__ */ x(function() { z(this, "lockSsfi") || z(this, "ssfi", a); let i = z(this, "lockSsfi"); z(this, "lockSsfi", !0); let s = r(o).apply(this, arguments); if (z(this, "lockSsfi", i), s !== void 0) return s; let l = new b(); return Te(this, l), l; }, "overwritingMethodWrapper"); $o(a, t, !1), e[t] = At(a, t); } x($i, "overwriteMethod"); var Im = typeof Object.setPrototypeOf == "function", ks = /* @__PURE__ */ x(function() { }, "testFn"), Nm = Object.getOwnPropertyNames(ks).filter(function(e) { let t = Object.getOwnPropertyDescriptor(ks, e); return typeof t != "object" ? !0 : !t.configurable; }), km = Function.prototype.call, Dm = Function.prototype.apply; function Li(e, t, r, n) { typeof n != "function" && (n = /* @__PURE__ */ x(function() { }, "chainingBehavior")); let o = { method: r, chainingBehavior: n }; e.__methods || (e.__methods = {}), e.__methods[t] = o, Object.defineProperty(e, t, { get: /* @__PURE__ */ x(function() { o.chainingBehavior.call(this); let i = /* @__PURE__ */ x(function() { z(this, "lockSsfi") || z(this, "ssfi", i); let s = o.method.apply(this, arguments); if (s !== void 0) return s; let l = new b(); return Te(this, l), l; }, "chainableMethodWrapper"); if ($o(i, t, !0), Im) { let s = Object.create(this); s.call = km, s.apply = Dm, Object.setPrototypeOf(i, s); } else Object.getOwnPropertyNames(e).forEach(function(l) { if (Nm.indexOf(l) !== -1) return; let u = Object.getOwnPropertyDescriptor(e, l); Object.defineProperty(i, l, u); }); return Te(this, i), At(i); }, "chainableMethodGetter"), configurable: !0 }); } x(Li, "addChainableMethod"); function Fi(e, t, r, n) { let o = e.__methods[t], a = o.chainingBehavior; o.chainingBehavior = /* @__PURE__ */ x(function() { let l = n(a).call(this); if (l !== void 0) return l; let u = new b(); return Te(this, u), u; }, "overwritingChainableMethodGetter"); let i = o.method; o.method = /* @__PURE__ */ x(function() { let l = r(i).apply(this, arguments); if (l !== void 0) return l; let u = new b(); return Te(this, u), u; }, "overwritingChainableMethodWrapper"); } x(Fi, "overwriteChainableMethod"); function pa(e, t) { return K(e) < K(t) ? -1 : 1; } x(pa, "compareByInspect"); function Ui(e) { return typeof Object.getOwnPropertySymbols != "function" ? [] : Object.getOwnPropertySymbols(e).filter(function(t) { return Object.getOwnPropertyDescriptor(e, t).enumerable; }); } x(Ui, "getOwnEnumerablePropertySymbols"); function zi(e) { return Object.keys(e).concat(Ui(e)); } x(zi, "getOwnEnumerableProperties"); var ma = Number.isNaN; function lf(e) { let t = re(e); return ["Array", "Object", "Function"].indexOf(t) !== -1; } x(lf, "isObjectType"); function Vi(e, t) { let r = z(e, "operator"), n = z(e, "negate"), o = t[3], a = n ? t[2] : t[1]; if (r) return r; if (typeof a == "function" && (a = a()), a = a || "", !a || /\shave\s/.test(a)) return; let i = lf(o); return /\snot\s/.test(a) ? i ? "notDeepStrictEqual" : "notStrictEqual" : i ? "deepStrictEqual" : "strictEqual"; } x(Vi, "getOperator"); function Aa(e) { return e.name; } x(Aa, "getName"); function ha(e) { return Object.prototype.toString.call(e) === "[object RegExp]"; } x(ha, "isRegExp"); function ue(e) { return ["Number", "BigInt"].includes(re(e)); } x(ue, "isNumeric"); var { flag: w } = ua; [ "to", "be", "been", "is", "and", "has", "have", "with", "that", "which", "at", "of", "same", "but", "does", "still", "also" ].forEach(function(e) { b.addProperty(e); }); b.addProperty("not", function() { w(this, "negate", !0); }); b.addProperty("deep", function() { w(this, "deep", !0); }); b.addProperty("nested", function() { w(this, "nested", !0); }); b.addProperty("own", function() { w(this, "own", !0); }); b.addProperty("ordered", function() { w(this, "ordered", !0); }); b.addProperty("any", function() { w(this, "any", !0), w(this, "all", !1); }); b.addProperty("all", function() { w(this, "all", !0), w(this, "any", !1); }); var Ds = { function: [ "function", "asyncfunction", "generatorfunction", "asyncgeneratorfunction" ], asyncfunction: ["asyncfunction", "asyncgeneratorfunction"], generatorfunction: ["generatorfunction", "asyncgeneratorfunction"], asyncgeneratorfunction: ["asyncgeneratorfunction"] }; function Hi(e, t) { t && w(this, "message", t), e = e.toLowerCase(); let r = w(this, "object"), n = ~["a", "e", "i", "o", "u"].indexOf(e.charAt(0)) ? "an " : "a "; const o = re(r).toLowerCase(); Ds.function.includes(e) ? this.assert( Ds[e].includes(o), "expected #{this} to be " + n + e, "expected #{this} not to be " + n + e ) : this.assert( e === o, "expected #{this} to be " + n + e