@remotex-labs/xjet 1.2.3 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,66 +1,66 @@
1
- var Xe=Object.defineProperty;var a=(t,e)=>Xe(t,"name",{value:e,configurable:!0});var Ze="xJet.mock()",K=class extends Function{static{a(this,"MockState")}static mocks=new Set;name;xJetMock=!0;state;queuedImplementations=[];implementation;originalImplementation;restore;constructor(e,i,r){return super(),this.name=r??Ze,this.state=this.initState(),this.implementation=e||void 0,this.restore=i,this.originalImplementation=e||(()=>{}),new Proxy(this,{get:this.invokeGet,apply:this.invokeFunction,construct:this.invokeClass})}get mock(){return Object.freeze({...this.state})}get original(){return this.originalImplementation}mockClear(){return this.state=this.initState(),this}mockReset(){return this.mockClear(),this.queuedImplementations=[],this}mockRestore(){this.mockReset();let e=this.restore?.();return typeof e=="function"?this.implementation=e:this.implementation=this.originalImplementation,this}getMockImplementation(){return this.implementation}getNextImplementation(){return this.queuedImplementations.length?this.queuedImplementations.shift():this.implementation}mockImplementation(e){return this.implementation=e,this}mockImplementationOnce(e){return this.queuedImplementations.push(e),this}mockReturnValue(e){return this.mockImplementation(()=>e),this}mockReturnValueOnce(e){return this.mockImplementationOnce(()=>e),this}mockResolvedValue(e){return this.mockImplementation(()=>Promise.resolve(e)),this}mockResolvedValueOnce(e){return this.mockImplementationOnce(()=>Promise.resolve(e)),this}mockRejectedValue(e){return this.mockImplementation(()=>Promise.reject(e)),this}mockRejectedValueOnce(e){return this.mockImplementationOnce(()=>Promise.reject(e)),this}[Symbol.for("nodejs.util.inspect.custom")](){return`<Mock Constructor ${this.name}>`}initState(){return{calls:[],results:[],lastCall:void 0,contexts:[],instances:[],invocationCallOrder:[]}}invoke(e,i){let r=e,n=this.getNextImplementation(),s=i;typeof n=="function"&&(n.__boundArgs&&s.unshift(...n.__boundArgs),n.__boundThis&&(r=n.__boundThis)),this.state.calls.push(s),this.state.contexts.push(r),this.state.invocationCallOrder.push(this.state.invocationCallOrder.length+1);let o,c=this.state.results.push({value:void 0,type:"incomplete"})-1;if(n)try{o={type:"return",value:n.call(void 0,...i)}}catch(l){o={value:l,type:"throw"}}else o={type:"return",value:void 0};return this.state.lastCall=i,this.state.results[c]=o,o.value}invokeGet(e,i){return Reflect.has(e,i)?Reflect.get(e,i):Reflect.get(e.originalImplementation,i)}invokeClass(e,i,r){let n=e.invoke.call(e,r,i),s=typeof n=="object"&&n!==null&&"constructor"in n;return e.state.instances.push(s?n:r),typeof n=="object"?n:r}invokeFunction(e,i,r){return e.state.instances.push(i),e.invoke.call(e,i,r)}};var Qe={dim:[2,22],bold:[1,22],reset:[0,0],hidden:[8,28],inverse:[7,27]},et={red:[31,39],gray:[90,39],blue:[34,39],cyan:[36,39],black:[30,39],white:[37,39],green:[32,39],yellow:[33,39],magenta:[35,39],redBright:[91,39],blueBright:[94,39],cyanBright:[96,39],whiteBright:[97,39],greenBright:[92,39],blackBright:[90,39],yellowBright:[93,39],magentaBright:[95,39],darkGray:["38;5;238",39],lightGray:["38;5;252",39],lightCyan:["38;5;81",39],lightCoral:["38;5;203",39],oliveGreen:["38;5;149",39],deepOrange:["38;5;166",39],brightPink:["38;5;197",39],lightOrange:["38;5;215",39],burntOrange:["38;5;208",39],lightYellow:["38;5;230",39],canaryYellow:["38;5;227",39],lightGoldenrodYellow:["38;5;221",39]},tt={bgRed:[41,49],bgBlue:[44,49],bgCyan:[46,49],bgGray:[100,49],bgBlack:[40,49],bgGreen:[42,49],bgWhite:[47,49],bgYellow:[43,49],bgMagenta:[45,49],bgRedBright:[101,49],bgBlueBright:[104,49],bgCyanBright:[106,49],bgBlackBright:[100,49],bgWhiteBright:[107,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgMagentaBright:[105,49]},ae={...Qe,...et,...tt},N="\x1B[",U="m";function ce(t,e){if(globalThis.NO_COLOR)return e;let i=t.length;if(i===0)return e;if(i===1)return`${N}${t[0][0]}${U}${e}${N}${t[0][1]}${U}`;let r=new Array(i),n=new Array(i);for(let s=0;s<i;s++)n[s]=`${N}${t[s][0]}${U}`,r[i-s-1]=`${N}${t[s][1]}${U}`;return n.concat(e,r).join("")}a(ce,"I");function D(t,e,i,r){if(typeof e!="number"||typeof i!="number"||typeof r!="number")throw new Error(`RGB values must be numbers, received: r=${typeof e}, g=${typeof i}, b=${typeof r}`);let n=t==="fg"?38:48,s=t==="fg"?39:49;return[`${n};2;${e};${i};${r}`,s]}a(D,"d");function le(t){let e=t.replace(/^#/,"").toLowerCase();if(!/^([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(e))throw new Error(`Invalid hex color format: "${t}". Expected 3 or 6 hex digits.`);if(e.length===3){let s=parseInt(e[0]+e[0],16),o=parseInt(e[1]+e[1],16),c=parseInt(e[2]+e[2],16);return[s,o,c]}let i=parseInt(e.slice(0,2),16),r=parseInt(e.slice(2,4),16),n=parseInt(e.slice(4,6),16);return[i,r,n]}a(le,"_");function j(t=[]){let e=a((...r)=>{if(Array.isArray(r[0])&&"raw"in r[0]){let[n,...s]=r,o=n.reduce((c,l,u)=>c+l+(u<s.length?String(s[u]??""):""),"");return ce(t,o)}return ce(t,r.join(" "))},"e"),i={rgb:a((r,n,s)=>j([...t,D("fg",r,n,s)]),"rgb"),bgRgb:a((r,n,s)=>j([...t,D("bg",r,n,s)]),"bgRgb"),hex:a(r=>j([...t,D("fg",...le(r))]),"hex"),bgHex:a(r=>j([...t,D("bg",...le(r))]),"bgHex")};return new Proxy(e,{get(r,n){if(typeof n!="string")throw new Error(`Invalid property: ${String(n)}`);return n in ae?j([...t,ae[n]]):n in i?i[n]:Reflect.get(r,n)}})}a(j,"g");var T=j();function it(t,e){return e!=null&&(e.constructor===t||typeof e=="function")}a(it,"isA");function X(t,e){return t==null||typeof t!="object"&&typeof t!="function"?!1:e in t||Object.prototype.hasOwnProperty.call(t,e)}a(X,"hasKey");function S(t){return!!t&&X(t,"expectedLabel")&&it(Function,t.matches)}a(S,"isAsymmetric");function be(t,e){let i=S(t),r=S(e);if(!(i&&r)){if(i)return t.matches(e);if(r)return e.matches(t)}}a(be,"asymmetricMatch");function rt(t,e,i=!0){if(Array.isArray(t)&&Array.isArray(e))return i&&t.length!==e.length?!1:t.every((s,o)=>v(s,e[o],i));let r=Object.keys(t),n=Object.keys(e);if(i&&r.length!==n.length)return!1;for(let s of r)if(!X(e,s)||!v(t[s],e[s],i))return!1;return!0}a(rt,"deepEquals");function v(t,e,i=!0){if(t===e||Object.is(t,e))return!0;if(t===null||e===null)return!1;let r=be(t,e);return r!==void 0?r:t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():t instanceof RegExp&&e instanceof RegExp?t.source===e.source&&t.flags===e.flags:globalThis.URL&&t instanceof globalThis.URL&&e instanceof globalThis.URL?t.href===e.href:typeof t=="object"&&typeof e=="object"?rt(t,e,i):!1}a(v,"equals");function nt(t){let e={};for(let i of Object.keys(t)){let r=t[i];r&&(e[i]=r)}return e.name=t.name,e.stack=t.stack,e.message=t.message,e}a(nt,"serializesError");function st(t){return t!=null&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}a(st,"isPromise");var Ee=" ";function ot(t){return typeof t=="string"?t.includes(`
2
- `)?null:`"${t}"`:typeof t=="number"?`${Number.isFinite(t)?t:t.toString()}`:typeof t=="boolean"?`${t}`:typeof t=="symbol"?`${t.toString()}`:typeof t=="bigint"?`${t}n`:typeof t=="function"?`[Function: ${t.name||"anonymous"}]`:t===null?"null":t===void 0?"undefined":S(t)?t.expectedLabel??t.constructor.name:t instanceof Date?`[Date: ${t.toISOString()}]`:t instanceof RegExp?t.toString():t instanceof Error?`[${t.name}: ${t.message}]`:t instanceof Promise?"[Promise <pending>]":t instanceof ArrayBuffer?`ArrayBuffer { byteLength: ${t.byteLength} }`:t instanceof DataView?`DataView { byteLength: ${t.byteLength}, byteOffset: ${t.byteOffset} }`:null}a(ot,"serializePrimitive");function at(t){return t===null?"null":t===void 0?"undefined":typeof t=="object"?Object.prototype.toString.call(t):JSON.stringify(t)}a(at,"serializeMapKey");function H(t,e,i,r,n=""){if(t.length===0)return;if(t.length<2){let o=`${n}${i}${t[t.length-1]}`;e.push(r?o:`${o},`);return}e.push(`${n}${i}${t[0]}`);for(let o=1;o<t.length-1;o++)e.push(n+t[o]);let s=`${n}${t[t.length-1]}`;e.push(r?s:`${s},`)}a(H,"appendLines");function ct(t,e,i,r){if(t.size===0){e.push("Map {}");return}e.push("Map {");let n=Array.from(t.entries());n.forEach(([s,o],c)=>{let l=at(s),u=[];M(o,u,i,r),H(u,e,`${l} => `,c===n.length-1,i)}),e.push("}")}a(ct,"serializeMap");function lt(t,e,i,r){if(t.length===0){e.push("[]");return}e.push("["),t.forEach((n,s)=>{let o=[];M(n,o,i,r),H(o,e,"",s===t.length-1,i)}),e.push("]")}a(lt,"serializeArray");function ht(t,e,i,r){if(t.size===0){e.push("Set {}");return}e.push("Set {");let n=Array.from(t);n.forEach((s,o)=>{let c=[];M(s,c,i,r),H(c,e,"",o===n.length-1,i)}),e.push("}")}a(ht,"serializeSet");function ut(t,e,i){let r=Array.from(t);if(r.length===0){e.push("Buffer {}");return}e.push("Buffer {");for(let n=0;n<r.length;n++){let s=r[n],o=n===r.length-1?"":",";e.push(`${i}${s}${o}`)}e.push("}")}a(ut,"serializeBuffer");function pt(t,e,i){let r=Object.prototype.toString.call(t).slice(8,-1),n=Array.from(t);if(n.length===0){e.push(`${r} []`);return}e.push(`${r} [`);for(let s=0;s<n.length;s++){let o=n[s],c=s===n.length-1?"":",";e.push(`${i}${o}${c}`)}e.push("]")}a(pt,"serializeTypedArray");function he(t,e,i,r){let n=t.constructor&&t.constructor!==Object?t.constructor.name:"Object",s=Object.entries(t);if(s.length===0){e.push(`${n} {}`);return}e.push(`${n} {`),s.forEach(([o,c],l)=>{let u=[];M(c,u,i,r),H(u,e,`${String(o)}: `,l===s.length-1,i)}),e.push("}")}a(he,"serializeObject");function M(t,e,i=Ee,r){let n=ot(t);if(n!==null){e.push(n);return}if(typeof t=="string"){let s=t.split(`
3
- `);e.push('String "');for(let o of s)e.push(`${i}${o}`);e.push('"');return}if(typeof t=="object"&&t!==null){if(r.has(t)){e.push("[Circular]");return}r.add(t),t instanceof Map?ct(t,e,i,r):Array.isArray(t)?lt(t,e,i,r):t instanceof Set?ht(t,e,i,r):t instanceof Buffer?ut(t,e,i):ArrayBuffer.isView(t)&&!(t instanceof DataView)?pt(t,e,i):he(t,e,i,r);return}he(t,e,i,r)}a(M,"serializeValue");function q(t){if(t&&typeof t=="object"){if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();let e={};for(let[i,r]of Object.entries(t))r!==void 0&&(e[i]=r);return e.name=t?.name??e.name,e.message=t?.message??e.message,e.stack=t?.stack??e.stack,e}return t}a(q,"serializeError");function $(t,e=Ee){let i=[];return M(t,i,e,new WeakSet),i}a($,"serialize");var ft=(t=>(t[t.DELETE=-1]="DELETE",t[t.EQUAL=0]="EQUAL",t[t.INSERT=1]="INSERT",t))(ft||{});function dt(){let t=0;for(;this.aStart+t<this.aEnd&&this.bStart+t<this.bEnd&&this.isMatch(this.aStart+t,this.bStart+t);)t++;return t}a(dt,"countCommonForward");function gt(){let t=0;for(;this.aEnd-1-t>=this.aStart&&this.bEnd-1-t>=this.bStart&&this.isMatch(this.aEnd-1-t,this.bEnd-1-t);)t++;return t}a(gt,"countCommonBackward");function mt(t,e,i){let r=this.aEnd-this.aStart,n=this.bEnd-this.bStart,s=[];for(let o=i;o>0;o--){let c=t[o-1],l=r-n,u,d=c[l-1+e],g=c[l+1+e];l===-o||l!==o&&d<g?u=l+1:u=l-1;let x=u+e,y=c[x],E=y-u;for(;r>y&&n>E;)--r,--n,s.push([1,this.aStart+r,this.bStart+n]);r===y?s.push([0,this.aStart+y,this.bStart+E]):s.push([0,this.aStart+y,this.bStart+E]),r=y,n=E}for(let o of s.reverse())this.foundSubsequence(...o)}a(mt,"backtrackFlat");function yt(){let t=this.aEnd-this.aStart,e=this.bEnd-this.bStart,i=t+e,r=0,n=new Array(2*i+1).fill(0),s=[];for(let o=0;o<=i;o++){let c=new Array(2*i+1);s[o]=c;for(let l=-o;l<=o;l+=2){let u=l+i,d;l===-o||l!==o&&n[l-1+i]<n[l+1+i]?d=n[l+1+i]:d=n[l-1+i]+1;let g=d-l;for(;d<t&&g<e&&this.isMatch(this.aStart+d,this.bStart+g);)d++,g++;if(n[u]=d,c[u]=d,d>=t&&g>=e)return r=o,mt.call(this,s,i,r)}}}a(yt,"findMiddleSnake");function vt(){let t=dt.call(this),e=this.aStart+t>=this.aEnd&&this.bStart+t>=this.bEnd;if(t>0&&(this.foundSubsequence(t,this.aStart,this.bStart),e))return;this.aStart+=t,this.bStart+=t;let i=gt.call(this);this.aEnd-=i,this.bEnd-=i,(this.aStart<this.aEnd||this.bStart<this.bEnd)&&yt.call(this),i>0&&this.foundSubsequence(i,this.aEnd,this.bEnd)}a(vt,"diffSequence");function $e(t,e,i,r){let n={aStart:0,bStart:0,aEnd:t,bEnd:e,isMatch:i,foundSubsequence:r};vt.call(n)}a($e,"createDiff");function xe(t,e){let i=0,r=0,n="",s="",o=[];function c(l,u){let d=o[o.length-1];d&&d[0]===l?d[1]+=u:o.push([l,u])}return a(c,"pushDiff"),$e(t.length,e.length,(l,u)=>t[l]===e[u],(l,u,d)=>{i!==u&&(s+=t.slice(i,u)),r!==d&&(n+=e.slice(r,d)),l>0&&(s&&(c(-1,s),s=""),n&&(c(1,n),n=""),c(0,e.slice(d,d+l))),i=u+l,r=d+l}),i!==t.length&&(s+=t.slice(i)),r!==e.length&&(n+=e.slice(r)),s&&o.push([-1,s]),n&&o.push([1,n]),o}a(xe,"diffStringsRaw");function Se(t,e){let i=0,r=0,n=[];for($e(t.length,e.length,(s,o)=>{let c=t[s].trimEnd().endsWith(","),l=e[o].trimEnd().endsWith(",");return c&&!l?e[o]+=",":!c&&l&&(t[s]+=","),t[s]===e[o]},(s,o,c)=>{for(;i!==o;i+=1)n.push([-1,t[i]]);for(;r!==c;r+=1)n.push([1,e[r]]);for(;s!==0;s-=1,i+=1,r+=1)n.push([0,e[r]])});i!==t.length;i+=1)n.push([-1,t[i]]);for(;r!==e.length;r+=1)n.push([1,e[r]]);return n}a(Se,"diffLinesRaw");function Ie(t){let e=[],i=[],r=[],n=a(()=>{e.length&&(r.push([-1,e.join("")]),e=[]),i.length&&(r.push([1,i.join("")]),i=[])},"flushBuffers");for(let s=0;s<t.length;s++){let[o,c]=t[s];if(o===0){if(c.length<=1){let l=s>0?t[s-1][0]:null,u=s+1<t.length?t[s+1][0]:null,d=a(g=>g===-1||g===1,"isEdit");if(d(l)&&d(u)){for(let g of c)e.push(g),i.push(g);continue}}n(),r.push([0,c])}else if(o===-1)for(let l of c)e.push(l);else if(o===1)for(let l of c)i.push(l);else n(),r.push([o,c])}return n(),r}a(Ie,"cleanupSemantic");var I=T.dim,bt=T.lightOrange,h=T.lightCoral,f=T.oliveGreen,we=T.cyan,k=T.inverse,Ji=T.whiteBright;function w(t){return t===null?"null":t===!0?"true":t===!1?"false":t&&typeof t=="object"?t.constructor?.name??"Object":typeof t}a(w,"getType");function Et(t,e,i=!0){let r="",n="",s=xe(t||" ",e||" ");i&&(s=Ie(s));for(let[o,c]of s)o===0?(r+=c,n+=c):o===-1?r+=k(c):o===1&&(n+=k(c));return[r,n]}a(Et,"normalizeStrings");function $t(t,e){let i=[...t],r=[...e],n=Math.max(t.length,e.length);for(let s=0;s<n;s++)[i[s],r[s]]=J(t[s],e[s]);return[i,r]}a($t,"normalizeArrays");function xt(t,e){let i={...t},r={...e},n=new Set([...Object.keys(t),...Object.keys(e)]);for(let s of n)s in t&&s in e&&([i[s],r[s]]=J(t[s],e[s]));return[i,r]}a(xt,"normalizeObjects");function J(t,e,i=!0){if(t===e)return[t,e];let r=typeof t,n=typeof e;return be(t,e)===!0?(S(t)&&(t=e),S(e)&&(e=t),[t,e]):r==="string"&&n==="string"?Et(t,e,i):!t||!e||r!=="object"||n!=="object"?[t,e]:Array.isArray(t)&&Array.isArray(e)?$t(t,e):xt(t,e)}a(J,"normalizeAsymmetric");function St(t,e,i,r=!0){let n=t.split(`
4
- `),s=e.split(`
1
+ var Xe=Object.defineProperty;var a=(e,t)=>Xe(e,"name",{value:t,configurable:!0});var Ze="xJet.mock()",K=class extends Function{static{a(this,"MockState")}static mocks=new Set;name;xJetMock=!0;state;queuedImplementations=[];implementation;originalImplementation;restore;constructor(t,i,r){return super(),this.name=r??Ze,this.state=this.initState(),this.implementation=t||void 0,this.restore=i,this.originalImplementation=t||(()=>{}),new Proxy(this,{get:this.invokeGet,apply:this.invokeFunction,construct:this.invokeClass})}get mock(){return Object.freeze({...this.state})}get original(){return this.originalImplementation}mockClear(){return this.state=this.initState(),this}mockReset(){return this.mockClear(),this.queuedImplementations=[],this}mockRestore(){this.mockReset();let t=this.restore?.();return typeof t=="function"?this.implementation=t:this.implementation=this.originalImplementation,this}getMockImplementation(){return this.implementation}getNextImplementation(){return this.queuedImplementations.length?this.queuedImplementations.shift():this.implementation}mockImplementation(t){return this.implementation=t,this}mockImplementationOnce(t){return this.queuedImplementations.push(t),this}mockReturnValue(t){return this.mockImplementation(()=>t),this}mockReturnValueOnce(t){return this.mockImplementationOnce(()=>t),this}mockResolvedValue(t){return this.mockImplementation(()=>Promise.resolve(t)),this}mockResolvedValueOnce(t){return this.mockImplementationOnce(()=>Promise.resolve(t)),this}mockRejectedValue(t){return this.mockImplementation(()=>Promise.reject(t)),this}mockRejectedValueOnce(t){return this.mockImplementationOnce(()=>Promise.reject(t)),this}[Symbol.for("nodejs.util.inspect.custom")](){return`<Mock Constructor ${this.name}>`}initState(){return{calls:[],results:[],lastCall:void 0,contexts:[],instances:[],invocationCallOrder:[]}}invoke(t,i){let r=t,n=this.getNextImplementation(),s=i;typeof n=="function"&&(n.__boundArgs&&s.unshift(...n.__boundArgs),n.__boundThis&&(r=n.__boundThis)),this.state.calls.push(s),this.state.contexts.push(r),this.state.invocationCallOrder.push(this.state.invocationCallOrder.length+1);let o,c=this.state.results.push({value:void 0,type:"incomplete"})-1;if(n)try{o={type:"return",value:n.call(void 0,...i)}}catch(l){o={value:l,type:"throw"}}else o={type:"return",value:void 0};return this.state.lastCall=i,this.state.results[c]=o,o.value}invokeGet(t,i){return Reflect.has(t,i)?Reflect.get(t,i):Reflect.get(t.originalImplementation,i)}invokeClass(t,i,r){let n=t.invoke.call(t,r,i),s=typeof n=="object"&&n!==null&&"constructor"in n;return t.state.instances.push(s?n:r),typeof n=="object"?n:r}invokeFunction(t,i,r){return t.state.instances.push(i),t.invoke.call(t,i,r)}};var Qe={dim:[2,22],bold:[1,22],reset:[0,0],hidden:[8,28],inverse:[7,27]},et={red:[31,39],gray:[90,39],blue:[34,39],cyan:[36,39],black:[30,39],white:[37,39],green:[32,39],yellow:[33,39],magenta:[35,39],redBright:[91,39],blueBright:[94,39],cyanBright:[96,39],whiteBright:[97,39],greenBright:[92,39],blackBright:[90,39],yellowBright:[93,39],magentaBright:[95,39],darkGray:["38;5;238",39],lightGray:["38;5;252",39],lightCyan:["38;5;81",39],lightCoral:["38;5;203",39],oliveGreen:["38;5;149",39],deepOrange:["38;5;166",39],brightPink:["38;5;197",39],lightOrange:["38;5;215",39],burntOrange:["38;5;208",39],lightYellow:["38;5;230",39],canaryYellow:["38;5;227",39],lightGoldenrodYellow:["38;5;221",39]},tt={bgRed:[41,49],bgBlue:[44,49],bgCyan:[46,49],bgGray:[100,49],bgBlack:[40,49],bgGreen:[42,49],bgWhite:[47,49],bgYellow:[43,49],bgMagenta:[45,49],bgRedBright:[101,49],bgBlueBright:[104,49],bgCyanBright:[106,49],bgBlackBright:[100,49],bgWhiteBright:[107,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgMagentaBright:[105,49]},ae={...Qe,...et,...tt},N="\x1B[",U="m";function ce(e,t){if(globalThis.NO_COLOR)return t;let i=e.length;if(i===0)return t;if(i===1)return`${N}${e[0][0]}${U}${t}${N}${e[0][1]}${U}`;let r=new Array(i),n=new Array(i);for(let s=0;s<i;s++)n[s]=`${N}${e[s][0]}${U}`,r[i-s-1]=`${N}${e[s][1]}${U}`;return n.concat(t,r).join("")}a(ce,"I");function D(e,t,i,r){if(typeof t!="number"||typeof i!="number"||typeof r!="number")throw new Error(`RGB values must be numbers, received: r=${typeof t}, g=${typeof i}, b=${typeof r}`);let n=e==="fg"?38:48,s=e==="fg"?39:49;return[`${n};2;${t};${i};${r}`,s]}a(D,"d");function le(e){let t=e.replace(/^#/,"").toLowerCase();if(!/^([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(t))throw new Error(`Invalid hex color format: "${e}". Expected 3 or 6 hex digits.`);if(t.length===3){let s=parseInt(t[0]+t[0],16),o=parseInt(t[1]+t[1],16),c=parseInt(t[2]+t[2],16);return[s,o,c]}let i=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),n=parseInt(t.slice(4,6),16);return[i,r,n]}a(le,"_");function P(e=[]){let t=a((...r)=>{if(Array.isArray(r[0])&&"raw"in r[0]){let[n,...s]=r,o=n.reduce((c,l,u)=>c+l+(u<s.length?String(s[u]??""):""),"");return ce(e,o)}return ce(e,r.join(" "))},"e"),i={rgb:a((r,n,s)=>P([...e,D("fg",r,n,s)]),"rgb"),bgRgb:a((r,n,s)=>P([...e,D("bg",r,n,s)]),"bgRgb"),hex:a(r=>P([...e,D("fg",...le(r))]),"hex"),bgHex:a(r=>P([...e,D("bg",...le(r))]),"bgHex")};return new Proxy(t,{get(r,n){if(typeof n!="string")throw new Error(`Invalid property: ${String(n)}`);return n in ae?P([...e,ae[n]]):n in i?i[n]:Reflect.get(r,n)}})}a(P,"g");var R=P();function it(e,t){return t!=null&&(t.constructor===e||typeof t=="function")}a(it,"isA");function X(e,t){return e==null||typeof e!="object"&&typeof e!="function"?!1:t in e||Object.prototype.hasOwnProperty.call(e,t)}a(X,"hasKey");function x(e){return!!e&&X(e,"expectedLabel")&&it(Function,e.matches)}a(x,"isAsymmetric");function be(e,t){let i=x(e),r=x(t);if(!(i&&r)){if(i)return e.matches(t);if(r)return t.matches(e)}}a(be,"asymmetricMatch");function rt(e,t,i=!0){if(Array.isArray(e)&&Array.isArray(t))return i&&e.length!==t.length?!1:e.every((s,o)=>v(s,t[o],i));let r=Object.keys(e),n=Object.keys(t);if(i&&r.length!==n.length)return!1;for(let s of r)if(!X(t,s)||!v(e[s],t[s],i))return!1;return!0}a(rt,"deepEquals");function v(e,t,i=!0){if(e===t||Object.is(e,t))return!0;if(e===null||t===null)return!1;let r=be(e,t);return r!==void 0?r:e instanceof Date&&t instanceof Date?e.getTime()===t.getTime():e instanceof RegExp&&t instanceof RegExp?e.source===t.source&&e.flags===t.flags:globalThis.URL&&e instanceof globalThis.URL&&t instanceof globalThis.URL?e.href===t.href:typeof e=="object"&&typeof t=="object"?rt(e,t,i):!1}a(v,"equals");function nt(e){let t={};for(let i of Object.keys(e)){let r=e[i];r&&(t[i]=r)}return t.name=e.name,t.stack=e.stack,t.message=e.message,t}a(nt,"serializesError");function st(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}a(st,"isPromise");var Ee=" ";function ot(e){return typeof e=="string"?e.includes(`
2
+ `)?null:`"${e}"`:typeof e=="number"?`${Number.isFinite(e)?e:e.toString()}`:typeof e=="boolean"?`${e}`:typeof e=="symbol"?`${e.toString()}`:typeof e=="bigint"?`${e}n`:typeof e=="function"?`[Function: ${e.name||"anonymous"}]`:e===null?"null":e===void 0?"undefined":x(e)?e.expectedLabel??e.constructor.name:e instanceof Date?`[Date: ${e.toISOString()}]`:e instanceof RegExp?e.toString():e instanceof Error?`[${e.name}: ${e.message}]`:e instanceof Promise?"[Promise <pending>]":e instanceof ArrayBuffer?`ArrayBuffer { byteLength: ${e.byteLength} }`:e instanceof DataView?`DataView { byteLength: ${e.byteLength}, byteOffset: ${e.byteOffset} }`:null}a(ot,"serializePrimitive");function at(e){return e===null?"null":e===void 0?"undefined":typeof e=="object"?Object.prototype.toString.call(e):JSON.stringify(e)}a(at,"serializeMapKey");function H(e,t,i,r,n=""){if(e.length===0)return;if(e.length<2){let o=`${n}${i}${e[e.length-1]}`;t.push(r?o:`${o},`);return}t.push(`${n}${i}${e[0]}`);for(let o=1;o<e.length-1;o++)t.push(n+e[o]);let s=`${n}${e[e.length-1]}`;t.push(r?s:`${s},`)}a(H,"appendLines");function ct(e,t,i,r){if(e.size===0){t.push("Map {}");return}t.push("Map {");let n=Array.from(e.entries());n.forEach(([s,o],c)=>{let l=at(s),u=[];M(o,u,i,r),H(u,t,`${l} => `,c===n.length-1,i)}),t.push("}")}a(ct,"serializeMap");function lt(e,t,i,r){if(e.length===0){t.push("[]");return}t.push("["),e.forEach((n,s)=>{let o=[];M(n,o,i,r),H(o,t,"",s===e.length-1,i)}),t.push("]")}a(lt,"serializeArray");function ht(e,t,i,r){if(e.size===0){t.push("Set {}");return}t.push("Set {");let n=Array.from(e);n.forEach((s,o)=>{let c=[];M(s,c,i,r),H(c,t,"",o===n.length-1,i)}),t.push("}")}a(ht,"serializeSet");function ut(e,t,i){let r=Array.from(e);if(r.length===0){t.push("Buffer {}");return}t.push("Buffer {");for(let n=0;n<r.length;n++){let s=r[n],o=n===r.length-1?"":",";t.push(`${i}${s}${o}`)}t.push("}")}a(ut,"serializeBuffer");function pt(e,t,i){let r=Object.prototype.toString.call(e).slice(8,-1),n=Array.from(e);if(n.length===0){t.push(`${r} []`);return}t.push(`${r} [`);for(let s=0;s<n.length;s++){let o=n[s],c=s===n.length-1?"":",";t.push(`${i}${o}${c}`)}t.push("]")}a(pt,"serializeTypedArray");function he(e,t,i,r){let n=e.constructor&&e.constructor!==Object?e.constructor.name:"Object",s=Object.entries(e);if(s.length===0){t.push(`${n} {}`);return}t.push(`${n} {`),s.forEach(([o,c],l)=>{let u=[];M(c,u,i,r),H(u,t,`${String(o)}: `,l===s.length-1,i)}),t.push("}")}a(he,"serializeObject");function M(e,t,i=Ee,r){let n=ot(e);if(n!==null){t.push(n);return}if(typeof e=="string"){let s=e.split(`
3
+ `);t.push('String "');for(let o of s)t.push(`${i}${o}`);t.push('"');return}if(typeof e=="object"&&e!==null){if(r.has(e)){t.push("[Circular]");return}r.add(e),e instanceof Map?ct(e,t,i,r):Array.isArray(e)?lt(e,t,i,r):e instanceof Set?ht(e,t,i,r):e instanceof Buffer?ut(e,t,i):ArrayBuffer.isView(e)&&!(e instanceof DataView)?pt(e,t,i):he(e,t,i,r);return}he(e,t,i,r)}a(M,"serializeValue");function q(e){if(e&&typeof e=="object"){if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();let t={};for(let[i,r]of Object.entries(e))r!==void 0&&(t[i]=r);return t.name=e?.name??t.name,t.message=e?.message??t.message,t.stack=e?.stack??t.stack,t}return e}a(q,"serializeError");function $(e,t=Ee){let i=[];return M(e,i,t,new WeakSet),i}a($,"serialize");var ft=(e=>(e[e.DELETE=-1]="DELETE",e[e.EQUAL=0]="EQUAL",e[e.INSERT=1]="INSERT",e))(ft||{});function dt(){let e=0;for(;this.aStart+e<this.aEnd&&this.bStart+e<this.bEnd&&this.isMatch(this.aStart+e,this.bStart+e);)e++;return e}a(dt,"countCommonForward");function gt(){let e=0;for(;this.aEnd-1-e>=this.aStart&&this.bEnd-1-e>=this.bStart&&this.isMatch(this.aEnd-1-e,this.bEnd-1-e);)e++;return e}a(gt,"countCommonBackward");function mt(e,t,i){let r=this.aEnd-this.aStart,n=this.bEnd-this.bStart,s=[];for(let o=i;o>0;o--){let c=e[o-1],l=r-n,u,d=c[l-1+t],g=c[l+1+t];l===-o||l!==o&&d<g?u=l+1:u=l-1;let S=u+t,y=c[S],E=y-u;for(;r>y&&n>E;)--r,--n,s.push([1,this.aStart+r,this.bStart+n]);r===y?s.push([0,this.aStart+y,this.bStart+E]):s.push([0,this.aStart+y,this.bStart+E]),r=y,n=E}for(let o of s.reverse())this.foundSubsequence(...o)}a(mt,"backtrackFlat");function yt(){let e=this.aEnd-this.aStart,t=this.bEnd-this.bStart,i=e+t,r=0,n=new Array(2*i+1).fill(0),s=[];for(let o=0;o<=i;o++){let c=new Array(2*i+1);s[o]=c;for(let l=-o;l<=o;l+=2){let u=l+i,d;l===-o||l!==o&&n[l-1+i]<n[l+1+i]?d=n[l+1+i]:d=n[l-1+i]+1;let g=d-l;for(;d<e&&g<t&&this.isMatch(this.aStart+d,this.bStart+g);)d++,g++;if(n[u]=d,c[u]=d,d>=e&&g>=t)return r=o,mt.call(this,s,i,r)}}}a(yt,"findMiddleSnake");function vt(){let e=dt.call(this),t=this.aStart+e>=this.aEnd&&this.bStart+e>=this.bEnd;if(e>0&&(this.foundSubsequence(e,this.aStart,this.bStart),t))return;this.aStart+=e,this.bStart+=e;let i=gt.call(this);this.aEnd-=i,this.bEnd-=i,(this.aStart<this.aEnd||this.bStart<this.bEnd)&&yt.call(this),i>0&&this.foundSubsequence(i,this.aEnd,this.bEnd)}a(vt,"diffSequence");function $e(e,t,i,r){let n={aStart:0,bStart:0,aEnd:e,bEnd:t,isMatch:i,foundSubsequence:r};vt.call(n)}a($e,"createDiff");function Se(e,t){let i=0,r=0,n="",s="",o=[];function c(l,u){let d=o[o.length-1];d&&d[0]===l?d[1]+=u:o.push([l,u])}return a(c,"pushDiff"),$e(e.length,t.length,(l,u)=>e[l]===t[u],(l,u,d)=>{i!==u&&(s+=e.slice(i,u)),r!==d&&(n+=t.slice(r,d)),l>0&&(s&&(c(-1,s),s=""),n&&(c(1,n),n=""),c(0,t.slice(d,d+l))),i=u+l,r=d+l}),i!==e.length&&(s+=e.slice(i)),r!==t.length&&(n+=t.slice(r)),s&&o.push([-1,s]),n&&o.push([1,n]),o}a(Se,"diffStringsRaw");function xe(e,t){let i=0,r=0,n=[];for($e(e.length,t.length,(s,o)=>{let c=e[s].trimEnd().endsWith(","),l=t[o].trimEnd().endsWith(",");return c&&!l?t[o]+=",":!c&&l&&(e[s]+=","),e[s]===t[o]},(s,o,c)=>{for(;i!==o;i+=1)n.push([-1,e[i]]);for(;r!==c;r+=1)n.push([1,t[r]]);for(;s!==0;s-=1,i+=1,r+=1)n.push([0,t[r]])});i!==e.length;i+=1)n.push([-1,e[i]]);for(;r!==t.length;r+=1)n.push([1,t[r]]);return n}a(xe,"diffLinesRaw");function Ie(e){let t=[],i=[],r=[],n=a(()=>{t.length&&(r.push([-1,t.join("")]),t=[]),i.length&&(r.push([1,i.join("")]),i=[])},"flushBuffers");for(let s=0;s<e.length;s++){let[o,c]=e[s];if(o===0){if(c.length<=1){let l=s>0?e[s-1][0]:null,u=s+1<e.length?e[s+1][0]:null,d=a(g=>g===-1||g===1,"isEdit");if(d(l)&&d(u)){for(let g of c)t.push(g),i.push(g);continue}}n(),r.push([0,c])}else if(o===-1)for(let l of c)t.push(l);else if(o===1)for(let l of c)i.push(l);else n(),r.push([o,c])}return n(),r}a(Ie,"cleanupSemantic");var I=R.dim,bt=R.lightOrange,h=R.lightCoral,f=R.oliveGreen,we=R.cyan,k=R.inverse,Wi=R.whiteBright;function w(e){return e===null?"null":e===!0?"true":e===!1?"false":e&&typeof e=="object"?e.constructor?.name??"Object":typeof e}a(w,"getType");function Et(e,t,i=!0){let r="",n="",s=Se(e||" ",t||" ");i&&(s=Ie(s));for(let[o,c]of s)o===0?(r+=c,n+=c):o===-1?r+=k(c):o===1&&(n+=k(c));return[r,n]}a(Et,"normalizeStrings");function $t(e,t){let i=[...e],r=[...t],n=Math.max(e.length,t.length);for(let s=0;s<n;s++)[i[s],r[s]]=J(e[s],t[s]);return[i,r]}a($t,"normalizeArrays");function St(e,t){let i={...e},r={...t},n=new Set([...Object.keys(e),...Object.keys(t)]);for(let s of n)s in e&&s in t&&([i[s],r[s]]=J(e[s],t[s]));return[i,r]}a(St,"normalizeObjects");function J(e,t,i=!0){if(e===t)return[e,t];let r=typeof e,n=typeof t;return be(e,t)===!0?(x(e)&&(e=t),x(t)&&(t=e),[e,t]):r==="string"&&n==="string"?Et(e,t,i):!e||!t||r!=="object"||n!=="object"?[e,t]:Array.isArray(e)&&Array.isArray(t)?$t(e,t):St(e,t)}a(J,"normalizeAsymmetric");function xt(e,t,i,r=!0){let n=e.split(`
4
+ `),s=t.split(`
5
5
  `);i.push(we(`
6
6
  @@ -1,${n.length} +1,${s.length} @@
7
- `));let o=Math.max(n.length,s.length);for(let c=0;c<o;c++){let l=n[c],u=s[c];if(l===u){l&&i.push(I(` ${l}`));continue}let d=[],g=[];if(l!==void 0&&u!==void 0){let x=xe(l||" ",u||" ");r&&(x=Ie(x));for(let[y,E]of x)y===0?(d.push(E),g.push(E)):y===-1?d.push(k(E)):y===1&&g.push(k(E))}l===void 0&&g.push(u),!u===void 0&&d.push(l),d.length>0&&i.push(f(`- ${d.join("")}`)),g.length>0&&i.push(h(`+ ${g.join("")}`))}return i.join(`
8
- `)}a(St,"diffStrings");function Y(t,e){let i=[];[t,e]=J(t,e,!0);let r=$(t,""),n=$(e,""),s=Se(r,n);for(let[o,c]of s){let l=c,u="";l.endsWith(",")&&(l=l.slice(0,-1),u=","),o===0?i.push(I(l)+u):o===1&&i.push(h(l)+u)}return i}a(Y,"diffArgs");function Z(t,e,i=!0){let r=w(t),n=w(e),s=[];if(r!==n&&(s.push("Expected type: "+f(r)),s.push("Received type: "+h(n))),r==="string"&&n==="string")return St(t,e,s,i);let[o,c]=J(t,e,i),l=$(o),u=$(c);s.push(we(`
7
+ `));let o=Math.max(n.length,s.length);for(let c=0;c<o;c++){let l=n[c],u=s[c];if(l===u){l&&i.push(I(` ${l}`));continue}let d=[],g=[];if(l!==void 0&&u!==void 0){let S=Se(l||" ",u||" ");r&&(S=Ie(S));for(let[y,E]of S)y===0?(d.push(E),g.push(E)):y===-1?d.push(k(E)):y===1&&g.push(k(E))}l===void 0&&g.push(u),!u===void 0&&d.push(l),d.length>0&&i.push(f(`- ${d.join("")}`)),g.length>0&&i.push(h(`+ ${g.join("")}`))}return i.join(`
8
+ `)}a(xt,"diffStrings");function Y(e,t){let i=[];[e,t]=J(e,t,!0);let r=$(e,""),n=$(t,""),s=xe(r,n);for(let[o,c]of s){let l=c,u="";l.endsWith(",")&&(l=l.slice(0,-1),u=","),o===0?i.push(I(l)+u):o===1&&i.push(h(l)+u)}return i}a(Y,"diffArgs");function Z(e,t,i=!0){let r=w(e),n=w(t),s=[];if(r!==n&&(s.push("Expected type: "+f(r)),s.push("Received type: "+h(n))),r==="string"&&n==="string")return xt(e,t,s,i);let[o,c]=J(e,t,i),l=$(o),u=$(c);s.push(we(`
9
9
  @@ -1,${l.length} +1,${u.length} @@
10
- `));let d=Se(l,u);for(let[g,x]of d)g===0?s.push(I(` ${x}`)):g===-1?s.push(f(`- ${x}`)):g===1&&s.push(h(`+ ${x}`));return s.join(`
11
- `)}a(Z,"diffComponent");var Q=class extends Error{static{a(this,"xJetBaseError")}constructor(t,e="xJetError"){super(t),Object.setPrototypeOf(this,new.target.prototype),this.name=e,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toJSON(){return nt(this)}};function ee(t){let{comment:e,assertionChain:i,expectedLabels:r=[],receivedLabeled:n="received"}=t;if(!i.length)throw new Error('Expected non-empty matcher chain (e.g., ["toEqual"]). Received an empty array.');let s=[I("expect("),h(n),I(")"),".",i.join(".")];return r.length>0?(s.push("("),s.push(r.map(o=>f(o)).join(", ")),s.push(")")):s.push("()"),e&&s.push(I(" // "+e)),s.join("")}a(ee,"composeStatement");var C=class extends Q{static{a(this,"xJetTypeError")}constructor(t){let e=[`${ee(t)}
12
- `,`Matcher error: ${t.message}
13
- `];t.expected&&(t.expected.type&&e.push(`Expected has type: ${t.expected.type}`),e.push(`Expected has value: ${f($(t.expected.value).join(`
14
- `))}`)),t.received&&(t.received.type&&e.push(`Received has type: ${t.received.type}`),e.push(`Received has value: ${h($(t.received.value).join(`
15
- `))}`)),super(e.join(`
16
- `),"xJetTypeError")}},It=class extends Q{static{a(this,"xJetExpectError")}matcherResult;constructor(t){let e=[`${ee(t)}
17
- `];t.info&&e.push(...t.info),super(e.join(`
18
- `),"xJetExpectError"),t.assertion&&(this.matcherResult=t.assertion,this.matcherResult.message=this.message)}};function b(t,e,i,r=[]){let n=w(t);if(!e.includes(n)&&!e.includes(typeof t))throw new C({expectedLabels:r,assertionChain:this.assertionChain,message:`${(i==="Received"?h:f)(i)} value must be a ${e.join(" or ")}`,[i==="Expected"?"expected":"received"]:{value:t,type:n}})}a(b,"ensureType");function Re(t,e,i=[]){if(t==null)throw new C({expectedLabels:i,assertionChain:this.assertionChain,message:`${(e==="Received"?h:f)(e)} value must not be null nor undefined`,[e==="Expected"?"expected":"received"]:{value:t}})}a(Re,"ensureNotNullish");function p(t){return $(t,"").join(" ")}a(p,"serializeOneLine");function m(t){let{pass:e}=t;if(!(e&&this.notModifier||!e&&!this.notModifier))return;let i=[],r={pass:e,name:this.macherName,received:this.received,expected:t.expected};throw this.notModifier?t.handleNot?.call(this,i):t.handleInfo?.call(this,i),new It({info:i,assertion:r,...t,assertionChain:this.assertionChain})}a(m,"handleFailure");function B(t){m.call(this,{...t,handleNot(e){e.push(`Expected: not ${f(p(this.received))}`)},handleInfo(e){t.note&&e.push(I(t.note),""),e.push(Z(t.expected,this.received,!0))}})}a(B,"handleDiffFailure");function wt(t,e){let i=" ".repeat(e.length);m.call(this,{...t,handleNot(r){r.push(`Expected: not ${e} ${f(p(t.expected))}`),r.push(`Received: ${i} ${h(p(this.received))}`)},handleInfo(r){r.push(`Expected: ${e} ${f(p(t.expected))}`),r.push(`Received: ${i} ${h(p(this.received))}`)}})}a(wt,"handleComparisonFailure");function ue(t){let e=t,i=e!=null&&typeof e.message=="string",r=i&&typeof e.name=="string"&&typeof e.stack=="string";return{isError:r,value:t,message:String(i?e.message:t),hasMessage:r?!0:i,serializedError:q(t)}}a(ue,"getThrown");function W(t,e,i,r=!1){return[n=>{n.push(`Expected ${t}: not ${f(e)}`),i?.hasMessage?n.push(`Received message: ${h(p(r?i.message:k(i.message)))}
19
- `):n.push(`Received value: ${h(p(i?.value))}`)},n=>{n.push(`Expected ${t}: ${f(e)}`),i?.hasMessage?(r&&n.push(`Received name: ${h(p(i.value?.name))}`),n.push(`Received message: ${h(p(i.message))}
20
- `)):n.push(`Received value: ${h(p(i?.value))}`)}]}a(W,"buildInfo");function Rt(t,e){let i=e!=null&&e.value instanceof t,[r,n]=W("constructor",t.name,e);return[i,r,n]}a(Rt,"toThrowExpectedClass");function Tt(t,e){let i=e!=null&&e.message.includes(t),[r,n]=W("substring",`"${t}"`,e);return[i,r,n]}a(Tt,"toThrowExpectedString");function kt(t,e){let i=e!=null&&t.test(e.message),[r,n]=W("pattern",p(t),e);return[i,r,n]}a(kt,"toThrowExpectedRegExp");function Bt(t,e){let i=e!=null&&t.matches(e.value),[r,n]=W("asymmetric",p(t),e,!0);return[i,r,n]}a(Bt,"toThrowExpectedAsymmetric");function Lt(t,e){return[e!=null&&v(q(t),e.serializedError),i=>{i.push(`Expected: not ${f(p(e.serializedError))}`)},i=>{i.push(Z(t,e.serializedError,!0))}]}a(Lt,"toThrowExpectedObject");function Ct(t){let e=null,i=t?["expected"]:[];if(this.rejectsModifier)e=ue(this.received);else if(typeof this.received=="function")try{this.received()}catch(o){e=ue(o)}else b.call(this,this.received,["function"],"Received",i);let r=!1,n,s;t?typeof t=="function"?[r,n,s]=Rt.call(this,t,e):typeof t=="string"?[r,n,s]=Tt.call(this,t,e):t instanceof RegExp?[r,n,s]=kt.call(this,t,e):S(t)?[r,n,s]=Bt.call(this,t,e):e!==null&&typeof t=="object"?[r,n,s]=Lt.call(this,t,e):b.call(this,t,["string","function","RegExp","object"],"Expected",i):(r=e!=null,n=a(o=>{e?.hasMessage?(o.push(`Error name: ${h(e.value?.name)}`),o.push(`Error message: ${h(p(e.message))}
21
- `)):o.push(`Error value: ${h(p(e?.value))}`)},"handleNot")),m.call(Object.assign({},this,{received:e?.serializedError}),{pass:r,expected:t,expectedLabels:i,handleNot(o){n?.call(this,o)},handleInfo(o){e?s?.call(this,o):o.push(`${h("Received")} function did not throw`)}})}a(Ct,"toThrow");function zt(t){let e=["length"];if(b.call(this,t,["number","bigint"],"Expected",e),!Object.hasOwn(this.received,"length")||!Number.isSafeInteger(this.received.length))throw new C({expectedLabels:e,message:`${h("received")} value must have a length property whose value must be a number`,received:{value:this.received,type:w(this.received)},assertionChain:this.assertionChain});let i=this.received,r=i.length==t;m.call(this,{pass:r,expectedLabels:e,handleNot(n){n.push(`Expected length: not ${f(p(t))}`),n.push(`Received string: ${h(p(i))}`)},handleInfo(n){n.push(`Expected length: ${f(p(t))}`),n.push(`Received length: ${h(p(i.length))}`),n.push(`Received string: ${h(p(i))}`)}})}a(zt,"toHaveLength");function At(t){let e=["expected"];b.call(this,this.received,["string"],"Received",e),b.call(this,t,["string","RegExp"],"Expected",e);let i=this.received,r=typeof t=="string"?i.includes(t):new RegExp(t).test(i);m.call(this,{pass:r,expectedLabels:e,handleNot(n){n.push(`Expected: not ${f(p(i))}`)},handleInfo(n){t instanceof RegExp?(n.push(`Expected pattern: ${f(p(t))}`),n.push(`Received string: ${h(p(i))}`)):n.push(Z(t,i,!0))}})}a(At,"toMatch");function V(t,e,i=[]){if(b.call(this,t,["number","bigint"],e,i),t<0)throw new C({expectedLabels:i,assertionChain:this.assertionChain,message:`${(e==="Received"?h:f)(e)} value must be positive number`,[e==="Received"?"received":"expected"]:{value:t,type:w(t)}})}a(V,"ensurePositiveNumber");function G(t,e){let i=this.received,r=["Expected"];b.call(this,t,["number","bigint"],"Expected",r),b.call(this,i,["number","bigint"],"Received",r);let n;switch(e){case">":n=i>t;break;case">=":n=i>=t;break;case"<":n=i<t;break;case"<=":n=i<=t;break;default:n=!1}wt.call(this,{pass:n,expectedLabels:r,expected:t},e)}a(G,"handleNumericComparison");function jt(t,e=2){let i=["expected","precision"];b.call(this,t,["number"],"Expected",i),b.call(this,this.received,["number"],"Received",i);let r=this.received,n=Math.abs(t-r),s=Math.pow(10,-e)/2,o=e<20?s.toFixed(e+1):s.toString(),c=this.notModifier?" ":" ",l=this.notModifier?"not < ":"< ",u=n<s,d=[`Expected precision: ${c}${f(e.toString())}`,`Expected difference: ${l}${f(o)}`,`Received difference: ${c}${h(n.toString())}`];m.call(this,{pass:u,expectedLabels:i,handleNot(g){g.push(`Expected: not ${f(p(t))}`),g.push(`Received: ${h(p(r))}
22
- `),g.push(...d)},handleInfo(g){g.push(`Expected: ${f(p(t))}`),g.push(`Received: ${h(p(r))}
23
- `),g.push(...d)}})}a(jt,"toBeCloseTo");function Pt(t){G.call(this,t,">")}a(Pt,"toBeGreaterThan");function Ot(t){G.call(this,t,">=")}a(Ot,"toBeGreaterThanOrEqual");function Ft(t){G.call(this,t,"<")}a(Ft,"toBeLessThan");function Mt(t){G.call(this,t,"<=")}a(Mt,"toBeLessThanOrEqual");function R(t=[]){if(!this.received?.xJetMock||!this.received?.mock)throw new C({expectedLabels:t,assertionChain:this.assertionChain,message:`${h("Received")} value must be a mock or spy function`,received:{value:this.received}})}a(R,"ensureMock");function P(t){return $(t,"").slice(1,-1).map(e=>f(e.replace(",",""))).join(", ")}a(P,"serializeCallArgs");function Te(t,e,i,r="->",n=!1,s=3){if(!e?.length)return"";let o=0,c=-1,l=e.length;i&&i>=1&&i<=l&&(c=i-1,o=Math.max(0,Math.min(c-1,l-(s-1))));let u=Math.min(o+s,l),d=String(u).length,g=" ".repeat(r.length+1),x=new Array(u-o);for(let y=o;y<u;y++){let E=e[y],se=String(y+1).padStart(d," "),oe=y===c?`${r} `:g;if(n&&Array.isArray(E)&&E.length<1){x[y-o]=`${oe}${se}: called with 0 arguments`;continue}let Ye=n?Y(t,E).slice(1,-1):Y(t,E);x[y-o]=`${oe}${se}: ${Ye.join(" ")}`}return x.join(`
24
- `)}a(Te,"serializeList");function Nt(t,e,i=[],r=3){if(!e?.length||!i.length)return"";let n=e.length,s=String(n).length+3,o=[];for(let c=0;c<i.length;c++){let l=i[c]-1;if(l<0||l>=n)continue;let u=Y(t,e[l]).slice(1,-1);if(o.push(`${String(l+1).padStart(s," ")}: ${u.join(" ")}`),o.length>=r)break}return o.join(`
25
- `)}a(Nt,"serializeHighlightedCalls");function O(t,e,i,r){return Te(t,e,i,r,!0)}a(O,"serializeCallList");function F(t,e,i,r){return Te(t,e,i,r,!1)}a(F,"serializeReturnList");function Ut(){R.call(this);let t=this.received.mock.calls,e=this.received.mock.calls.length;m.call(this,{pass:e>0,receivedLabeled:this.received.name,handleNot(i){i.push(`Expected calls: ${f("0")}`),i.push(`Received calls: ${h(e.toString())}
26
- `),i.push(O([],t))},handleInfo(i){i.push(`Expected calls: >= ${f("1")}`),i.push(`Received calls: ${h(e.toString())}
27
- `)}})}a(Ut,"toHaveBeenCalled");function Dt(t){let e=["expected"];R.call(this,e),V.call(this,t,"expected",e);let i=this.received.mock.calls.length;m.call(this,{expected:t,pass:i==t,expectedLabels:e,receivedLabeled:this.received.name,handleNot(r){r.push(`Expected calls: != ${f(t.toString())}`)},handleInfo(r){r.push(`Expected calls: ${f(t.toString())}`),r.push(`Received calls: ${h(i.toString())}
28
- `)}})}a(Dt,"toHaveBeenCalledTimes");function _t(...t){let e=["...args"];R.call(this,e);let i=this.received.mock.calls,r=this.received.mock.calls.length,n=[];i.forEach((o,c)=>{o.length===t.length&&v(t,o)&&n.push(c+1)});let s=n.length>0;m.call(this,{pass:s,expectedLabels:e,expected:t,receivedLabeled:this.received.name,handleNot(o){o.push(`Expected: not ${P(t)}`),o.push(`Received:
10
+ `));let d=xe(l,u);for(let[g,S]of d)g===0?s.push(I(` ${S}`)):g===-1?s.push(f(`- ${S}`)):g===1&&s.push(h(`+ ${S}`));return s.join(`
11
+ `)}a(Z,"diffComponent");var Q=class extends Error{static{a(this,"xJetBaseError")}constructor(e,t="xJetError"){super(e),Object.setPrototypeOf(this,new.target.prototype),this.name=t,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toJSON(){return nt(this)}};function ee(e){let{comment:t,assertionChain:i,expectedLabels:r=[],receivedLabeled:n="received"}=e;if(!i.length)throw new Error('Expected non-empty matcher chain (e.g., ["toEqual"]). Received an empty array.');let s=[I("expect("),h(n),I(")"),".",i.join(".")];return r.length>0?(s.push("("),s.push(r.map(o=>f(o)).join(", ")),s.push(")")):s.push("()"),t&&s.push(I(" // "+t)),s.join("")}a(ee,"composeStatement");var C=class extends Q{static{a(this,"xJetTypeError")}constructor(e){let t=[`${ee(e)}
12
+ `,`Matcher error: ${e.message}
13
+ `];e.expected&&(e.expected.type&&t.push(`Expected has type: ${e.expected.type}`),t.push(`Expected has value: ${f($(e.expected.value).join(`
14
+ `))}`)),e.received&&(e.received.type&&t.push(`Received has type: ${e.received.type}`),t.push(`Received has value: ${h($(e.received.value).join(`
15
+ `))}`)),super(t.join(`
16
+ `),"xJetTypeError")}},It=class extends Q{static{a(this,"xJetExpectError")}matcherResult;constructor(e){let t=[`${ee(e)}
17
+ `];e.info&&t.push(...e.info),super(t.join(`
18
+ `),"xJetExpectError"),e.assertion&&(this.matcherResult=e.assertion,this.matcherResult.message=this.message)}};function b(e,t,i,r=[]){let n=w(e);if(!t.includes(n)&&!t.includes(typeof e))throw new C({expectedLabels:r,assertionChain:this.assertionChain,message:`${(i==="Received"?h:f)(i)} value must be a ${t.join(" or ")}`,[i==="Expected"?"expected":"received"]:{value:e,type:n}})}a(b,"ensureType");function Te(e,t,i=[]){if(e==null)throw new C({expectedLabels:i,assertionChain:this.assertionChain,message:`${(t==="Received"?h:f)(t)} value must not be null nor undefined`,[t==="Expected"?"expected":"received"]:{value:e}})}a(Te,"ensureNotNullish");function p(e){return $(e,"").join(" ")}a(p,"serializeOneLine");function m(e){let{pass:t}=e;if(!(t&&this.notModifier||!t&&!this.notModifier))return;let i=[],r={pass:t,name:this.macherName,received:this.received,expected:e.expected};throw this.notModifier?e.handleNot?.call(this,i):e.handleInfo?.call(this,i),new It({info:i,assertion:r,...e,assertionChain:this.assertionChain})}a(m,"handleFailure");function B(e){m.call(this,{...e,handleNot(t){t.push(`Expected: not ${f(p(this.received))}`)},handleInfo(t){e.note&&t.push(I(e.note),""),t.push(Z(e.expected,this.received,!0))}})}a(B,"handleDiffFailure");function wt(e,t){let i=" ".repeat(t.length);m.call(this,{...e,handleNot(r){r.push(`Expected: not ${t} ${f(p(e.expected))}`),r.push(`Received: ${i} ${h(p(this.received))}`)},handleInfo(r){r.push(`Expected: ${t} ${f(p(e.expected))}`),r.push(`Received: ${i} ${h(p(this.received))}`)}})}a(wt,"handleComparisonFailure");function ue(e){let t=e,i=t!=null&&typeof t.message=="string",r=i&&typeof t.name=="string"&&typeof t.stack=="string";return{isError:r,value:e,message:String(i?t.message:e),hasMessage:r?!0:i,serializedError:q(e)}}a(ue,"getThrown");function W(e,t,i,r=!1){return[n=>{n.push(`Expected ${e}: not ${f(t)}`),i?.hasMessage?n.push(`Received message: ${h(p(r?i.message:k(i.message)))}
19
+ `):n.push(`Received value: ${h(p(i?.value))}`)},n=>{n.push(`Expected ${e}: ${f(t)}`),i?.hasMessage?(r&&n.push(`Received name: ${h(p(i.value?.name))}`),n.push(`Received message: ${h(p(i.message))}
20
+ `)):n.push(`Received value: ${h(p(i?.value))}`)}]}a(W,"buildInfo");function Tt(e,t){let i=t!=null&&t.value instanceof e,[r,n]=W("constructor",e.name,t);return[i,r,n]}a(Tt,"toThrowExpectedClass");function Rt(e,t){let i=t!=null&&t.message.includes(e),[r,n]=W("substring",`"${e}"`,t);return[i,r,n]}a(Rt,"toThrowExpectedString");function kt(e,t){let i=t!=null&&e.test(t.message),[r,n]=W("pattern",p(e),t);return[i,r,n]}a(kt,"toThrowExpectedRegExp");function Bt(e,t){let i=t!=null&&e.matches(t.value),[r,n]=W("asymmetric",p(e),t,!0);return[i,r,n]}a(Bt,"toThrowExpectedAsymmetric");function Lt(e,t){return[t!=null&&v(q(e),t.serializedError),i=>{i.push(`Expected: not ${f(p(t.serializedError))}`)},i=>{i.push(Z(e,t.serializedError,!0))}]}a(Lt,"toThrowExpectedObject");function Ct(){if(this.rejectsModifier)return ue(this.received);if(typeof this.received=="function")try{this.received()}catch(e){return ue(e)}return null}a(Ct,"captureThrown");function At(e){let t=Ct.call(this),i=e?["expected"]:[];if(!this.rejectsModifier&&!this.resolvesModifier&&typeof this.received!="function")return b.call(this,this.received,["function"],"Received",i);let r=!1,n,s;e?typeof e=="function"?[r,n,s]=Tt.call(this,e,t):typeof e=="string"?(i[0]=e,[r,n,s]=Rt.call(this,e,t)):e instanceof RegExp?(i[0]=String(e),[r,n,s]=kt.call(this,e,t)):x(e)?(i[0]=String(e.name),[r,n,s]=Bt.call(this,e,t)):t!==null&&typeof e=="object"?[r,n,s]=Lt.call(this,e,t):b.call(this,e,["string","function","RegExp","object"],"Expected",i):(r=t!=null,n=a(o=>{t?.hasMessage?(o.push(`Error name: ${h(t.value?.name)}`),o.push(`Error message: ${h(p(t.message))}
21
+ `)):o.push(`Error value: ${h(p(t?.value))}`)},"handleNot")),m.call(Object.assign({},this,{received:t?.serializedError}),{pass:r,expected:e,expectedLabels:i,handleNot(o){n?.call(this,o)},handleInfo(o){t?s?.call(this,o):o.push(`${h("Received")} function did not throw`)}})}a(At,"toThrow");function zt(e){let t=["length"];if(b.call(this,e,["number","bigint"],"Expected",t),!Object.hasOwn(this.received,"length")||!Number.isSafeInteger(this.received.length))throw new C({expectedLabels:t,message:`${h("received")} value must have a length property whose value must be a number`,received:{value:this.received,type:w(this.received)},assertionChain:this.assertionChain});let i=this.received,r=i.length==e;m.call(this,{pass:r,expectedLabels:t,handleNot(n){n.push(`Expected length: not ${f(p(e))}`),n.push(`Received string: ${h(p(i))}`)},handleInfo(n){n.push(`Expected length: ${f(p(e))}`),n.push(`Received length: ${h(p(i.length))}`),n.push(`Received string: ${h(p(i))}`)}})}a(zt,"toHaveLength");function Pt(e){let t=["expected"];b.call(this,this.received,["string"],"Received",t),b.call(this,e,["string","RegExp"],"Expected",t);let i=this.received,r=typeof e=="string"?i.includes(e):new RegExp(e).test(i);m.call(this,{pass:r,expectedLabels:t,handleNot(n){n.push(`Expected: not ${f(p(i))}`)},handleInfo(n){e instanceof RegExp?(n.push(`Expected pattern: ${f(p(e))}`),n.push(`Received string: ${h(p(i))}`)):n.push(Z(e,i,!0))}})}a(Pt,"toMatch");function V(e,t,i=[]){if(b.call(this,e,["number","bigint"],t,i),e<0)throw new C({expectedLabels:i,assertionChain:this.assertionChain,message:`${(t==="Received"?h:f)(t)} value must be positive number`,[t==="Received"?"received":"expected"]:{value:e,type:w(e)}})}a(V,"ensurePositiveNumber");function G(e,t){let i=this.received,r=["Expected"];b.call(this,e,["number","bigint"],"Expected",r),b.call(this,i,["number","bigint"],"Received",r);let n;switch(t){case">":n=i>e;break;case">=":n=i>=e;break;case"<":n=i<e;break;case"<=":n=i<=e;break;default:n=!1}wt.call(this,{pass:n,expectedLabels:r,expected:e},t)}a(G,"handleNumericComparison");function jt(e,t=2){let i=["expected","precision"];b.call(this,e,["number"],"Expected",i),b.call(this,this.received,["number"],"Received",i);let r=this.received,n=Math.abs(e-r),s=Math.pow(10,-t)/2,o=t<20?s.toFixed(t+1):s.toString(),c=this.notModifier?" ":" ",l=this.notModifier?"not < ":"< ",u=n<s,d=[`Expected precision: ${c}${f(t.toString())}`,`Expected difference: ${l}${f(o)}`,`Received difference: ${c}${h(n.toString())}`];m.call(this,{pass:u,expectedLabels:i,handleNot(g){g.push(`Expected: not ${f(p(e))}`),g.push(`Received: ${h(p(r))}
22
+ `),g.push(...d)},handleInfo(g){g.push(`Expected: ${f(p(e))}`),g.push(`Received: ${h(p(r))}
23
+ `),g.push(...d)}})}a(jt,"toBeCloseTo");function Ot(e){G.call(this,e,">")}a(Ot,"toBeGreaterThan");function Ft(e){G.call(this,e,">=")}a(Ft,"toBeGreaterThanOrEqual");function Mt(e){G.call(this,e,"<")}a(Mt,"toBeLessThan");function Nt(e){G.call(this,e,"<=")}a(Nt,"toBeLessThanOrEqual");function T(e=[]){if(!this.received?.xJetMock||!this.received?.mock)throw new C({expectedLabels:e,assertionChain:this.assertionChain,message:`${h("Received")} value must be a mock or spy function`,received:{value:this.received}})}a(T,"ensureMock");function j(e){return $(e,"").slice(1,-1).map(t=>f(t.replace(",",""))).join(", ")}a(j,"serializeCallArgs");function Re(e,t,i,r="->",n=!1,s=3){if(!t?.length)return"";let o=0,c=-1,l=t.length;i&&i>=1&&i<=l&&(c=i-1,o=Math.max(0,Math.min(c-1,l-(s-1))));let u=Math.min(o+s,l),d=String(u).length,g=" ".repeat(r.length+1),S=new Array(u-o);for(let y=o;y<u;y++){let E=t[y],se=String(y+1).padStart(d," "),oe=y===c?`${r} `:g;if(n&&Array.isArray(E)&&E.length<1){S[y-o]=`${oe}${se}: called with 0 arguments`;continue}let Ye=n?Y(e,E).slice(1,-1):Y(e,E);S[y-o]=`${oe}${se}: ${Ye.join(" ")}`}return S.join(`
24
+ `)}a(Re,"serializeList");function Ut(e,t,i=[],r=3){if(!t?.length||!i.length)return"";let n=t.length,s=String(n).length+3,o=[];for(let c=0;c<i.length;c++){let l=i[c]-1;if(l<0||l>=n)continue;let u=Y(e,t[l]).slice(1,-1);if(o.push(`${String(l+1).padStart(s," ")}: ${u.join(" ")}`),o.length>=r)break}return o.join(`
25
+ `)}a(Ut,"serializeHighlightedCalls");function O(e,t,i,r){return Re(e,t,i,r,!0)}a(O,"serializeCallList");function F(e,t,i,r){return Re(e,t,i,r,!1)}a(F,"serializeReturnList");function Dt(){T.call(this);let e=this.received.mock.calls,t=this.received.mock.calls.length;m.call(this,{pass:t>0,receivedLabeled:this.received.name,handleNot(i){i.push(`Expected calls: ${f("0")}`),i.push(`Received calls: ${h(t.toString())}
26
+ `),i.push(O([],e))},handleInfo(i){i.push(`Expected calls: >= ${f("1")}`),i.push(`Received calls: ${h(t.toString())}
27
+ `)}})}a(Dt,"toHaveBeenCalled");function _t(e){let t=["expected"];T.call(this,t),V.call(this,e,"expected",t);let i=this.received.mock.calls.length;m.call(this,{expected:e,pass:i==e,expectedLabels:t,receivedLabeled:this.received.name,handleNot(r){r.push(`Expected calls: != ${f(e.toString())}`)},handleInfo(r){r.push(`Expected calls: ${f(e.toString())}`),r.push(`Received calls: ${h(i.toString())}
28
+ `)}})}a(_t,"toHaveBeenCalledTimes");function Ht(...e){let t=["...args"];T.call(this,t);let i=this.received.mock.calls,r=this.received.mock.calls.length,n=[];i.forEach((o,c)=>{o.length===e.length&&v(e,o)&&n.push(c+1)});let s=n.length>0;m.call(this,{pass:s,expectedLabels:t,expected:e,receivedLabeled:this.received.name,handleNot(o){o.push(`Expected: not ${j(e)}`),o.push(`Received:
29
29
 
30
- ${Nt(t,i,n)}
31
- `),o.push(`Calls: ${h(r.toString())}`)},handleInfo(o){o.push(`Expected: ${P(t)}`),o.push(`Received:
30
+ ${Ut(e,i,n)}
31
+ `),o.push(`Calls: ${h(r.toString())}`)},handleInfo(o){o.push(`Expected: ${j(e)}`),o.push(`Received:
32
32
 
33
- ${O(t,i)}
34
- `),o.push(`Calls: ${h(r.toString())}`)}})}a(_t,"toHaveBeenCalledWith");function Ht(...t){let e=["...args"];R.call(this,e);let i=this.received.mock.calls,r=i.length,n=this.received.mock.calls.at(-1),s=n!==void 0&&v(t,n);m.call(this,{pass:s,expectedLabels:e,expected:t,receivedLabeled:this.received.name,handleNot(o){o.push(`Expected: not ${P(t)}`),o.push(`Received:
33
+ ${O(e,i)}
34
+ `),o.push(`Calls: ${h(r.toString())}`)}})}a(Ht,"toHaveBeenCalledWith");function qt(...e){let t=["...args"];T.call(this,t);let i=this.received.mock.calls,r=i.length,n=this.received.mock.calls.at(-1),s=n!==void 0&&v(e,n);m.call(this,{pass:s,expectedLabels:t,expected:e,receivedLabeled:this.received.name,handleNot(o){o.push(`Expected: not ${j(e)}`),o.push(`Received:
35
35
 
36
- ${O(t,i,i.length)}
37
- `),o.push(`Calls: ${h(r.toString())}`)},handleInfo(o){o.push(`Expected: ${P(t)}`),o.push(`Received:
36
+ ${O(e,i,i.length)}
37
+ `),o.push(`Calls: ${h(r.toString())}`)},handleInfo(o){o.push(`Expected: ${j(e)}`),o.push(`Received:
38
38
 
39
- ${O(t,i,i.length)}
40
- `),o.push(`Calls: ${h(r.toString())}`)}})}a(Ht,"toHaveBeenLastCalledWith");function qt(t,...e){let i=["nthCall","...args"];R.call(this,i),V.call(this,t,"nthCall",i);let r=this.received.mock.calls,n=r.length,s=this.received.mock.calls.at(t-1),o=s!==void 0&&v(e,s);m.call(this,{pass:o,expectedLabels:i,expected:e,receivedLabeled:this.received.name,handleNot(c){c.push(`nthCall: ${t}`),c.push(`Expected: not ${P(e)}`),c.push(`Received:
39
+ ${O(e,i,i.length)}
40
+ `),o.push(`Calls: ${h(r.toString())}`)}})}a(qt,"toHaveBeenLastCalledWith");function Jt(e,...t){let i=["nthCall","...args"];T.call(this,i),V.call(this,e,"nthCall",i);let r=this.received.mock.calls,n=r.length,s=this.received.mock.calls.at(e-1),o=s!==void 0&&v(t,s);m.call(this,{pass:o,expectedLabels:i,expected:t,receivedLabeled:this.received.name,handleNot(c){c.push(`nthCall: ${e}`),c.push(`Expected: not ${j(t)}`),c.push(`Received:
41
41
 
42
- ${O(e,r,t)}
43
- `),c.push(`Calls: ${h(n.toString())}`)},handleInfo(c){c.push(`nthCall: ${t}`),c.push(`Expected: ${P(e)}`),c.push(`Received:
42
+ ${O(t,r,e)}
43
+ `),c.push(`Calls: ${h(n.toString())}`)},handleInfo(c){c.push(`nthCall: ${e}`),c.push(`Expected: ${j(t)}`),c.push(`Received:
44
44
 
45
- ${O(e,r,t)}
46
- `),c.push(`Calls: ${h(n.toString())}`)}})}a(qt,"toHaveBeenNthCalledWith");function Jt(){R.call(this);let t=[],e=this.received.mock.calls.length,i=this.received.mock.results.reduce((r,n)=>n.type==="return"?(t.push(n.value),r+1):r,0);m.call(this,{pass:i>0,receivedLabeled:this.received.name,handleNot(r){r.push(`Expected returns: ${f("0")}`),r.push(`Received returns: ${h(i.toString())}
47
- `),r.push(F(void 0,t)),r.push(`
48
- Calls: ${h(e.toString())}`)},handleInfo(r){r.push(`Expected returns: >= ${f("1")}`),r.push(`Received returns: ${h(i.toString())}`),r.push(`Calls: ${h(e.toString())}`)}})}a(Jt,"toHaveReturned");function Wt(t){let e=["expected"];R.call(this,e),V.call(this,t,"expected",e);let i=this.received.mock.calls.length,r=this.received.mock.results.reduce((n,s)=>s.type==="return"?n+1:n,0);m.call(this,{expectedLabels:e,pass:r==t,expected:t,receivedLabeled:this.received.name,handleNot(n){n.push(`Expected returns: != ${f(t.toString())}`),n.push(`Calls: ${h(i.toString())}`)},handleInfo(n){n.push(`Expected returns: ${f(t.toString())}`),n.push(`Received returns: ${h(r.toString())}`),n.push(`Calls: ${h(i.toString())}`)}})}a(Wt,"toHaveReturnedTimes");function Vt(t){let e=["expected"];R.call(this,e);let i=[],r=this.received.mock.calls.length,n=this.received.mock.results.reduce((c,l)=>l.type==="return"?(i.push(l.value),c+1):c,0),s=i.at(-1),o=i.length>0&&v(t,s);m.call(this,{pass:o,expectedLabels:e,expected:t,receivedLabeled:this.received.name,handleNot(c){c.push(`Expected returns: not ${f(p(t))}`),c.push(`Received returns:
49
- `),c.push(F(t,i,n)),c.push(`
50
- Calls: ${h(r.toString())}`)},handleInfo(c){c.push(`Expected returns: ${f(p(t))}`),i.length>0&&(c.push(`Received returns:
51
- `),c.push(F(t,i,n))),c.push(`
52
- Returns: ${h(n.toString())}`),c.push(`Calls: ${h(r.toString())}`)}})}a(Vt,"toHaveLastReturnedWith");function Gt(t,e){let i=["nthCall","expected"];R.call(this,i),V.call(this,t,"nthCall",i);let r=[],n=this.received.mock.calls.length,s=this.received.mock.results.reduce((l,u)=>u.type==="return"?(r.push(u.value),l+1):l,0),o=r.at(t-1),c=t<=r.length&&v(e,o);m.call(this,{pass:c,expectedLabels:i,expected:e,receivedLabeled:this.received.name,handleNot(l){l.push(`nthCall: ${t}`),l.push(`Expected returns: not ${f(p(e))}`),l.push(`Received returns:
53
- `),l.push(F(e,r,t)),l.push(`
54
- Returns: ${h(s.toString())}`),l.push(`Calls: ${h(n.toString())}`)},handleInfo(l){l.push(`nthCall: ${t}`),l.push(`Expected returns: ${f(p(e))}`),l.push(`Received returns:
55
- `),l.push(F(e,r,t)),l.push(`
56
- Returns: ${h(s.toString())}`),l.push(`Calls: ${h(n.toString())}`)}})}a(Gt,"toHaveNthReturnedWith");function Kt(t){let e=S(t)?t.matches(this.received):Object.is(this.received,t),i=!e&&v(this.received,t)?'If it should pass with deep equality, replace "toBe" with "toEqual"':void 0;B.call(this,{note:i,pass:e,expected:t,comment:"Object.is equality",expectedLabels:["expected"]})}a(Kt,"toBe");function Yt(t){let e=v(this.received,t);B.call(this,{pass:e,expected:t,comment:"deep equality",expectedLabels:["expected"]})}a(Yt,"toEqual");function Xt(){let t=this.received===null;B.call(this,{pass:t,expected:null})}a(Xt,"toBeNull");function Zt(){let t=this.received===void 0;B.call(this,{pass:t,expected:void 0})}a(Zt,"toBeUndefined");function Qt(){let t=Number.isNaN(this.received);B.call(this,{pass:t,expected:NaN})}a(Qt,"toBeNaN");function ei(){let t=!!this.received;B.call(this,{pass:t,expected:!0})}a(ei,"toBeTruthy");function ti(){let t=!this.received;B.call(this,{pass:t,expected:!1})}a(ti,"toBeFalsy");function ii(){let t=this.received!==void 0;m.call(this,{pass:t,expected:void 0,handleNot(e){e.push(`Expected: ${f(p(void 0))}`)},handleInfo(e){e.push(`Received: ${h(p(this.received))}`)}})}a(ii,"toBeDefined");function ri(t,e){let i=["path","value"];Re.call(this,this.received,"Received",i),b.call(this,t,["string","Array"],"Expected path",i);let r=!0,n=this.received,s=[],o=typeof t=="string"?t.split(".").filter(Boolean):t;for(let c of o){if(!n||!Object.hasOwn(n,c)){r=!1;break}s.push(c),n=n[c]}r&&e!==void 0&&(r=v(n,e)),m.call(this,{pass:r,expectedLabels:i,handleNot(c){c.push(`Expected: not ${f(p(o))}
57
- `),e?c.push(`Expected value: ${f(p(e))}`):c.push(`Received value: ${h(p(n))}`)},handleInfo(c){c.push(`Expected path: ${f(p(o))}`),Object.is(s.join(""),o.join(""))||c.push(`Received path: ${h(p(s))}`),c.push(""),e&&c.push(`Expected value: ${f(p(e))}`),c.push(`Received value: ${h(p(n))}`)}})}a(ri,"toHaveProperty");function ni(t){let e=["expected"];b.call(this,t,["function"],"Received",e);let i=this.received,r=i instanceof t;m.call(this,{pass:r,expectedLabels:e,handleNot(n){n.push(`Expected constructor: not ${f(t.name)}
58
- `)},handleInfo(n){n.push(`Expected constructor: ${f(t.name)}`),i!==null&&typeof i=="object"&&Object.getPrototypeOf(i)!==null&&"constructor"in i?n.push(`Received constructor: ${h(i.constructor.name)}`):(n.push(`
59
- Received value has no prototype`),n.push(`Received value: ${h(p(i))}`))}})}a(ni,"toBeInstanceOf");function si(t){let e=["expected"];b.call(this,this.received,["string","Array"],"Received",e);let i=this.received,r=w(i);if(typeof i=="string"&&typeof t!="string")throw new C({expectedLabels:e,message:`${f("expected")} value must be a string if ${h("received")} value is a string`,expected:{value:t,type:w(t)},received:{value:i,type:r},assertionChain:this.assertionChain});let n=i.indexOf(t)!==-1;m.call(this,{pass:n,expectedLabels:e,comment:"indexOf",handleNot(s){r==="string"?(s.push(`Expected substring: not ${f(p(t))}`),s.push(`Received string: ${h(p(i)).replace(String(t),k(String(t)))}`)):(s.push(`Expected value: not ${f(p(t))}`),s.push(`Received array: ${h(p(i)).replace(p(t),k(p(t)))}`))},handleInfo(s){r==="string"?(s.push(`Expected substring: ${f($(t,"").join(`
45
+ ${O(t,r,e)}
46
+ `),c.push(`Calls: ${h(n.toString())}`)}})}a(Jt,"toHaveBeenNthCalledWith");function Wt(){T.call(this);let e=[],t=this.received.mock.calls.length,i=this.received.mock.results.reduce((r,n)=>n.type==="return"?(e.push(n.value),r+1):r,0);m.call(this,{pass:i>0,receivedLabeled:this.received.name,handleNot(r){r.push(`Expected returns: ${f("0")}`),r.push(`Received returns: ${h(i.toString())}
47
+ `),r.push(F(void 0,e)),r.push(`
48
+ Calls: ${h(t.toString())}`)},handleInfo(r){r.push(`Expected returns: >= ${f("1")}`),r.push(`Received returns: ${h(i.toString())}`),r.push(`Calls: ${h(t.toString())}`)}})}a(Wt,"toHaveReturned");function Vt(e){let t=["expected"];T.call(this,t),V.call(this,e,"expected",t);let i=this.received.mock.calls.length,r=this.received.mock.results.reduce((n,s)=>s.type==="return"?n+1:n,0);m.call(this,{expectedLabels:t,pass:r==e,expected:e,receivedLabeled:this.received.name,handleNot(n){n.push(`Expected returns: != ${f(e.toString())}`),n.push(`Calls: ${h(i.toString())}`)},handleInfo(n){n.push(`Expected returns: ${f(e.toString())}`),n.push(`Received returns: ${h(r.toString())}`),n.push(`Calls: ${h(i.toString())}`)}})}a(Vt,"toHaveReturnedTimes");function Gt(e){let t=["expected"];T.call(this,t);let i=[],r=this.received.mock.calls.length,n=this.received.mock.results.reduce((c,l)=>l.type==="return"?(i.push(l.value),c+1):c,0),s=i.at(-1),o=i.length>0&&v(e,s);m.call(this,{pass:o,expectedLabels:t,expected:e,receivedLabeled:this.received.name,handleNot(c){c.push(`Expected returns: not ${f(p(e))}`),c.push(`Received returns:
49
+ `),c.push(F(e,i,n)),c.push(`
50
+ Calls: ${h(r.toString())}`)},handleInfo(c){c.push(`Expected returns: ${f(p(e))}`),i.length>0&&(c.push(`Received returns:
51
+ `),c.push(F(e,i,n))),c.push(`
52
+ Returns: ${h(n.toString())}`),c.push(`Calls: ${h(r.toString())}`)}})}a(Gt,"toHaveLastReturnedWith");function Kt(e,t){let i=["nthCall","expected"];T.call(this,i),V.call(this,e,"nthCall",i);let r=[],n=this.received.mock.calls.length,s=this.received.mock.results.reduce((l,u)=>u.type==="return"?(r.push(u.value),l+1):l,0),o=r.at(e-1),c=e<=r.length&&v(t,o);m.call(this,{pass:c,expectedLabels:i,expected:t,receivedLabeled:this.received.name,handleNot(l){l.push(`nthCall: ${e}`),l.push(`Expected returns: not ${f(p(t))}`),l.push(`Received returns:
53
+ `),l.push(F(t,r,e)),l.push(`
54
+ Returns: ${h(s.toString())}`),l.push(`Calls: ${h(n.toString())}`)},handleInfo(l){l.push(`nthCall: ${e}`),l.push(`Expected returns: ${f(p(t))}`),l.push(`Received returns:
55
+ `),l.push(F(t,r,e)),l.push(`
56
+ Returns: ${h(s.toString())}`),l.push(`Calls: ${h(n.toString())}`)}})}a(Kt,"toHaveNthReturnedWith");function Yt(e){let t=x(e)?e.matches(this.received):Object.is(this.received,e),i=!t&&v(this.received,e)?'If it should pass with deep equality, replace "toBe" with "toEqual"':void 0;B.call(this,{note:i,pass:t,expected:e,comment:"Object.is equality",expectedLabels:["expected"]})}a(Yt,"toBe");function Xt(e){let t=v(this.received,e);B.call(this,{pass:t,expected:e,comment:"deep equality",expectedLabels:["expected"]})}a(Xt,"toEqual");function Zt(){let e=this.received===null;B.call(this,{pass:e,expected:null})}a(Zt,"toBeNull");function Qt(){let e=this.received===void 0;B.call(this,{pass:e,expected:void 0})}a(Qt,"toBeUndefined");function ei(){let e=Number.isNaN(this.received);B.call(this,{pass:e,expected:NaN})}a(ei,"toBeNaN");function ti(){let e=!!this.received;B.call(this,{pass:e,expected:!0})}a(ti,"toBeTruthy");function ii(){let e=!this.received;B.call(this,{pass:e,expected:!1})}a(ii,"toBeFalsy");function ri(){let e=this.received!==void 0;m.call(this,{pass:e,expected:void 0,handleNot(t){t.push(`Expected: ${f(p(void 0))}`)},handleInfo(t){t.push(`Received: ${h(p(this.received))}`)}})}a(ri,"toBeDefined");function ni(e,t){let i=["path","value"];Te.call(this,this.received,"Received",i),b.call(this,e,["string","Array"],"Expected path",i);let r=!0,n=this.received,s=[],o=typeof e=="string"?e.split(".").filter(Boolean):e;for(let c of o){if(!n||!Object.hasOwn(n,c)){r=!1;break}s.push(c),n=n[c]}r&&t!==void 0&&(r=v(n,t)),m.call(this,{pass:r,expectedLabels:i,handleNot(c){c.push(`Expected: not ${f(p(o))}
57
+ `),t?c.push(`Expected value: ${f(p(t))}`):c.push(`Received value: ${h(p(n))}`)},handleInfo(c){c.push(`Expected path: ${f(p(o))}`),Object.is(s.join(""),o.join(""))||c.push(`Received path: ${h(p(s))}`),c.push(""),t&&c.push(`Expected value: ${f(p(t))}`),c.push(`Received value: ${h(p(n))}`)}})}a(ni,"toHaveProperty");function si(e){let t=["expected"];b.call(this,e,["function"],"Received",t);let i=this.received,r=i instanceof e;m.call(this,{pass:r,expectedLabels:t,handleNot(n){n.push(`Expected constructor: not ${f(e.name)}
58
+ `)},handleInfo(n){n.push(`Expected constructor: ${f(e.name)}`),i!==null&&typeof i=="object"&&Object.getPrototypeOf(i)!==null&&"constructor"in i?n.push(`Received constructor: ${h(i.constructor.name)}`):(n.push(`
59
+ Received value has no prototype`),n.push(`Received value: ${h(p(i))}`))}})}a(si,"toBeInstanceOf");function oi(e){let t=["expected"];b.call(this,this.received,["string","Array"],"Received",t);let i=this.received,r=w(i);if(typeof i=="string"&&typeof e!="string")throw new C({expectedLabels:t,message:`${f("expected")} value must be a string if ${h("received")} value is a string`,expected:{value:e,type:w(e)},received:{value:i,type:r},assertionChain:this.assertionChain});let n=i.indexOf(e)!==-1;m.call(this,{pass:n,expectedLabels:t,comment:"indexOf",handleNot(s){r==="string"?(s.push(`Expected substring: not ${f(p(e))}`),s.push(`Received string: ${h(p(i)).replace(String(e),k(String(e)))}`)):(s.push(`Expected value: not ${f(p(e))}`),s.push(`Received array: ${h(p(i)).replace(p(e),k(p(e)))}`))},handleInfo(s){r==="string"?(s.push(`Expected substring: ${f($(e,"").join(`
60
60
  `))}`),s.push(`Received string: ${h($(r,"").join(`
61
- `))}`)):([...i].findIndex(o=>v(o,t))!==-1&&s.push(I(`Looks like you wanted to test for object/array equality with the stricter \`toContain\` matcher.
61
+ `))}`)):([...i].findIndex(o=>v(o,e))!==-1&&s.push(I(`Looks like you wanted to test for object/array equality with the stricter \`toContain\` matcher.
62
62
  You probably need to use \`${bt("toContainEqual")}\` instead.
63
- `)),s.push(`Expected value: ${f(p(t))}`),s.push(`Received array: ${h(p(r))}`))}})}a(si,"toContain");function oi(t){let e=["expected"];b.call(this,this.received,["string","Array"],"Received",e);let i=this.received,r=w(i),n=[...i].findIndex(s=>v(s,t))!==-1;m.call(this,{pass:n,expectedLabels:e,comment:"deep equality",handleNot(s){s.push(`Expected value: not ${f(p(t))}`),s.push(`Received array: ${h(p(i)).replace(p(t),k(p(t)))}`)},handleInfo(s){r==="string"&&typeof t=="string"&&i.indexOf(t)!==-1&&s.push(I("Looks like you wanted to test for string equality with the stricter `toContainEqual` matcher. You probably need to use `toContain` instead.\n")),s.push(`Expected: ${f(p(t))}`),s.push(`Received: ${h(p(i))}`)}})}a(oi,"toContainEqual");function ai(t){let e=["expected"];Re.call(this,this.received,"Received",e),b.call(this,this.received,["object"],"Received",e),b.call(this,t,["object"],"Expected",e);let i=this.received,r=v(t,i,!1);B.call(this,{pass:r,expected:t,expectedLabels:e})}a(ai,"toMatchObject");var pe={toThrow:Ct,toMatch:At,toHaveLength:zt,toContain:si,toMatchObject:ai,toHaveProperty:ri,toBeInstanceOf:ni,toContainEqual:oi,toBe:Kt,toEqual:Yt,toBeNaN:Qt,toBeNull:Xt,toBeFalsy:ti,toBeTruthy:ei,toBeDefined:ii,toBeUndefined:Zt,toBeCloseTo:jt,toBeLessThan:Ft,toBeGreaterThan:Pt,toBeLessThanOrEqual:Mt,toBeGreaterThanOrEqual:Ot,toHaveReturned:Jt,toHaveBeenCalled:Ut,toHaveReturnedTimes:Wt,toHaveBeenCalledWith:_t,toHaveBeenCalledTimes:Dt,toHaveNthReturnedWith:Gt,toHaveLastReturnedWith:Vt,toHaveBeenNthCalledWith:qt,toHaveBeenLastCalledWith:Ht},L=class{static{a(this,"AbstractPattern")}constructor(t,e=!1){this.name=t,this.isInverse=e}applyInverse(t){return this.isInverse?!t:t}},ci=class _ extends L{static{a(this,"_AnyPattern")}constructor(e){super(`Any<${e.name}>`),this.expected=e}static TYPE_CHECKS={String:a(e=>typeof e=="string"||e instanceof String,"String"),Number:a(e=>typeof e=="number"||e instanceof Number,"Number"),Function:a(e=>typeof e=="function"||e instanceof Function,"Function"),Boolean:a(e=>typeof e=="boolean"||e instanceof Boolean,"Boolean"),BigInt:a(e=>typeof e=="bigint"||e instanceof BigInt,"BigInt"),Symbol:a(e=>typeof e=="symbol"||e instanceof Symbol,"Symbol"),Object:a(e=>typeof e=="object","Object"),Array:Array.isArray};static create(e){if(e===void 0)throw new TypeError("any() expects to be passed a constructor function. Please pass one or use anything() to match any object.");return new _(e)}get expectedLabel(){return`Any<${this.expected.name}>`}matches(e){return this.expected.name in _.TYPE_CHECKS?_.TYPE_CHECKS[this.expected.name](e):e instanceof this.expected}},fe=class ke extends L{static{a(this,"_ArrayOfPattern")}constructor(e,i){super("ArrayOf",e),this.expected=i}static create(e,i){if(i===void 0)throw new TypeError("arrayOf() expects a matcher or value.");return new ke(e,i)}get expectedLabel(){return`${this.isInverse?"Not ":""}ArrayOf( ${this.describe(this.expected)} )`}matches(e){if(!Array.isArray(e))return this.applyInverse(!1);let i=e.every(r=>this.matchElement(r,this.expected));return this.applyInverse(i)}matchElement(e,i){return S(i)?i.matches(e):v(e,i)}describe(e){return S(e)?e.expectedLabel:typeof e=="string"?`"${e}"`:$(e,"").join(" ")}},de=class Be extends L{static{a(this,"_CloseToPattern")}constructor(e,i,r=2){super("CloseTo",e),this.expected=i,this.precision=r}static create(e,i,r){return new Be(e,i,r)}get expectedLabel(){let e=this.isInverse?"Not ":"",i=this.precision!==1?"s":"";return`${e}CloseTo(${this.expected}, ${this.precision} digit${i})`}matches(e){let i=this.expected;return typeof e!="number"||typeof i!="number"?this.applyInverse(!1):this.applyInverse(Math.abs(e-i)<Math.pow(10,-this.precision)/2)}},li=class Le extends L{static{a(this,"_AnythingPattern")}constructor(){super("Anything")}static create(){return new Le}get expectedLabel(){return"Anything"}matches(e){return e!=null}},ge=class Ce extends L{static{a(this,"_StringMatchingPattern")}constructor(e,i){super("StringMatching",e),this.expected=i}static create(e,i){let r=typeof i;if(i==null)throw new TypeError("stringMatching() expects a string or RegExp.");if(r!=="string"&&!(i instanceof RegExp))throw new TypeError("stringMatching() expects a string or RegExp.");return new Ce(e,i)}get expectedLabel(){let e=this.isInverse?"Not ":"";return typeof this.expected=="string"?`${e}stringMatching("${this.expected}")`:`${e}stringMatching(${this.expected.toString()})`}matches(e){if(typeof e!="string")return this.applyInverse(!1);let i;return typeof this.expected=="string"?i=e.includes(this.expected):i=this.expected.test(e),this.applyInverse(i)}},me=class ze extends L{static{a(this,"_ArrayContainingPattern")}constructor(e,i){super("ArrayContaining",e),this.expected=i}static create(e,i){if(!Array.isArray(i))throw new TypeError("arrayContaining() expects an array.");return new ze(e,i)}get expectedLabel(){return`${this.isInverse?"Not ":""}ArrayContaining(${this.describe(this.expected)})`}matches(e){if(!Array.isArray(e))return this.applyInverse(!1);let i=this.expected.every(r=>e.some(n=>this.matchElement(n,r)));return this.applyInverse(i)}matchElement(e,i){return S(i)?i.matches(e):v(e,i)}describe(e){return S(e)?e.expectedLabel:$(e,"").join(" ")}},ye=class Ae extends L{static{a(this,"_ObjectContainingPattern")}constructor(e,i){super("ObjectContaining",e),this.expected=i}static create(e,i){if(typeof i!="object"||i===null||Array.isArray(i))throw new TypeError("objectContaining() expects a plain object.");return new Ae(e,i)}get expectedLabel(){return`${this.isInverse?"Not ":""}ObjectContaining(${this.describe(this.expected)})`}matches(e){if(typeof e!="object"||e===null)return this.applyInverse(!1);let i=Object.keys(this.expected).every(r=>X(e,r)?this.matchElement(e[r],this.expected[r]):!1);return this.applyInverse(i)}matchElement(e,i){return S(i)?i.matches(e):v(e,i)}describe(e){return S(e)?e.expectedLabel:$(e,"").join(" ")}},ve=class je extends L{static{a(this,"_StringContainingPattern")}constructor(e,i){super("StringContaining",e),this.expected=i}static create(e,i){if(typeof i!="string")throw new TypeError("stringContaining() expects a string.");return new je(e,i)}get expectedLabel(){return`${this.isInverse?"Not ":""}stringContaining("${this.expected}")`}matches(e){return typeof e!="string"?this.applyInverse(!1):this.applyInverse(e.includes(this.expected))}},hi={any:ci.create,anything:li.create,closeTo:de.create.bind(null,!1),arrayOf:fe.create.bind(null,!1),stringMatching:ge.create.bind(null,!1),arrayContaining:me.create.bind(null,!1),objectContaining:ye.create.bind(null,!1),stringContaining:ve.create.bind(null,!1),not:{closeTo:de.create.bind(null,!0),arrayOf:fe.create.bind(null,!0),stringMatching:ge.create.bind(null,!0),arrayContaining:me.create.bind(null,!0),objectContaining:ye.create.bind(null,!1),stringContaining:ve.create.bind(null,!0)}},ui=class extends Q{static{a(this,"xJetPromiseError")}constructor(t){let e=[`${ee(t)}
64
- `,`Matcher error: ${t.message}`,`${t.promiseKind} to value: ${h($(t.received,"").join(" "))}`];super(e.join(`
65
- `),"xJetPromiseError")}},Pe=class{static{a(this,"MatcherService")}constructor(t){this.received=t}macherName="";promise;notModifier=!1;assertionChain=[];rejectsModifier=!1;resolvesModifier=!1;get not(){return this.notModifier=!0,this}get rejects(){if(this.resolvesModifier)throw new Error('Cannot use "rejects" modifier after "resolved" modifier.');return this.rejectsModifier=!0,this}get resolves(){if(this.rejectsModifier)throw new Error('Cannot use "resolved" modifier after "rejects" modifier.');return this.resolvesModifier=!0,this}invoke(t,e,i){return this.macherName=t,this.rejectsModifier||this.resolvesModifier?(this.pushToChain(t),this.promise=this.resolvesModifier?"resolves":"rejects",this.invokeAsync(e,i)):(this.pushToChain(t),e.call(this,...i))}async invokeAsync(t,e){let i=!1,r=typeof this.received=="function"?this.received():this.received;if(!st(r))throw new C({message:`${h("received")} value must be a promise or a function returning a promise`,assertionChain:this.assertionChain,received:{type:w(r),value:r}});try{this.received=await r,i=!0}catch(n){this.resolvesModifier&&this.throwPromiseError("Rejected",n),this.received=n}return i&&this.rejectsModifier&&this.throwPromiseError("Resolved",this.received),t.call(this,...e)}pushToChain(t){this.promise&&this.assertionChain.push(this.promise),this.notModifier&&this.assertionChain.push("not"),this.assertionChain.push(t)}throwPromiseError(t,e){let i=t==="Resolved"?"resolved":"rejected",r=t==="Resolved"?"rejected":"resolved";throw new ui({message:`${h("received")} promise ${i} instead of ${r}`,received:e,promiseKind:t,assertionChain:this.assertionChain})}};for(let t of Object.keys(pe)){let e=Pe.prototype,i=pe[t];Object.defineProperty(e,t,{value:a(function(...r){return this.invoke(t,i,r)},"value")}),Object.defineProperty(e[t],"name",{value:t})}var pi=a((t,...e)=>{if(e.length>0)throw new Error(`Expect takes at most one argument. Received ${e.length+1} arguments instead.`);return new Pe(t)},"coreExpect"),Wi=Object.assign(pi,hi);function Me(t,e,i){let r=`${e}${i}`,n=t[r];if(!i)throw new Error(`Invalid type(${i}) parameter`);if(!(r in t))throw new Error(`Method "${r.toString()}" does not exist on Buffer`);return n.bind(t)}a(Me,"b");function Ne(t,e){return Me(t,"read",e)}a(Ne,"h");function Ue(t,e){return Me(t,"write",e)}a(Ue,"d");function te(t,e,i=0){if(e<0)throw new Error("Split position cannot be negative");if(e>t.length)throw new Error("Split position cannot exceed buffer length");let r=t.subarray(0,e),n=e+i;return n>=t.length?[r,Buffer.alloc(0)]:[r,t.subarray(n)]}a(te,"f");function De(t=0){let{position:e,type:i}=this.descriptor,r=this.offset+e+t;return i.toObject(this.buffer.subarray(r),n=>{this.offset+=n})}a(De,"l");function fi(){let t=[],{arraySize:e=0,size:i}=this.descriptor;t.length=e;for(let r=0;r<e;r++)t[r]=De.call(this,r*i);return t}a(fi,"U");function di(){return"arraySize"in this.descriptor&&this.descriptor.arraySize?fi.call(this):De.call(this)}a(di,"S");function _e(t,e=0){t??={};let{position:i,type:r,size:n}=this.descriptor,s=r.toBuffer(t),o=this.offset+i+e,[c,l]=te(this.buffer,o,n);this.buffer=Buffer.concat([c,s,l]),s.length>n&&(this.offset+=s.length-n)}a(_e,"T");function gi(t){let{arraySize:e=0,size:i}=this.descriptor;for(let r=0;r<e;r++){let n=r<t.length?t[r]:{};_e.call(this,n,r*i)}}a(gi,"W");function mi(t){return"arraySize"in this.descriptor&&this.descriptor.arraySize?gi.call(this,Array.isArray(t)?t:[t]):_e.call(this,Array.isArray(t)?t[0]||{}:t)}a(mi,"I");var z={Int8:8,UInt8:8,Int16LE:16,Int16BE:16,UInt16LE:16,UInt16BE:16,FloatLE:32,FloatBE:32,Int32LE:32,Int32BE:32,UInt32LE:32,UInt32BE:32,DoubleLE:64,DoubleBE:64,BigInt64LE:64,BigInt64BE:64,BigUInt64LE:64,BigUInt64BE:64};function yi(t,e=0){let i=/^([A-Za-z][A-Za-z0-9]*)(?:\[(\d+)\])?$/i,r=t.match(i);if(!r)throw new Error(`Invalid primitive descriptor: ${t}`);let n=z[r[1]];if(!n)throw new Error(`Invalid primitive type: ${r[1]}`);let s=r[1],o=r[2]?parseInt(r[2]):void 0;return{type:s,position:e,size:n/8,arraySize:o,kind:"primitive"}}a(yi,"x");function He(t=0){let{position:e,type:i}=this.descriptor,r=this.offset+e+t;return Ne(this.buffer,i)(r)}a(He,"z");function vi(){let t=[],{arraySize:e=0,size:i}=this.descriptor;t.length=e;for(let r=0;r<e;r++)t[r]=He.call(this,r*i);return t}a(vi,"N");function bi(){return"arraySize"in this.descriptor&&this.descriptor.arraySize?vi.call(this):He.call(this)}a(bi,"w");function qe(t,e=0){t??=0;let{position:i,type:r}=this.descriptor,n=r.includes("Big");if(n&&t===0&&(t=BigInt(0)),n&&typeof t!="bigint")throw new TypeError(`Expected a BigInt for field "${r}", but received ${t}`);if(!n&&typeof t!="number")throw new TypeError(`Expected a number for field "${r}", but received ${t}`);let s=this.offset+i+e;Ue(this.buffer,r)(t,s)}a(qe,"B");function Ei(t){let{arraySize:e=0,size:i}=this.descriptor;for(let r=0;r<e;r++){let n=r<t.length?t[r]:0;qe.call(this,n,r*i)}}a(Ei,"_");function $i(t){if("arraySize"in this.descriptor&&this.descriptor.arraySize)return Ei.call(this,Array.isArray(t)?t:[t]);qe.call(this,Array.isArray(t)?t[0]||0:t)}a($i,"P");var Oe=new Map;function re(t){return t.startsWith("Int")}a(re,"y");function Je(t){let e=Oe.get(t);return e===void 0&&(e=(1<<t)-1,Oe.set(t,e)),e}a(Je,"D");function xi(t,e){return re(t.type)?Number(BigInt.asIntN(t.bitSize,BigInt(e))):e}a(xi,"j");function Si(t,e){let i=re(t.type),{bitSize:r,type:n}=t,s=i?(1<<r-1)-1:(1<<r)-1,o=i?-(1<<r-1):0;if(e<o||e>s)throw new RangeError(`Value ${e} does not fit within ${r} bits for type ${n}`)}a(Si,"G");function We(t,e){if(t.bitSize<1||t.bitPosition<0)throw new Error(`bitSize(${t.bitSize}) and bitPosition(${t.bitPosition}) must be greater than bitSize(1) and bitPosition(0) for ${e}`);if(z[t.type]>32)throw new Error(`${t.type} is not supported yet`);if(t.bitPosition+t.bitSize>z[t.type])throw new Error(`bitPosition(${t.bitPosition}) + bitSize(${t.bitSize}) exceeds ${t.type} size for ${e}`)}a(We,"v");function Ii(t,e){We(e,"read operation");let{type:i,bitPosition:r,bitSize:n}=e,s=Je(n),o=t>>r&s;return re(i)&&o&1<<n-1?o|~s:o}a(Ii,"Z");function wi(t,e,i){We(e,"write operation"),Si(e,i);let{bitPosition:r,bitSize:n}=e,s=xi(e,i),o=Je(n)<<r;return t&~o|s<<r&o}a(wi,"q");function Ri(t,e=0,i=0){let[r,n]=t.split(":",2),s=parseInt(n,10),o=z[r],c=r.endsWith("BE");if(!o)throw new Error(`${r} is not supported`);if(i<0||i>=o)throw new Error(`Bitfield position ${i} is out of bounds (must be between 0 and ${o-1})`);if(!s)throw new Error(`${t} is not valid`);if(s+i>=o)throw new Error(`${r} size (${o}) is not enough to hold ${s} bits starting at position ${i}`);return{kind:"bitfield",type:r,size:o/8,position:e,bitSize:s,bitPosition:i,isBigEndian:c}}a(Ri,"$");function Ti(){let t=this.descriptor.position+this.offset,e=this.descriptor.isBigEndian?"BE":"LE",i=this.buffer[`readUInt${e}`](t,this.descriptor.size);return Ii(i,this.descriptor)}a(Ti,"C");function ki(t){let e=this.descriptor.position+this.offset,i=this.descriptor.isBigEndian?"BE":"LE",r=this.buffer[`readUInt${i}`](e,this.descriptor.size),n=wi(r,this.descriptor,t);this.buffer[`writeUInt${i}`](n,e,this.descriptor.size)}a(ki,"F");var Fe=new Set(["utf8","ascii","string"]);function Bi(t,e=0){let i=/^(utf8|ascii|string)(?:\[(\d+)\])?$/i,r=t.match(i);if(!r)throw new Error(`Invalid string descriptor: ${t}`);let n=r[1].toLowerCase(),s=r[2]?parseInt(r[2]):void 0;return{type:n,arraySize:s,position:e,size:2,lengthType:"UInt16LE",kind:"string"}}a(Bi,"A");function Ve(t=0){let{position:e,type:i,size:r}=this.descriptor,n=this.offset+e+t,s=i==="string"?"utf8":i;if("lengthType"in this.descriptor&&this.descriptor.lengthType){if(this.descriptor.lengthType.includes("Big"))throw new Error("BigInt are not supported");let o=this.descriptor.lengthType,c=Number(Ne(this.buffer,o)(n)),l=n+r;if(this.offset+=c,l+c>this.buffer.length)throw new Error(`String prefix length exceeds buffer position: ${l} size: ${c} > ${this.buffer.length}`);return this.buffer.subarray(l,l+c).toString(s)}if("nullTerminated"in this.descriptor){let o=n,c="maxLength"in this.descriptor?this.descriptor.maxLength:0;for(;o<this.buffer.length&&this.buffer[o]!==0;){if(c&&o>c)throw new Error(`NullTerminated String exceeds maximum length of ${c}`);o++}let l=o-n;return this.offset+=l+1,this.buffer.subarray(n,o).toString(s)}return this.buffer.subarray(n,n+r).toString(s)}a(Ve,"M");function Li(){let t=[],{arraySize:e=0,size:i}=this.descriptor;t.length=e;for(let r=0;r<e;r++)t[r]=Ve.call(this,r*i);return t}a(Li,"Y");function Ci(){return"arraySize"in this.descriptor&&this.descriptor.arraySize?Li.call(this):Ve.call(this)}a(Ci,"L");function Ge(t,e=0){t??="";let{position:i,type:r,size:n}=this.descriptor,s=this.offset+i+e,o=r==="string"?"utf8":r;if("lengthType"in this.descriptor&&this.descriptor.lengthType){if(this.descriptor.lengthType.includes("Big"))throw new Error("BigInt are not supported");let c=Buffer.from(t,o);Ue(this.buffer,this.descriptor.lengthType)(c.length,s);let[l,u]=te(this.buffer,s+n);this.buffer=Buffer.concat([l,c,u]),this.offset+=c.length;return}if("nullTerminated"in this.descriptor){"maxLength"in this.descriptor&&this.descriptor.maxLength&&(t=t.length>this.descriptor.maxLength?t.slice(0,this.descriptor.maxLength):t);let c=t.endsWith("\0")?t:`${t}\0`,l=Buffer.from(c,o),[u,d]=te(this.buffer,s,n);this.buffer=Buffer.concat([u,l,d]),this.offset+=l.length;return}this.buffer.write(t,s,n,o)}a(Ge,"k");function zi(t){let{arraySize:e=0,size:i}=this.descriptor;for(let r=0;r<e;r++){let n=r<t.length?t[r]:"";Ge.call(this,n,r*i)}}a(zi,"O");function Ai(t){return"arraySize"in this.descriptor&&this.descriptor.arraySize?zi.call(this,Array.isArray(t)?t:[t]):Ge.call(this,Array.isArray(t)?t[0]||"":t)}a(Ai,"V");var A=class ie{static{a(this,"e")}size;schema=new Map;constructor(e){this.size=this.compileSchema(e)}toObject(e,i){if(!Buffer.isBuffer(e))throw new Error(`Expected a buffer, but received ${typeof e}`);if(e.length<this.size)throw new Error(`Buffer size is less than expected: ${e.length} < ${this.size}`);let r={},n={buffer:e,offset:0};for(let[s,o]of this.schema)n.descriptor=o,r[s]=this.readValue(n,o.kind);return i&&typeof i=="function"&&i(n.offset),r}toBuffer(e){if(!e||typeof e!="object")throw new Error(`Expected an object of fields, but received ${typeof e}`);let i={buffer:Buffer.alloc(this.size),offset:0};for(let[r,n]of this.schema){i.descriptor=n;let s=e[r];this.writeValue(i,n.kind,s)}return i.buffer}readValue(e,i){switch(i){case"struct":return di.call(e);case"bitfield":return Ti.call(e);case"string":return Ci.call(e);default:return bi.call(e)}}writeValue(e,i,r){switch(i){case"struct":mi.call(e,r);break;case"bitfield":ki.call(e,r);break;case"string":Ai.call(e,r);break;default:$i.call(e,r)}}computeFieldSize(e,i){if(e.type instanceof ie)return{...e,position:i,size:e.type.size,kind:"struct"};if(Fe.has(e.type))return this.computeStringFieldSize(e,i);let r=z[e.type];if(r!==void 0)return{...e,position:i,size:r/8,kind:"primitive"};throw new Error(`Invalid field type: ${e.type}`)}computeStringFieldSize(e,i){let r={...e,position:i,kind:"string"};if("lengthType"in e&&e.lengthType){let n=z[e.lengthType];if(!n)throw new Error(`Invalid length type: ${e.lengthType}`);r.size=n/8}else"nullTerminated"in e&&e.nullTerminated?r.size=0:(!("size"in e)||!e.size)&&(r.lengthType="UInt16LE",r.size=z.UInt16LE/8);return r}parseStringNotation(e,i){return e.includes(":")?Ri(e,i):[...Fe].find(r=>e.startsWith(r))?Bi(e,i):yi(e,i)}convertToSizedField(e,i){return e instanceof ie?{type:e,position:i,size:e.size,kind:"struct"}:typeof e=="string"?this.parseStringNotation(e,i):this.computeFieldSize(e,i)}compileSchema(e){let i={bits:0,bytes:0,bitFieldSize:0,bitFieldType:"UInt8"};for(let[r,n]of Object.entries(e)){let s=this.convertToSizedField(n,i.bytes);if("arraySize"in s&&s.arraySize&&s.arraySize>=Number.MAX_SAFE_INTEGER)throw new Error(`Array size exceeds maximum safe integer: ${s.arraySize}`);"bitSize"in s&&s.bitSize>0?this.processBitfield(i,r,s):this.processStandardField(i,r,s)}return i.bits>0&&(i.bytes+=i.bitFieldSize),i.bytes}processBitfield(e,i,r){let n=r.size*8,s=r.bitSize;(e.bits+s>n||e.bitFieldType!==r.type||e.bitFieldSize!==r.size)&&(e.bytes+=e.bitFieldSize,e.bits=0,r.position=e.bytes),r.bitPosition=e.bits,this.schema.set(i,r),e.bits+=s,e.bitFieldType=r.type,e.bitFieldSize=r.size}processStandardField(e,i,r){e.bits>0&&(e.bytes+=e.bitFieldSize,e.bits=0,r.position=e.bytes),this.schema.set(i,r);let n="arraySize"in r&&r.arraySize||0,s=n>0?r.size*n:r.size;e.bytes+=s}};var ji=new A({line:"UInt32LE",column:"UInt32LE",source:"string"}),Ke=new A({kind:"UInt8:4",suiteId:{type:"string",size:14},runnerId:{type:"string",size:14},timestamp:"string"}),Pi=new A({level:"UInt8",message:{type:"string",lengthType:"UInt32LE"},ancestry:{type:"string",lengthType:"UInt32LE"},invocation:ji}),ne=new A({error:{type:"string",lengthType:"UInt32LE"}}),Oi=new A({type:"UInt8:5",todo:"UInt8:1",skipped:"UInt8:1",duration:"UInt32LE",ancestry:{type:"string",lengthType:"UInt32LE"},description:{type:"string",lengthType:"UInt32LE"}}),Fi=new A({type:"UInt8:5",passed:"UInt8:1",duration:"UInt32LE",ancestry:{type:"string",lengthType:"UInt32LE"},description:{type:"string",lengthType:"UInt32LE"},errors:{type:"string",lengthType:"UInt32LE"}});function Mi(t,e,i){let r=Ke.toBuffer({kind:2,suiteId:e??"",runnerId:i??"",timestamp:new Date().toISOString()}),n=ne.toBuffer({error:JSON.stringify(q(t))});return Buffer.concat([r,n])}a(Mi,"encodeErrorSchema");export{K as MockState,Mi as encodeErrorSchema};
63
+ `)),s.push(`Expected value: ${f(p(e))}`),s.push(`Received array: ${h(p(r))}`))}})}a(oi,"toContain");function ai(e){let t=["expected"];b.call(this,this.received,["string","Array"],"Received",t);let i=this.received,r=w(i),n=[...i].findIndex(s=>v(s,e))!==-1;m.call(this,{pass:n,expectedLabels:t,comment:"deep equality",handleNot(s){s.push(`Expected value: not ${f(p(e))}`),s.push(`Received array: ${h(p(i)).replace(p(e),k(p(e)))}`)},handleInfo(s){r==="string"&&typeof e=="string"&&i.indexOf(e)!==-1&&s.push(I("Looks like you wanted to test for string equality with the stricter `toContainEqual` matcher. You probably need to use `toContain` instead.\n")),s.push(`Expected: ${f(p(e))}`),s.push(`Received: ${h(p(i))}`)}})}a(ai,"toContainEqual");function ci(e){let t=["expected"];Te.call(this,this.received,"Received",t),b.call(this,this.received,["object"],"Received",t),b.call(this,e,["object"],"Expected",t);let i=this.received,r=v(e,i,!1);B.call(this,{pass:r,expected:e,expectedLabels:t})}a(ci,"toMatchObject");var pe={toThrow:At,toMatch:Pt,toHaveLength:zt,toContain:oi,toMatchObject:ci,toHaveProperty:ni,toBeInstanceOf:si,toContainEqual:ai,toBe:Yt,toEqual:Xt,toBeNaN:ei,toBeNull:Zt,toBeFalsy:ii,toBeTruthy:ti,toBeDefined:ri,toBeUndefined:Qt,toBeCloseTo:jt,toBeLessThan:Mt,toBeGreaterThan:Ot,toBeLessThanOrEqual:Nt,toBeGreaterThanOrEqual:Ft,toHaveReturned:Wt,toHaveBeenCalled:Dt,toHaveReturnedTimes:Vt,toHaveBeenCalledWith:Ht,toHaveBeenCalledTimes:_t,toHaveNthReturnedWith:Kt,toHaveLastReturnedWith:Gt,toHaveBeenNthCalledWith:Jt,toHaveBeenLastCalledWith:qt},L=class{static{a(this,"AbstractPattern")}constructor(e,t=!1){this.name=e,this.isInverse=t}applyInverse(e){return this.isInverse?!e:e}},li=class _ extends L{static{a(this,"_AnyPattern")}constructor(t){super(`Any<${t.name||"Anonymous"}>`),this.expected=t}static TYPE_CHECKS={String:a(t=>typeof t=="string"||t instanceof String,"String"),Number:a(t=>typeof t=="number"||t instanceof Number,"Number"),Function:a(t=>typeof t=="function"||t instanceof Function,"Function"),Boolean:a(t=>typeof t=="boolean"||t instanceof Boolean,"Boolean"),BigInt:a(t=>typeof t=="bigint"||t instanceof BigInt,"BigInt"),Symbol:a(t=>typeof t=="symbol"||t instanceof Symbol,"Symbol"),Object:a(t=>typeof t=="object","Object"),Array:Array.isArray};static create(t){if(t===void 0)throw new TypeError("any() expects to be passed a constructor function. Please pass one or use anything() to match any object.");return new _(t)}get expectedLabel(){return this.name??"Any<Anonymous>"}matches(t){return this.expected.name in _.TYPE_CHECKS?_.TYPE_CHECKS[this.expected.name](t):t instanceof this.expected}},fe=class ke extends L{static{a(this,"_ArrayOfPattern")}constructor(t,i){super("ArrayOf",t),this.expected=i}static create(t,i){if(i===void 0)throw new TypeError("arrayOf() expects a matcher or value.");return new ke(t,i)}get expectedLabel(){return`${this.isInverse?"Not ":""}ArrayOf( ${this.describe(this.expected)} )`}matches(t){if(!Array.isArray(t))return this.applyInverse(!1);let i=t.every(r=>this.matchElement(r,this.expected));return this.applyInverse(i)}matchElement(t,i){return x(i)?i.matches(t):v(t,i)}describe(t){return x(t)?t.expectedLabel:typeof t=="string"?`"${t}"`:$(t,"").join(" ")}},de=class Be extends L{static{a(this,"_CloseToPattern")}constructor(t,i,r=2){super("CloseTo",t),this.expected=i,this.precision=r}static create(t,i,r){return new Be(t,i,r)}get expectedLabel(){let t=this.isInverse?"Not ":"",i=this.precision!==1?"s":"";return`${t}CloseTo(${this.expected}, ${this.precision} digit${i})`}matches(t){let i=this.expected;return typeof t!="number"||typeof i!="number"?this.applyInverse(!1):this.applyInverse(Math.abs(t-i)<Math.pow(10,-this.precision)/2)}},hi=class Le extends L{static{a(this,"_AnythingPattern")}constructor(){super("Anything")}static create(){return new Le}get expectedLabel(){return"Anything"}matches(t){return t!=null}},ge=class Ce extends L{static{a(this,"_StringMatchingPattern")}constructor(t,i){super("StringMatching",t),this.expected=i}static create(t,i){let r=typeof i;if(i==null)throw new TypeError("stringMatching() expects a string or RegExp.");if(r!=="string"&&!(i instanceof RegExp))throw new TypeError("stringMatching() expects a string or RegExp.");return new Ce(t,i)}get expectedLabel(){let t=this.isInverse?"Not ":"";return typeof this.expected=="string"?`${t}stringMatching("${this.expected}")`:`${t}stringMatching(${this.expected.toString()})`}matches(t){if(typeof t!="string")return this.applyInverse(!1);let i;return typeof this.expected=="string"?i=t.includes(this.expected):i=this.expected.test(t),this.applyInverse(i)}},me=class Ae extends L{static{a(this,"_ArrayContainingPattern")}constructor(t,i){super("ArrayContaining",t),this.expected=i}static create(t,i){if(!Array.isArray(i))throw new TypeError("arrayContaining() expects an array.");return new Ae(t,i)}get expectedLabel(){return`${this.isInverse?"Not ":""}ArrayContaining(${this.describe(this.expected)})`}matches(t){if(!Array.isArray(t))return this.applyInverse(!1);let i=this.expected.every(r=>t.some(n=>this.matchElement(n,r)));return this.applyInverse(i)}matchElement(t,i){return x(i)?i.matches(t):v(t,i)}describe(t){return x(t)?t.expectedLabel:$(t,"").join(" ")}},ye=class ze extends L{static{a(this,"_ObjectContainingPattern")}constructor(t,i){super("ObjectContaining",t),this.expected=i}static create(t,i){if(typeof i!="object"||i===null||Array.isArray(i))throw new TypeError("objectContaining() expects a plain object.");return new ze(t,i)}get expectedLabel(){return`${this.isInverse?"Not ":""}ObjectContaining(${this.describe(this.expected)})`}matches(t){if(typeof t!="object"||t===null)return this.applyInverse(!1);let i=Object.keys(this.expected).every(r=>X(t,r)?this.matchElement(t[r],this.expected[r]):!1);return this.applyInverse(i)}matchElement(t,i){return x(i)?i.matches(t):v(t,i)}describe(t){return x(t)?t.expectedLabel:$(t,"").join(" ")}},ve=class Pe extends L{static{a(this,"_StringContainingPattern")}constructor(t,i){super("StringContaining",t),this.expected=i}static create(t,i){if(typeof i!="string")throw new TypeError("stringContaining() expects a string.");return new Pe(t,i)}get expectedLabel(){return`${this.isInverse?"Not ":""}stringContaining("${this.expected}")`}matches(t){return typeof t!="string"?this.applyInverse(!1):this.applyInverse(t.includes(this.expected))}},ui={any:li.create,anything:hi.create,closeTo:de.create.bind(null,!1),arrayOf:fe.create.bind(null,!1),stringMatching:ge.create.bind(null,!1),arrayContaining:me.create.bind(null,!1),objectContaining:ye.create.bind(null,!1),stringContaining:ve.create.bind(null,!1),not:{closeTo:de.create.bind(null,!0),arrayOf:fe.create.bind(null,!0),stringMatching:ge.create.bind(null,!0),arrayContaining:me.create.bind(null,!0),objectContaining:ye.create.bind(null,!1),stringContaining:ve.create.bind(null,!0)}},pi=class extends Q{static{a(this,"xJetPromiseError")}constructor(e){let t=[`${ee(e)}
64
+ `,`Matcher error: ${e.message}`,`${e.promiseKind} to value: ${h($(e.received,"").join(" "))}`];super(t.join(`
65
+ `),"xJetPromiseError")}},je=class{static{a(this,"MatcherService")}constructor(e){this.received=e}macherName="";promise;notModifier=!1;assertionChain=[];rejectsModifier=!1;resolvesModifier=!1;get not(){return this.notModifier=!0,this}get rejects(){if(this.resolvesModifier)throw new Error('Cannot use "rejects" modifier after "resolved" modifier.');return this.rejectsModifier=!0,this}get resolves(){if(this.rejectsModifier)throw new Error('Cannot use "resolved" modifier after "rejects" modifier.');return this.resolvesModifier=!0,this}invoke(e,t,i){return this.macherName=e,this.rejectsModifier||this.resolvesModifier?(this.pushToChain(e),this.promise=this.resolvesModifier?"resolves":"rejects",this.invokeAsync(t,i)):(this.pushToChain(e),t.call(this,...i))}async invokeAsync(e,t){let i=!1,r=typeof this.received=="function"?this.received():this.received;if(!st(r))throw new C({message:`${h("received")} value must be a promise or a function returning a promise`,assertionChain:this.assertionChain,received:{type:w(r),value:r}});try{this.received=await r,i=!0}catch(n){this.resolvesModifier&&this.throwPromiseError("Rejected",n),this.received=n}return i&&this.rejectsModifier&&this.throwPromiseError("Resolved",this.received),e.call(this,...t)}pushToChain(e){this.promise&&this.assertionChain.push(this.promise),this.notModifier&&this.assertionChain.push("not"),this.assertionChain.push(e)}throwPromiseError(e,t){let i=e==="Resolved"?"resolved":"rejected",r=e==="Resolved"?"rejected":"resolved";throw new pi({message:`${h("received")} promise ${i} instead of ${r}`,received:t,promiseKind:e,assertionChain:this.assertionChain})}};for(let e of Object.keys(pe)){let t=je.prototype,i=pe[e];Object.defineProperty(t,e,{value:a(function(...r){return this.invoke(e,i,r)},"value")}),Object.defineProperty(t[e],"name",{value:e})}var fi=a((e,...t)=>{if(t.length>0)throw new Error(`Expect takes at most one argument. Received ${t.length+1} arguments instead.`);return new je(e)},"coreExpect"),Vi=Object.assign(fi,ui);function Me(e,t,i){let r=`${t}${i}`,n=e[r];if(!i)throw new Error(`Invalid type(${i}) parameter`);if(!(r in e))throw new Error(`Method "${r.toString()}" does not exist on Buffer`);return n.bind(e)}a(Me,"b");function Ne(e,t){return Me(e,"read",t)}a(Ne,"h");function Ue(e,t){return Me(e,"write",t)}a(Ue,"d");function te(e,t,i=0){if(t<0)throw new Error("Split position cannot be negative");if(t>e.length)throw new Error("Split position cannot exceed buffer length");let r=e.subarray(0,t),n=t+i;return n>=e.length?[r,Buffer.alloc(0)]:[r,e.subarray(n)]}a(te,"f");function De(e=0){let{position:t,type:i}=this.descriptor,r=this.offset+t+e;return i.toObject(this.buffer.subarray(r),n=>{this.offset+=n})}a(De,"l");function di(){let e=[],{arraySize:t=0,size:i}=this.descriptor;e.length=t;for(let r=0;r<t;r++)e[r]=De.call(this,r*i);return e}a(di,"U");function gi(){return"arraySize"in this.descriptor&&this.descriptor.arraySize?di.call(this):De.call(this)}a(gi,"S");function _e(e,t=0){e??={};let{position:i,type:r,size:n}=this.descriptor,s=r.toBuffer(e),o=this.offset+i+t,[c,l]=te(this.buffer,o,n);this.buffer=Buffer.concat([c,s,l]),s.length>n&&(this.offset+=s.length-n)}a(_e,"T");function mi(e){let{arraySize:t=0,size:i}=this.descriptor;for(let r=0;r<t;r++){let n=r<e.length?e[r]:{};_e.call(this,n,r*i)}}a(mi,"W");function yi(e){return"arraySize"in this.descriptor&&this.descriptor.arraySize?mi.call(this,Array.isArray(e)?e:[e]):_e.call(this,Array.isArray(e)?e[0]||{}:e)}a(yi,"I");var A={Int8:8,UInt8:8,Int16LE:16,Int16BE:16,UInt16LE:16,UInt16BE:16,FloatLE:32,FloatBE:32,Int32LE:32,Int32BE:32,UInt32LE:32,UInt32BE:32,DoubleLE:64,DoubleBE:64,BigInt64LE:64,BigInt64BE:64,BigUInt64LE:64,BigUInt64BE:64};function vi(e,t=0){let i=/^([A-Za-z][A-Za-z0-9]*)(?:\[(\d+)\])?$/i,r=e.match(i);if(!r)throw new Error(`Invalid primitive descriptor: ${e}`);let n=A[r[1]];if(!n)throw new Error(`Invalid primitive type: ${r[1]}`);let s=r[1],o=r[2]?parseInt(r[2]):void 0;return{type:s,position:t,size:n/8,arraySize:o,kind:"primitive"}}a(vi,"x");function He(e=0){let{position:t,type:i}=this.descriptor,r=this.offset+t+e;return Ne(this.buffer,i)(r)}a(He,"z");function bi(){let e=[],{arraySize:t=0,size:i}=this.descriptor;e.length=t;for(let r=0;r<t;r++)e[r]=He.call(this,r*i);return e}a(bi,"N");function Ei(){return"arraySize"in this.descriptor&&this.descriptor.arraySize?bi.call(this):He.call(this)}a(Ei,"w");function qe(e,t=0){e??=0;let{position:i,type:r}=this.descriptor,n=r.includes("Big");if(n&&e===0&&(e=BigInt(0)),n&&typeof e!="bigint")throw new TypeError(`Expected a BigInt for field "${r}", but received ${e}`);if(!n&&typeof e!="number")throw new TypeError(`Expected a number for field "${r}", but received ${e}`);let s=this.offset+i+t;Ue(this.buffer,r)(e,s)}a(qe,"B");function $i(e){let{arraySize:t=0,size:i}=this.descriptor;for(let r=0;r<t;r++){let n=r<e.length?e[r]:0;qe.call(this,n,r*i)}}a($i,"_");function Si(e){if("arraySize"in this.descriptor&&this.descriptor.arraySize)return $i.call(this,Array.isArray(e)?e:[e]);qe.call(this,Array.isArray(e)?e[0]||0:e)}a(Si,"P");var Oe=new Map;function re(e){return e.startsWith("Int")}a(re,"y");function Je(e){let t=Oe.get(e);return t===void 0&&(t=(1<<e)-1,Oe.set(e,t)),t}a(Je,"D");function xi(e,t){return re(e.type)?Number(BigInt.asIntN(e.bitSize,BigInt(t))):t}a(xi,"j");function Ii(e,t){let i=re(e.type),{bitSize:r,type:n}=e,s=i?(1<<r-1)-1:(1<<r)-1,o=i?-(1<<r-1):0;if(t<o||t>s)throw new RangeError(`Value ${t} does not fit within ${r} bits for type ${n}`)}a(Ii,"G");function We(e,t){if(e.bitSize<1||e.bitPosition<0)throw new Error(`bitSize(${e.bitSize}) and bitPosition(${e.bitPosition}) must be greater than bitSize(1) and bitPosition(0) for ${t}`);if(A[e.type]>32)throw new Error(`${e.type} is not supported yet`);if(e.bitPosition+e.bitSize>A[e.type])throw new Error(`bitPosition(${e.bitPosition}) + bitSize(${e.bitSize}) exceeds ${e.type} size for ${t}`)}a(We,"v");function wi(e,t){We(t,"read operation");let{type:i,bitPosition:r,bitSize:n}=t,s=Je(n),o=e>>r&s;return re(i)&&o&1<<n-1?o|~s:o}a(wi,"Z");function Ti(e,t,i){We(t,"write operation"),Ii(t,i);let{bitPosition:r,bitSize:n}=t,s=xi(t,i),o=Je(n)<<r;return e&~o|s<<r&o}a(Ti,"q");function Ri(e,t=0,i=0){let[r,n]=e.split(":",2),s=parseInt(n,10),o=A[r],c=r.endsWith("BE");if(!o)throw new Error(`${r} is not supported`);if(i<0||i>=o)throw new Error(`Bitfield position ${i} is out of bounds (must be between 0 and ${o-1})`);if(!s)throw new Error(`${e} is not valid`);if(s+i>=o)throw new Error(`${r} size (${o}) is not enough to hold ${s} bits starting at position ${i}`);return{kind:"bitfield",type:r,size:o/8,position:t,bitSize:s,bitPosition:i,isBigEndian:c}}a(Ri,"$");function ki(){let e=this.descriptor.position+this.offset,t=this.descriptor.isBigEndian?"BE":"LE",i=this.buffer[`readUInt${t}`](e,this.descriptor.size);return wi(i,this.descriptor)}a(ki,"C");function Bi(e){let t=this.descriptor.position+this.offset,i=this.descriptor.isBigEndian?"BE":"LE",r=this.buffer[`readUInt${i}`](t,this.descriptor.size),n=Ti(r,this.descriptor,e);this.buffer[`writeUInt${i}`](n,t,this.descriptor.size)}a(Bi,"F");var Fe=new Set(["utf8","ascii","string"]);function Li(e,t=0){let i=/^(utf8|ascii|string)(?:\[(\d+)\])?$/i,r=e.match(i);if(!r)throw new Error(`Invalid string descriptor: ${e}`);let n=r[1].toLowerCase(),s=r[2]?parseInt(r[2]):void 0;return{type:n,arraySize:s,position:t,size:2,lengthType:"UInt16LE",kind:"string"}}a(Li,"A");function Ve(e=0){let{position:t,type:i,size:r}=this.descriptor,n=this.offset+t+e,s=i==="string"?"utf8":i;if("lengthType"in this.descriptor&&this.descriptor.lengthType){if(this.descriptor.lengthType.includes("Big"))throw new Error("BigInt are not supported");let o=this.descriptor.lengthType,c=Number(Ne(this.buffer,o)(n)),l=n+r;if(this.offset+=c,l+c>this.buffer.length)throw new Error(`String prefix length exceeds buffer position: ${l} size: ${c} > ${this.buffer.length}`);return this.buffer.subarray(l,l+c).toString(s)}if("nullTerminated"in this.descriptor){let o=n,c="maxLength"in this.descriptor?this.descriptor.maxLength:0;for(;o<this.buffer.length&&this.buffer[o]!==0;){if(c&&o>c)throw new Error(`NullTerminated String exceeds maximum length of ${c}`);o++}let l=o-n;return this.offset+=l+1,this.buffer.subarray(n,o).toString(s)}return this.buffer.subarray(n,n+r).toString(s)}a(Ve,"M");function Ci(){let e=[],{arraySize:t=0,size:i}=this.descriptor;e.length=t;for(let r=0;r<t;r++)e[r]=Ve.call(this,r*i);return e}a(Ci,"Y");function Ai(){return"arraySize"in this.descriptor&&this.descriptor.arraySize?Ci.call(this):Ve.call(this)}a(Ai,"L");function Ge(e,t=0){e??="";let{position:i,type:r,size:n}=this.descriptor,s=this.offset+i+t,o=r==="string"?"utf8":r;if("lengthType"in this.descriptor&&this.descriptor.lengthType){if(this.descriptor.lengthType.includes("Big"))throw new Error("BigInt are not supported");let c=Buffer.from(e,o);Ue(this.buffer,this.descriptor.lengthType)(c.length,s);let[l,u]=te(this.buffer,s+n);this.buffer=Buffer.concat([l,c,u]),this.offset+=c.length;return}if("nullTerminated"in this.descriptor){"maxLength"in this.descriptor&&this.descriptor.maxLength&&(e=e.length>this.descriptor.maxLength?e.slice(0,this.descriptor.maxLength):e);let c=e.endsWith("\0")?e:`${e}\0`,l=Buffer.from(c,o),[u,d]=te(this.buffer,s,n);this.buffer=Buffer.concat([u,l,d]),this.offset+=l.length;return}this.buffer.write(e,s,n,o)}a(Ge,"k");function zi(e){let{arraySize:t=0,size:i}=this.descriptor;for(let r=0;r<t;r++){let n=r<e.length?e[r]:"";Ge.call(this,n,r*i)}}a(zi,"O");function Pi(e){return"arraySize"in this.descriptor&&this.descriptor.arraySize?zi.call(this,Array.isArray(e)?e:[e]):Ge.call(this,Array.isArray(e)?e[0]||"":e)}a(Pi,"V");var z=class ie{static{a(this,"e")}size;schema=new Map;constructor(t){this.size=this.compileSchema(t)}toObject(t,i){if(!Buffer.isBuffer(t))throw new Error(`Expected a buffer, but received ${typeof t}`);if(t.length<this.size)throw new Error(`Buffer size is less than expected: ${t.length} < ${this.size}`);let r={},n={buffer:t,offset:0};for(let[s,o]of this.schema)n.descriptor=o,r[s]=this.readValue(n,o.kind);return i&&typeof i=="function"&&i(n.offset),r}toBuffer(t){if(!t||typeof t!="object")throw new Error(`Expected an object of fields, but received ${typeof t}`);let i={buffer:Buffer.alloc(this.size),offset:0};for(let[r,n]of this.schema){i.descriptor=n;let s=t[r];this.writeValue(i,n.kind,s)}return i.buffer}readValue(t,i){switch(i){case"struct":return gi.call(t);case"bitfield":return ki.call(t);case"string":return Ai.call(t);default:return Ei.call(t)}}writeValue(t,i,r){switch(i){case"struct":yi.call(t,r);break;case"bitfield":Bi.call(t,r);break;case"string":Pi.call(t,r);break;default:Si.call(t,r)}}computeFieldSize(t,i){if(t.type instanceof ie)return{...t,position:i,size:t.type.size,kind:"struct"};if(Fe.has(t.type))return this.computeStringFieldSize(t,i);let r=A[t.type];if(r!==void 0)return{...t,position:i,size:r/8,kind:"primitive"};throw new Error(`Invalid field type: ${t.type}`)}computeStringFieldSize(t,i){let r={...t,position:i,kind:"string"};if("lengthType"in t&&t.lengthType){let n=A[t.lengthType];if(!n)throw new Error(`Invalid length type: ${t.lengthType}`);r.size=n/8}else"nullTerminated"in t&&t.nullTerminated?r.size=0:(!("size"in t)||!t.size)&&(r.lengthType="UInt16LE",r.size=A.UInt16LE/8);return r}parseStringNotation(t,i){return t.includes(":")?Ri(t,i):[...Fe].find(r=>t.startsWith(r))?Li(t,i):vi(t,i)}convertToSizedField(t,i){return t instanceof ie?{type:t,position:i,size:t.size,kind:"struct"}:typeof t=="string"?this.parseStringNotation(t,i):this.computeFieldSize(t,i)}compileSchema(t){let i={bits:0,bytes:0,bitFieldSize:0,bitFieldType:"UInt8"};for(let[r,n]of Object.entries(t)){let s=this.convertToSizedField(n,i.bytes);if("arraySize"in s&&s.arraySize&&s.arraySize>=Number.MAX_SAFE_INTEGER)throw new Error(`Array size exceeds maximum safe integer: ${s.arraySize}`);"bitSize"in s&&s.bitSize>0?this.processBitfield(i,r,s):this.processStandardField(i,r,s)}return i.bits>0&&(i.bytes+=i.bitFieldSize),i.bytes}processBitfield(t,i,r){let n=r.size*8,s=r.bitSize;(t.bits+s>n||t.bitFieldType!==r.type||t.bitFieldSize!==r.size)&&(t.bytes+=t.bitFieldSize,t.bits=0,r.position=t.bytes),r.bitPosition=t.bits,this.schema.set(i,r),t.bits+=s,t.bitFieldType=r.type,t.bitFieldSize=r.size}processStandardField(t,i,r){t.bits>0&&(t.bytes+=t.bitFieldSize,t.bits=0,r.position=t.bytes),this.schema.set(i,r);let n="arraySize"in r&&r.arraySize||0,s=n>0?r.size*n:r.size;t.bytes+=s}};var ji=new z({line:"UInt32LE",column:"UInt32LE",source:"string"}),Ke=new z({kind:"UInt8:4",suiteId:{type:"string",size:14},runnerId:{type:"string",size:14},timestamp:"string"}),Oi=new z({level:"UInt8",message:{type:"string",lengthType:"UInt32LE"},ancestry:{type:"string",lengthType:"UInt32LE"},invocation:ji}),ne=new z({error:{type:"string",lengthType:"UInt32LE"}}),Fi=new z({type:"UInt8:5",todo:"UInt8:1",skipped:"UInt8:1",duration:"UInt32LE",ancestry:{type:"string",lengthType:"UInt32LE"},description:{type:"string",lengthType:"UInt32LE"}}),Mi=new z({type:"UInt8:5",passed:"UInt8:1",duration:"UInt32LE",ancestry:{type:"string",lengthType:"UInt32LE"},description:{type:"string",lengthType:"UInt32LE"},errors:{type:"string",lengthType:"UInt32LE"}});function Ni(e,t,i){let r=Ke.toBuffer({kind:2,suiteId:t??"",runnerId:i??"",timestamp:new Date().toISOString()}),n=ne.toBuffer({error:JSON.stringify(q(e))});return Buffer.concat([r,n])}a(Ni,"encodeErrorSchema");export{K as MockState,Ni as encodeErrorSchema};
66
66
  //# sourceMappingURL=index.js.map