@remotex-labs/xjet 1.2.1 → 1.2.3

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 ti=Object.defineProperty;var a=(e,t)=>ti(e,"name",{value:t,configurable:!0});var ii="xJet.mock()",ee=class e extends Function{static{a(this,"MockState")}static mocks=[];name;xJetMock=!0;state;restore;queuedImplementations=[];implementation;originalImplementation;constructor(t,i,r){return super(),this.name=r??ii,this.state=this.initState(),this.implementation=t,this.restore=i,this.originalImplementation=t||(()=>{}),new Proxy(this,{apply:this.invokeFunction,construct:this.invokeClass})}getMockName(){return this.name}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?.();typeof t=="function"?this.implementation=t:this.implementation=this.originalImplementation;let i=e.mocks.indexOf(this);return i!==-1&&e.mocks.splice(i,1),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}mockResolvedValue(t){return this.mockImplementation(()=>Promise.resolve(t)),this}mockResolvedValueOnce(t){return this.mockImplementationOnce(()=>Promise.resolve(t)),this}mockReturnValueOnce(t){return this.mockImplementationOnce(()=>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(h){o={value:h,type:"throw"}}else o={type:"return",value:void 0};return this.state.lastCall=i,this.state.results[c]=o,o.value}invokeFunction(t,i,r){return t.state.instances.push(i),t.invoke.call(t,i,r)}invokeClass(t,i,r){let n=t.invoke.call(t,r,i),s=typeof n=="object"&&n!==null&&n.constructor;return t.state.instances.push(s?n:r),typeof n=="object"?n:r}};var ri={dim:[2,22],bold:[1,22],reset:[0,0],hidden:[8,28],inverse:[7,27]},ni={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]},si={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]},ye={...ri,...ni,...si},J="\x1B[",V="m";function ve(e,t){if(globalThis.NO_COLOR)return t;let i=e.length;if(i===0)return t;if(i===1)return`${J}${e[0][0]}${V}${t}${J}${e[0][1]}${V}`;let r=new Array(i),n=new Array(i);for(let s=0;s<i;s++)n[s]=`${J}${e[s][0]}${V}`,r[i-s-1]=`${J}${e[s][1]}${V}`;return n.concat(t,r).join("")}a(ve,"I");function G(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(G,"d");function be(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(be,"_");function P(e=[]){let t=a((...r)=>{if(Array.isArray(r[0])&&"raw"in r[0]){let[n,...s]=r,o=n.reduce((c,h,f)=>c+h+(f<s.length?String(s[f]??""):""),"");return ve(e,o)}return ve(e,r.join(" "))},"e"),i={rgb:a((r,n,s)=>P([...e,G("fg",r,n,s)]),"rgb"),bgRgb:a((r,n,s)=>P([...e,G("bg",r,n,s)]),"bgRgb"),hex:a(r=>P([...e,G("fg",...be(r))]),"hex"),bgHex:a(r=>P([...e,G("bg",...be(r))]),"bgHex")};return new Proxy(t,{get(r,n){if(typeof n!="string")throw new Error(`Invalid property: ${String(n)}`);return n in ye?P([...e,ye[n]]):n in i?i[n]:Reflect.get(r,n)}})}a(P,"g");var C=P();var oi=Object.defineProperty,l=a((e,t)=>oi(e,"name",{value:t,configurable:!0}),"o");function ke(e,t){return t!=null&&(t.constructor===e||typeof t=="function")}a(ke,"nt");l(ke,"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,"X");l(X,"hasKey");function S(e){return!!e&&X(e,"expectedLabel")&&ke(Function,e.matches)}a(S,"b");l(S,"isAsymmetric");function re(e,t){let i=S(e),r=S(t);if(!(i&&r)){if(i)return e.matches(t);if(r)return t.matches(e)}}a(re,"ce");l(re,"asymmetricMatch");function Te(e,t,i=!0){if(Array.isArray(e)&&Array.isArray(t))return i&&e.length!==t.length?!1:e.every((s,o)=>b(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)||!b(e[s],t[s],i))return!1;return!0}a(Te,"it");l(Te,"deepEquals");function b(e,t,i=!0){if(e===t||Object.is(e,t))return!0;if(e===null||t===null)return!1;let r=re(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"?Te(e,t,i):!1}a(b,"g");l(b,"equals");function Ce(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(Ce,"de");l(Ce,"serializesError");function Be(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}a(Be,"me");l(Be,"isPromise");var Le=" ";function Ae(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":S(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(Ae,"st");l(Ae,"serializePrimitive");function ze(e){return e===null?"null":e===void 0?"undefined":typeof e=="object"?Object.prototype.toString.call(e):JSON.stringify(e)}a(ze,"ot");l(ze,"serializeMapKey");function U(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(U,"Q");l(U,"appendLines");function je(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 h=ze(s),f=[];F(o,f,i,r),U(f,t,`${h} => `,c===n.length-1,i)}),t.push("}")}a(je,"ct");l(je,"serializeMap");function Oe(e,t,i,r){if(e.length===0){t.push("[]");return}t.push("["),e.forEach((n,s)=>{let o=[];F(n,o,i,r),U(o,t,"",s===e.length-1,i)}),t.push("]")}a(Oe,"at");l(Oe,"serializeArray");function Me(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=[];F(s,c,i,r),U(c,t,"",o===n.length-1,i)}),t.push("}")}a(Me,"ut");l(Me,"serializeSet");function Pe(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(Pe,"ht");l(Pe,"serializeBuffer");function Ne(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(Ne,"pt");l(Ne,"serializeTypedArray");function te(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],h)=>{let f=[];F(c,f,i,r),U(f,t,`${String(o)}: `,h===s.length-1,i)}),t.push("}")}a(te,"ye");l(te,"serializeObject");function F(e,t,i=Le,r){let n=Ae(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?je(e,t,i,r):Array.isArray(e)?Oe(e,t,i,r):e instanceof Set?Me(e,t,i,r):e instanceof Buffer?Pe(e,t,i):ArrayBuffer.isView(e)&&!(e instanceof DataView)?Ne(e,t,i):te(e,t,i,r);return}te(e,t,i,r)}a(F,"B");l(F,"serializeValue");function H(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(H,"ae");l(H,"serializeError");function E(e,t=Le){let i=[];return F(e,i,t,new WeakSet),i}a(E,"v");l(E,"serialize");var ai=(e=>(e[e.DELETE=-1]="DELETE",e[e.EQUAL=0]="EQUAL",e[e.INSERT=1]="INSERT",e))(ai||{});function Fe(){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(Fe,"lt");l(Fe,"countCommonForward");function Ue(){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(Ue,"ft");l(Ue,"countCommonBackward");function He(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],h=r-n,f,g=c[h-1+t],m=c[h+1+t];h===-o||h!==o&&g<m?f=h+1:f=h-1;let w=f+t,v=c[w],$=v-f;for(;r>v&&n>$;)--r,--n,s.push([1,this.aStart+r,this.bStart+n]);r===v?s.push([0,this.aStart+v,this.bStart+$]):s.push([0,this.aStart+v,this.bStart+$]),r=v,n=$}for(let o of s.reverse())this.foundSubsequence(...o)}a(He,"dt");l(He,"backtrackFlat");function De(){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 h=-o;h<=o;h+=2){let f=h+i,g;h===-o||h!==o&&n[h-1+i]<n[h+1+i]?g=n[h+1+i]:g=n[h-1+i]+1;let m=g-h;for(;g<e&&m<t&&this.isMatch(this.aStart+g,this.bStart+m);)g++,m++;if(n[f]=g,c[f]=g,g>=e&&m>=t)return r=o,He.call(this,s,i,r)}}}a(De,"mt");l(De,"findMiddleSnake");function qe(){let e=Fe.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=Ue.call(this);this.aEnd-=i,this.bEnd-=i,(this.aStart<this.aEnd||this.bStart<this.bEnd)&&De.call(this),i>0&&this.foundSubsequence(i,this.aEnd,this.bEnd)}a(qe,"yt");l(qe,"diffSequence");function ne(e,t,i,r){let n={aStart:0,bStart:0,aEnd:e,bEnd:t,isMatch:i,foundSubsequence:r};qe.call(n)}a(ne,"ve");l(ne,"createDiff");function se(e,t){let i=0,r=0,n="",s="",o=[];function c(h,f){let g=o[o.length-1];g&&g[0]===h?g[1]+=f:o.push([h,f])}return a(c,"a"),l(c,"pushDiff"),ne(e.length,t.length,(h,f)=>e[h]===t[f],(h,f,g)=>{i!==f&&(s+=e.slice(i,f)),r!==g&&(n+=t.slice(r,g)),h>0&&(s&&(c(-1,s),s=""),n&&(c(1,n),n=""),c(0,t.slice(g,g+h))),i=f+h,r=g+h}),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,"G");l(se,"diffStringsRaw");function oe(e,t){let i=0,r=0,n=[];for(ne(e.length,t.length,(s,o)=>{let c=e[s].trimEnd().endsWith(","),h=t[o].trimEnd().endsWith(",");return c&&!h?t[o]+=",":!c&&h&&(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(oe,"Z");l(oe,"diffLinesRaw");function ae(e){let t=[],i=[],r=[],n=l(()=>{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 h=s>0?e[s-1][0]:null,f=s+1<e.length?e[s+1][0]:null,g=l(m=>m===-1||m===1,"isEdit");if(g(h)&&g(f)){for(let m of c)t.push(m),i.push(m);continue}}n(),r.push([0,c])}else if(o===-1)for(let h of c)t.push(h);else if(o===1)for(let h of c)i.push(h);else n(),r.push([o,c])}return n(),r}a(ae,"_");l(ae,"cleanupSemantic");var k=C.dim,ci=C.lightOrange,u=C.lightCoral,d=C.oliveGreen,We=C.cyan,B=C.inverse,Vi=C.whiteBright;function R(e){return e===null?"null":e===!0?"true":e===!1?"false":e&&typeof e=="object"?e.constructor?.name??"Object":typeof e}a(R,"k");l(R,"getType");function _e(e,t,i=!0){let r="",n="",s=se(e||" ",t||" ");i&&(s=ae(s));for(let[o,c]of s)o===0?(r+=c,n+=c):o===-1?r+=B(c):o===1&&(n+=B(c));return[r,n]}a(_e,"gt");l(_e,"normalizeStrings");function Je(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]]=D(e[s],t[s]);return[i,r]}a(Je,"vt");l(Je,"normalizeArrays");function Ve(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]]=D(e[s],t[s]));return[i,r]}a(Ve,"Et");l(Ve,"normalizeObjects");function D(e,t,i=!0){if(e===t)return[e,t];let r=typeof e,n=typeof t;return re(e,t)===!0?(S(e)&&(e=t),S(t)&&(t=e),[e,t]):r==="string"&&n==="string"?_e(e,t,i):!e||!t||r!=="object"||n!=="object"?[e,t]:Array.isArray(e)&&Array.isArray(t)?Je(e,t):Ve(e,t)}a(D,"ee");l(D,"normalizeAsymmetric");function Ge(e,t,i,r=!0){let n=e.split(`
4
- `),s=t.split(`
5
- `);i.push(We(`
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(`
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 h=n[c],f=s[c];if(h===f){h&&i.push(k(` ${h}`));continue}let g=[],m=[];if(h!==void 0&&f!==void 0){let w=se(h||" ",f||" ");r&&(w=ae(w));for(let[v,$]of w)v===0?(g.push($),m.push($)):v===-1?g.push(B($)):v===1&&m.push(B($))}h===void 0&&m.push(f),!f===void 0&&g.push(h),g.length>0&&i.push(d(`- ${g.join("")}`)),m.length>0&&i.push(u(`+ ${m.join("")}`))}return i.join(`
8
- `)}a(Ge,"bt");l(Ge,"diffStrings");function Y(e,t){let i=[];[e,t]=D(e,t,!0);let r=E(e,""),n=E(t,""),s=oe(r,n);for(let[o,c]of s){let h=c,f="";h.endsWith(",")&&(h=h.slice(0,-1),f=","),o===0?i.push(k(h)+f):o===1&&i.push(u(h)+f)}return i}a(Y,"te");l(Y,"diffArgs");function Z(e,t,i=!0){let r=R(e),n=R(t),s=[];if(r!==n&&(s.push("Expected type: "+d(r)),s.push("Received type: "+u(n))),r==="string"&&n==="string")return Ge(e,t,s,i);let[o,c]=D(e,t,i),h=E(o),f=E(c);s.push(We(`
9
- @@ -1,${h.length} +1,${f.length} @@
10
- `));let g=oe(h,f);for(let[m,w]of g)m===0?s.push(k(` ${w}`)):m===-1?s.push(d(`- ${w}`)):m===1&&s.push(u(`+ ${w}`));return s.join(`
11
- `)}a(Z,"D");l(Z,"diffComponent");var ce=class extends Error{static{a(this,"C")}static{l(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 Ce(this)}};function Q(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=[k("expect("),u(n),k(")"),".",i.join(".")];return r.length>0?(s.push("("),s.push(r.map(o=>d(o)).join(", ")),s.push(")")):s.push("()"),t&&s.push(k(" // "+t)),s.join("")}a(Q,"O");l(Q,"composeStatement");var j=class extends ce{static{a(this,"w")}static{l(this,"xJetTypeError")}constructor(e){let t=[`${Q(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: ${d(E(e.expected.value).join(`
14
- `))}`)),e.received&&(e.received.type&&t.push(`Received has type: ${e.received.type}`),t.push(`Received has value: ${u(E(e.received.value).join(`
15
- `))}`)),super(t.join(`
16
- `),"xJetTypeError")}},li=class extends ce{static{a(this,"re")}static{l(this,"xJetExpectError")}matcherResult;constructor(e){let t=[`${Q(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 x(e,t,i,r=[]){let n=R(e);if(!t.includes(n)&&!t.includes(typeof e))throw new j({expectedLabels:r,assertionChain:this.assertionChain,message:`${(i==="Received"?u:d)(i)} value must be a ${t.join(" or ")}`,[i==="Expected"?"expected":"received"]:{value:e,type:n}})}a(x,"E");l(x,"ensureType");function le(e,t,i=[]){if(e==null)throw new j({expectedLabels:i,assertionChain:this.assertionChain,message:`${(t==="Received"?u:d)(t)} value must not be null nor undefined`,[t==="Expected"?"expected":"received"]:{value:e}})}a(le,"he");l(le,"ensureNotNullish");function p(e){return E(e,"").join(" ")}a(p,"l");l(p,"serializeOneLine");function y(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 li({info:i,assertion:r,...e,assertionChain:this.assertionChain})}a(y,"y");l(y,"handleFailure");function T(e){y.call(this,{...e,handleNot(t){t.push(`Expected: not ${d(p(this.received))}`)},handleInfo(t){e.note&&t.push(k(e.note),""),t.push(Z(e.expected,this.received,!0))}})}a(T,"M");l(T,"handleDiffFailure");function Ke(e,t){let i=" ".repeat(t.length);y.call(this,{...e,handleNot(r){r.push(`Expected: not ${t} ${d(p(e.expected))}`),r.push(`Received: ${i} ${u(p(this.received))}`)},handleInfo(r){r.push(`Expected: ${t} ${d(p(e.expected))}`),r.push(`Received: ${i} ${u(p(this.received))}`)}})}a(Ke,"be");l(Ke,"handleComparisonFailure");function ie(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:H(e)}}a(ie,"xe");l(ie,"getThrown");function q(e,t,i,r=!1){return[l(n=>{n.push(`Expected ${e}: not ${d(t)}`),i?.hasMessage?n.push(`Received message: ${u(p(r?i.message:B(i.message)))}
19
- `):n.push(`Received value: ${u(p(i?.value))}`)},"handleNot"),l(n=>{n.push(`Expected ${e}: ${d(t)}`),i?.hasMessage?(r&&n.push(`Received name: ${u(p(i.value?.name))}`),n.push(`Received message: ${u(p(i.message))}
20
- `)):n.push(`Received value: ${u(p(i?.value))}`)},"handleInfo")]}a(q,"ne");l(q,"buildInfo");function Ye(e,t){let i=t!=null&&t.value instanceof e,[r,n]=q("constructor",e.name,t);return[i,r,n]}a(Ye,"xt");l(Ye,"toThrowExpectedClass");function Xe(e,t){let i=t!=null&&t.message.includes(e),[r,n]=q("substring",`"${e}"`,t);return[i,r,n]}a(Xe,"St");l(Xe,"toThrowExpectedString");function Ze(e,t){let i=t!=null&&e.test(t.message),[r,n]=q("pattern",p(e),t);return[i,r,n]}a(Ze,"Tt");l(Ze,"toThrowExpectedRegExp");function Qe(e,t){let i=t!=null&&e.matches(t.value),[r,n]=q("asymmetric",p(e),t,!0);return[i,r,n]}a(Qe,"wt");l(Qe,"toThrowExpectedAsymmetric");function et(e,t){return[t!=null&&b(H(e),t.serializedError),l(i=>{i.push(`Expected: not ${d(p(t.serializedError))}`)},"handleNot"),l(i=>{i.push(Z(e,t.serializedError,!0))},"handleInfo")]}a(et,"$t");l(et,"toThrowExpectedObject");function tt(e){let t=null,i=e?["expected"]:[];if(this.rejectsModifier)t=ie(this.received);else if(typeof this.received=="function")try{this.received()}catch(o){t=ie(o)}else x.call(this,this.received,["function"],"Received",i);let r=!1,n,s;e?typeof e=="function"?[r,n,s]=Ye.call(this,e,t):typeof e=="string"?[r,n,s]=Xe.call(this,e,t):e instanceof RegExp?[r,n,s]=Ze.call(this,e,t):S(e)?[r,n,s]=Qe.call(this,e,t):t!==null&&typeof e=="object"?[r,n,s]=et.call(this,e,t):x.call(this,e,["string","function","RegExp","object"],"Expected",i):(r=t!=null,n=l(o=>{t?.hasMessage?(o.push(`Error name: ${u(t.value?.name)}`),o.push(`Error message: ${u(p(t.message))}
21
- `)):o.push(`Error value: ${u(p(t?.value))}`)},"handleNot")),y.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(`${u("Received")} function did not throw`)}})}a(tt,"Se");l(tt,"toThrow");function it(e){let t=["length"];if(x.call(this,e,["number","bigint"],"Expected",t),!Object.hasOwn(this.received,"length")||!Number.isSafeInteger(this.received.length))throw new j({expectedLabels:t,message:`${u("received")} value must have a length property whose value must be a number`,received:{value:this.received,type:R(this.received)},assertionChain:this.assertionChain});let i=this.received,r=i.length==e;y.call(this,{pass:r,expectedLabels:t,handleNot(n){n.push(`Expected length: not ${d(p(e))}`),n.push(`Received string: ${u(p(i))}`)},handleInfo(n){n.push(`Expected length: ${d(p(e))}`),n.push(`Received length: ${u(p(i.length))}`),n.push(`Received string: ${u(p(i))}`)}})}a(it,"Te");l(it,"toHaveLength");function rt(e){let t=["expected"];x.call(this,this.received,["string"],"Received",t),x.call(this,e,["string","RegExp"],"Expected",t);let i=this.received,r=typeof e=="string"?i.includes(e):new RegExp(e).test(i);y.call(this,{pass:r,expectedLabels:t,handleNot(n){n.push(`Expected: not ${d(p(i))}`)},handleInfo(n){e instanceof RegExp?(n.push(`Expected pattern: ${d(p(e))}`),n.push(`Received string: ${u(p(i))}`)):n.push(Z(e,i,!0))}})}a(rt,"we");l(rt,"toMatch");function W(e,t,i=[]){if(x.call(this,e,["number","bigint"],t,i),e<0)throw new j({expectedLabels:i,assertionChain:this.assertionChain,message:`${(t==="Received"?u:d)(t)} value must be positive number`,[t==="Received"?"received":"expected"]:{value:e,type:R(e)}})}a(W,"z");l(W,"ensurePositiveNumber");function _(e,t){let i=this.received,r=["Expected"];x.call(this,e,["number","bigint"],"Expected",r),x.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}Ke.call(this,{pass:n,expectedLabels:r,expected:e},t)}a(_,"F");l(_,"handleNumericComparison");function nt(e,t=2){let i=["expected","precision"];x.call(this,e,["number"],"Expected",i),x.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?" ":" ",h=this.notModifier?"not < ":"< ",f=n<s,g=[`Expected precision: ${c}${d(t.toString())}`,`Expected difference: ${h}${d(o)}`,`Received difference: ${c}${u(n.toString())}`];y.call(this,{pass:f,expectedLabels:i,handleNot(m){m.push(`Expected: not ${d(p(e))}`),m.push(`Received: ${u(p(r))}
22
- `),m.push(...g)},handleInfo(m){m.push(`Expected: ${d(p(e))}`),m.push(`Received: ${u(p(r))}
23
- `),m.push(...g)}})}a(nt,"$e");l(nt,"toBeCloseTo");function st(e){_.call(this,e,">")}a(st,"ke");l(st,"toBeGreaterThan");function ot(e){_.call(this,e,">=")}a(ot,"Ae");l(ot,"toBeGreaterThanOrEqual");function at(e){_.call(this,e,"<")}a(at,"Re");l(at,"toBeLessThan");function ct(e){_.call(this,e,"<=")}a(ct,"Me");l(ct,"toBeLessThanOrEqual");function I(e=[]){if(!this.received?.xJetMock||!this.received?.mock)throw new j({expectedLabels:e,assertionChain:this.assertionChain,message:`${u("Received")} value must be a mock or spy function`,received:{value:this.received}})}a(I,"I");l(I,"ensureMock");function A(e){return E(e,"").slice(1,-1).map(t=>d(t.replace(",",""))).join(", ")}a(A,"L");l(A,"serializeCallArgs");function he(e,t,i,r="->",n=!1,s=3){if(!t?.length)return"";let o=0,c=-1,h=t.length;i&&i>=1&&i<=h&&(c=i-1,o=Math.max(0,Math.min(c-1,h-(s-1))));let f=Math.min(o+s,h),g=String(f).length,m=" ".repeat(r.length+1),w=new Array(f-o);for(let v=o;v<f;v++){let $=t[v],ge=String(v+1).padStart(g," "),me=v===c?`${r} `:m;if(n&&Array.isArray($)&&$.length<1){w[v-o]=`${me}${ge}: called with 0 arguments`;continue}let ei=n?Y(e,$).slice(1,-1):Y(e,$);w[v-o]=`${me}${ge}: ${ei.join(" ")}`}return w.join(`
24
- `)}a(he,"Ie");l(he,"serializeList");function lt(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 h=i[c]-1;if(h<0||h>=n)continue;let f=Y(e,t[h]).slice(1,-1);if(o.push(`${String(h+1).padStart(s," ")}: ${f.join(" ")}`),o.length>=r)break}return o.join(`
25
- `)}a(lt,"Ce");l(lt,"serializeHighlightedCalls");function z(e,t,i,r){return he(e,t,i,r,!0)}a(z,"N");l(z,"serializeCallList");function N(e,t,i,r){return he(e,t,i,r,!1)}a(N,"P");l(N,"serializeReturnList");function ht(){I.call(this);let e=this.received.mock.calls,t=this.received.mock.calls.length;y.call(this,{pass:t>0,receivedLabeled:this.received.name,handleNot(i){i.push(`Expected calls: ${d("0")}`),i.push(`Received calls: ${u(t.toString())}
26
- `),i.push(z([],e))},handleInfo(i){i.push(`Expected calls: >= ${d("1")}`),i.push(`Received calls: ${u(t.toString())}
27
- `)}})}a(ht,"je");l(ht,"toHaveBeenCalled");function ut(e){let t=["expected"];I.call(this,t),W.call(this,e,"expected",t);let i=this.received.mock.calls.length;y.call(this,{expected:e,pass:i==e,expectedLabels:t,receivedLabeled:this.received.name,handleNot(r){r.push(`Expected calls: != ${d(e.toString())}`)},handleInfo(r){r.push(`Expected calls: ${d(e.toString())}`),r.push(`Received calls: ${u(i.toString())}
28
- `)}})}a(ut,"Le");l(ut,"toHaveBeenCalledTimes");function pt(...e){let t=["...args"];I.call(this,t);let i=this.received.mock.calls,r=this.received.mock.calls.length,n=[];i.forEach((o,c)=>{o.length===e.length&&b(e,o)&&n.push(c+1)});let s=n.length>0;y.call(this,{pass:s,expectedLabels:t,expected:e,receivedLabeled:this.received.name,handleNot(o){o.push(`Expected: not ${A(e)}`),o.push(`Received:
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(`
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:
29
29
 
30
- ${lt(e,i,n)}
31
- `),o.push(`Calls: ${u(r.toString())}`)},handleInfo(o){o.push(`Expected: ${A(e)}`),o.push(`Received:
30
+ ${Nt(t,i,n)}
31
+ `),o.push(`Calls: ${h(r.toString())}`)},handleInfo(o){o.push(`Expected: ${P(t)}`),o.push(`Received:
32
32
 
33
- ${z(e,i)}
34
- `),o.push(`Calls: ${u(r.toString())}`)}})}a(pt,"Ne");l(pt,"toHaveBeenCalledWith");function ft(...e){let t=["...args"];I.call(this,t);let i=this.received.mock.calls,r=i.length,n=this.received.mock.calls.at(-1),s=n!==void 0&&b(e,n);y.call(this,{pass:s,expectedLabels:t,expected:e,receivedLabeled:this.received.name,handleNot(o){o.push(`Expected: not ${A(e)}`),o.push(`Received:
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:
35
35
 
36
- ${z(e,i,i.length)}
37
- `),o.push(`Calls: ${u(r.toString())}`)},handleInfo(o){o.push(`Expected: ${A(e)}`),o.push(`Received:
36
+ ${O(t,i,i.length)}
37
+ `),o.push(`Calls: ${h(r.toString())}`)},handleInfo(o){o.push(`Expected: ${P(t)}`),o.push(`Received:
38
38
 
39
- ${z(e,i,i.length)}
40
- `),o.push(`Calls: ${u(r.toString())}`)}})}a(ft,"De");l(ft,"toHaveBeenLastCalledWith");function dt(e,...t){let i=["nthCall","...args"];I.call(this,i),W.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&&b(t,s);y.call(this,{pass:o,expectedLabels:i,expected:t,receivedLabeled:this.received.name,handleNot(c){c.push(`nthCall: ${e}`),c.push(`Expected: not ${A(t)}`),c.push(`Received:
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:
41
41
 
42
- ${z(t,r,e)}
43
- `),c.push(`Calls: ${u(n.toString())}`)},handleInfo(c){c.push(`nthCall: ${e}`),c.push(`Expected: ${A(t)}`),c.push(`Received:
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:
44
44
 
45
- ${z(t,r,e)}
46
- `),c.push(`Calls: ${u(n.toString())}`)}})}a(dt,"Oe");l(dt,"toHaveBeenNthCalledWith");function gt(){I.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);y.call(this,{pass:i>0,receivedLabeled:this.received.name,handleNot(r){r.push(`Expected returns: ${d("0")}`),r.push(`Received returns: ${u(i.toString())}
47
- `),r.push(N(void 0,e)),r.push(`
48
- Calls: ${u(t.toString())}`)},handleInfo(r){r.push(`Expected returns: >= ${d("1")}`),r.push(`Received returns: ${u(i.toString())}`),r.push(`Calls: ${u(t.toString())}`)}})}a(gt,"Pe");l(gt,"toHaveReturned");function mt(e){let t=["expected"];I.call(this,t),W.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);y.call(this,{expectedLabels:t,pass:r==e,expected:e,receivedLabeled:this.received.name,handleNot(n){n.push(`Expected returns: != ${d(e.toString())}`),n.push(`Calls: ${u(i.toString())}`)},handleInfo(n){n.push(`Expected returns: ${d(e.toString())}`),n.push(`Received returns: ${u(r.toString())}`),n.push(`Calls: ${u(i.toString())}`)}})}a(mt,"Be");l(mt,"toHaveReturnedTimes");function yt(e){let t=["expected"];I.call(this,t);let i=[],r=this.received.mock.calls.length,n=this.received.mock.results.reduce((c,h)=>h.type==="return"?(i.push(h.value),c+1):c,0),s=i.at(-1),o=i.length>0&&b(e,s);y.call(this,{pass:o,expectedLabels:t,expected:e,receivedLabeled:this.received.name,handleNot(c){c.push(`Expected returns: not ${d(p(e))}`),c.push(`Received returns:
49
- `),c.push(N(e,i,n)),c.push(`
50
- Calls: ${u(r.toString())}`)},handleInfo(c){c.push(`Expected returns: ${d(p(e))}`),i.length>0&&(c.push(`Received returns:
51
- `),c.push(N(e,i,n))),c.push(`
52
- Returns: ${u(n.toString())}`),c.push(`Calls: ${u(r.toString())}`)}})}a(yt,"ze");l(yt,"toHaveLastReturnedWith");function vt(e,t){let i=["nthCall","expected"];I.call(this,i),W.call(this,e,"nthCall",i);let r=[],n=this.received.mock.calls.length,s=this.received.mock.results.reduce((h,f)=>f.type==="return"?(r.push(f.value),h+1):h,0),o=r.at(e-1),c=e<=r.length&&b(t,o);y.call(this,{pass:c,expectedLabels:i,expected:t,receivedLabeled:this.received.name,handleNot(h){h.push(`nthCall: ${e}`),h.push(`Expected returns: not ${d(p(t))}`),h.push(`Received returns:
53
- `),h.push(N(t,r,e)),h.push(`
54
- Returns: ${u(s.toString())}`),h.push(`Calls: ${u(n.toString())}`)},handleInfo(h){h.push(`nthCall: ${e}`),h.push(`Expected returns: ${d(p(t))}`),h.push(`Received returns:
55
- `),h.push(N(t,r,e)),h.push(`
56
- Returns: ${u(s.toString())}`),h.push(`Calls: ${u(n.toString())}`)}})}a(vt,"Fe");l(vt,"toHaveNthReturnedWith");function bt(e){let t=S(e)?e.matches(this.received):Object.is(this.received,e),i=!t&&b(this.received,e)?'If it should pass with deep equality, replace "toBe" with "toEqual"':void 0;T.call(this,{note:i,pass:t,expected:e,comment:"Object.is equality",expectedLabels:["expected"]})}a(bt,"He");l(bt,"toBe");function xt(e){let t=b(this.received,e);T.call(this,{pass:t,expected:e,comment:"deep equality",expectedLabels:["expected"]})}a(xt,"qe");l(xt,"toEqual");function Et(){let e=this.received===null;T.call(this,{pass:e,expected:null})}a(Et,"Ve");l(Et,"toBeNull");function $t(){let e=this.received===void 0;T.call(this,{pass:e,expected:void 0})}a($t,"We");l($t,"toBeUndefined");function St(){let e=Number.isNaN(this.received);T.call(this,{pass:e,expected:NaN})}a(St,"Je");l(St,"toBeNaN");function wt(){let e=!!this.received;T.call(this,{pass:e,expected:!0})}a(wt,"Ke");l(wt,"toBeTruthy");function Rt(){let e=!this.received;T.call(this,{pass:e,expected:!1})}a(Rt,"Ue");l(Rt,"toBeFalsy");function It(){let e=this.received!==void 0;y.call(this,{pass:e,expected:void 0,handleNot(t){t.push(`Expected: ${d(p(void 0))}`)},handleInfo(t){t.push(`Received: ${u(p(this.received))}`)}})}a(It,"Xe");l(It,"toBeDefined");function kt(e,t){let i=["path","value"];le.call(this,this.received,"Received",i),x.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=b(n,t)),y.call(this,{pass:r,expectedLabels:i,handleNot(c){c.push(`Expected: not ${d(p(o))}
57
- `),t?c.push(`Expected value: ${d(p(t))}`):c.push(`Received value: ${u(p(n))}`)},handleInfo(c){c.push(`Expected path: ${d(p(o))}`),Object.is(s.join(""),o.join(""))||c.push(`Received path: ${u(p(s))}`),c.push(""),t&&c.push(`Expected value: ${d(p(t))}`),c.push(`Received value: ${u(p(n))}`)}})}a(kt,"Qe");l(kt,"toHaveProperty");function Tt(e){let t=["expected"];x.call(this,e,["function"],"Received",t);let i=this.received,r=i instanceof e;y.call(this,{pass:r,expectedLabels:t,handleNot(n){n.push(`Expected constructor: not ${d(e.name)}
58
- `)},handleInfo(n){n.push(`Expected constructor: ${d(e.name)}`),i!==null&&typeof i=="object"&&Object.getPrototypeOf(i)!==null&&"constructor"in i?n.push(`Received constructor: ${u(i.constructor.name)}`):(n.push(`
59
- Received value has no prototype`),n.push(`Received value: ${u(p(i))}`))}})}a(Tt,"Ye");l(Tt,"toBeInstanceOf");function Ct(e){let t=["expected"];x.call(this,this.received,["string","Array"],"Received",t);let i=this.received,r=R(i);if(typeof i=="string"&&typeof e!="string")throw new j({expectedLabels:t,message:`${d("expected")} value must be a string if ${u("received")} value is a string`,expected:{value:e,type:R(e)},received:{value:i,type:r},assertionChain:this.assertionChain});let n=i.indexOf(e)!==-1;y.call(this,{pass:n,expectedLabels:t,comment:"indexOf",handleNot(s){r==="string"?(s.push(`Expected substring: not ${d(p(e))}`),s.push(`Received string: ${u(p(i)).replace(String(e),B(String(e)))}`)):(s.push(`Expected value: not ${d(p(e))}`),s.push(`Received array: ${u(p(i)).replace(p(e),B(p(e)))}`))},handleInfo(s){r==="string"?(s.push(`Expected substring: ${d(E(e,"").join(`
60
- `))}`),s.push(`Received string: ${u(E(r,"").join(`
61
- `))}`)):([...i].findIndex(o=>b(o,e))!==-1&&s.push(k(`Looks like you wanted to test for object/array equality with the stricter \`toContain\` matcher.
62
- You probably need to use \`${ci("toContainEqual")}\` instead.
63
- `)),s.push(`Expected value: ${d(p(e))}`),s.push(`Received array: ${u(p(r))}`))}})}a(Ct,"Ge");l(Ct,"toContain");function Bt(e){let t=["expected"];x.call(this,this.received,["string","Array"],"Received",t);let i=this.received,r=R(i),n=[...i].findIndex(s=>b(s,e))!==-1;y.call(this,{pass:n,expectedLabels:t,comment:"deep equality",handleNot(s){s.push(`Expected value: not ${d(p(e))}`),s.push(`Received array: ${u(p(i)).replace(p(e),B(p(e)))}`)},handleInfo(s){r==="string"&&typeof e=="string"&&i.indexOf(e)!==-1&&s.push(k("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: ${d(p(e))}`),s.push(`Received: ${u(p(i))}`)}})}a(Bt,"Ze");l(Bt,"toContainEqual");function Lt(e){let t=["expected"];le.call(this,this.received,"Received",t),x.call(this,this.received,["object"],"Received",t),x.call(this,e,["object"],"Expected",t);let i=this.received,r=b(e,i,!1);T.call(this,{pass:r,expected:e,expectedLabels:t})}a(Lt,"_e");l(Lt,"toMatchObject");var xe={toThrow:tt,toMatch:rt,toHaveLength:it,toContain:Ct,toMatchObject:Lt,toHaveProperty:kt,toBeInstanceOf:Tt,toContainEqual:Bt,toBe:bt,toEqual:xt,toBeNaN:St,toBeNull:Et,toBeFalsy:Rt,toBeTruthy:wt,toBeDefined:It,toBeUndefined:$t,toBeCloseTo:nt,toBeLessThan:at,toBeGreaterThan:st,toBeLessThanOrEqual:ct,toBeGreaterThanOrEqual:ot,toHaveReturned:gt,toHaveBeenCalled:ht,toHaveReturnedTimes:mt,toHaveBeenCalledWith:pt,toHaveBeenCalledTimes:ut,toHaveNthReturnedWith:vt,toHaveLastReturnedWith:yt,toHaveBeenNthCalledWith:dt,toHaveBeenLastCalledWith:ft},L=class{static{a(this,"T")}constructor(e,t=!1){this.name=e,this.isInverse=t}static{l(this,"AbstractPattern")}applyInverse(e){return this.isInverse?!e:e}},hi=class K extends L{static{a(this,"e")}constructor(t){super(`Any<${t.name}>`),this.expected=t}static{l(this,"AnyPattern")}static TYPE_CHECKS={String:l(t=>typeof t=="string"||t instanceof String,"String"),Number:l(t=>typeof t=="number"||t instanceof Number,"Number"),Function:l(t=>typeof t=="function"||t instanceof Function,"Function"),Boolean:l(t=>typeof t=="boolean"||t instanceof Boolean,"Boolean"),BigInt:l(t=>typeof t=="bigint"||t instanceof BigInt,"BigInt"),Symbol:l(t=>typeof t=="symbol"||t instanceof Symbol,"Symbol"),Object:l(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 K(t)}get expectedLabel(){return`Any<${this.expected.name}>`}matches(t){return this.expected.name in K.TYPE_CHECKS?K.TYPE_CHECKS[this.expected.name](t):t instanceof this.expected}},Ee=class At extends L{static{a(this,"e")}constructor(t,i){super("ArrayOf",t),this.expected=i}static{l(this,"ArrayOfPattern")}static create(t,i){if(i===void 0)throw new TypeError("arrayOf() expects a matcher or value.");return new At(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 S(i)?i.matches(t):b(t,i)}describe(t){return S(t)?t.expectedLabel:typeof t=="string"?`"${t}"`:E(t,"").join(" ")}},$e=class zt extends L{static{a(this,"e")}constructor(t,i,r=2){super("CloseTo",t),this.expected=i,this.precision=r}static{l(this,"CloseToPattern")}static create(t,i,r){return new zt(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)}},ui=class jt extends L{static{a(this,"e")}static{l(this,"AnythingPattern")}constructor(){super("Anything")}static create(){return new jt}get expectedLabel(){return"Anything"}matches(t){return t!=null}},Se=class Ot extends L{static{a(this,"e")}constructor(t,i){super("StringMatching",t),this.expected=i}static{l(this,"StringMatchingPattern")}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 Ot(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)}},we=class Mt extends L{static{a(this,"e")}constructor(t,i){super("ArrayContaining",t),this.expected=i}static{l(this,"ArrayContainingPattern")}static create(t,i){if(!Array.isArray(i))throw new TypeError("arrayContaining() expects an array.");return new Mt(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 S(i)?i.matches(t):b(t,i)}describe(t){return S(t)?t.expectedLabel:E(t,"").join(" ")}},Re=class Pt extends L{static{a(this,"e")}constructor(t,i){super("ObjectContaining",t),this.expected=i}static{l(this,"ObjectContainingPattern")}static create(t,i){if(typeof i!="object"||i===null||Array.isArray(i))throw new TypeError("objectContaining() expects a plain object.");return new Pt(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 S(i)?i.matches(t):b(t,i)}describe(t){return S(t)?t.expectedLabel:E(t,"").join(" ")}},Ie=class Nt extends L{static{a(this,"e")}constructor(t,i){super("StringContaining",t),this.expected=i}static{l(this,"StringContainingPattern")}static create(t,i){if(typeof i!="string")throw new TypeError("stringContaining() expects a string.");return new Nt(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))}},pi={any:hi.create,anything:ui.create,closeTo:$e.create.bind(null,!1),arrayOf:Ee.create.bind(null,!1),stringMatching:Se.create.bind(null,!1),arrayContaining:we.create.bind(null,!1),objectContaining:Re.create.bind(null,!1),stringContaining:Ie.create.bind(null,!1),not:{closeTo:$e.create.bind(null,!0),arrayOf:Ee.create.bind(null,!0),stringMatching:Se.create.bind(null,!0),arrayContaining:we.create.bind(null,!0),objectContaining:Re.create.bind(null,!1),stringContaining:Ie.create.bind(null,!0)}},fi=class extends ce{static{a(this,"oe")}static{l(this,"xJetPromiseError")}constructor(e){let t=[`${Q(e)}
64
- `,`Matcher error: ${e.message}`,`${e.promiseKind} to value: ${u(E(e.received,"").join(" "))}`];super(t.join(`
65
- `),"xJetPromiseError")}},Ft=class{static{a(this,"U")}constructor(e){this.received=e}static{l(this,"MatcherService")}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(!Be(r))throw new j({message:`${u("received")} value must be a promise or a function returning a promise`,assertionChain:this.assertionChain,received:{type:R(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 fi({message:`${u("received")} promise ${i} instead of ${r}`,received:t,promiseKind:e,assertionChain:this.assertionChain})}};for(let e of Object.keys(xe)){let t=Ft.prototype,i=xe[e];Object.defineProperty(t,e,{value:l(function(...r){return this.invoke(e,i,r)},"value")}),Object.defineProperty(t[e],"name",{value:e})}var di=l((e,...t)=>{if(t.length>0)throw new Error(`Expect takes at most one argument. Received ${t.length+1} arguments instead.`);return new Ft(e)},"coreExpect"),Gi=Object.assign(di,pi);function Dt(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(Dt,"b");function qt(e,t){return Dt(e,"read",t)}a(qt,"h");function Wt(e,t){return Dt(e,"write",t)}a(Wt,"d");function ue(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(ue,"f");function _t(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(_t,"l");function gi(){let e=[],{arraySize:t=0,size:i}=this.descriptor;e.length=t;for(let r=0;r<t;r++)e[r]=_t.call(this,r*i);return e}a(gi,"U");function mi(){return"arraySize"in this.descriptor&&this.descriptor.arraySize?gi.call(this):_t.call(this)}a(mi,"S");function Jt(e,t=0){e??={};let{position:i,type:r,size:n}=this.descriptor,s=r.toBuffer(e),o=this.offset+i+t,[c,h]=ue(this.buffer,o,n);this.buffer=Buffer.concat([c,s,h]),s.length>n&&(this.offset+=s.length-n)}a(Jt,"T");function yi(e){let{arraySize:t=0,size:i}=this.descriptor;for(let r=0;r<t;r++){let n=r<e.length?e[r]:{};Jt.call(this,n,r*i)}}a(yi,"W");function vi(e){return"arraySize"in this.descriptor&&this.descriptor.arraySize?yi.call(this,Array.isArray(e)?e:[e]):Jt.call(this,Array.isArray(e)?e[0]||{}:e)}a(vi,"I");var O={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 bi(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=O[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(bi,"x");function Vt(e=0){let{position:t,type:i}=this.descriptor,r=this.offset+t+e;return qt(this.buffer,i)(r)}a(Vt,"z");function xi(){let e=[],{arraySize:t=0,size:i}=this.descriptor;e.length=t;for(let r=0;r<t;r++)e[r]=Vt.call(this,r*i);return e}a(xi,"N");function Ei(){return"arraySize"in this.descriptor&&this.descriptor.arraySize?xi.call(this):Vt.call(this)}a(Ei,"w");function Gt(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;Wt(this.buffer,r)(e,s)}a(Gt,"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;Gt.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]);Gt.call(this,Array.isArray(e)?e[0]||0:e)}a(Si,"P");var Ut=new Map;function fe(e){return e.startsWith("Int")}a(fe,"y");function Kt(e){let t=Ut.get(e);return t===void 0&&(t=(1<<e)-1,Ut.set(e,t)),t}a(Kt,"D");function wi(e,t){return fe(e.type)?Number(BigInt.asIntN(e.bitSize,BigInt(t))):t}a(wi,"j");function Ri(e,t){let i=fe(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(Ri,"G");function Yt(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(O[e.type]>32)throw new Error(`${e.type} is not supported yet`);if(e.bitPosition+e.bitSize>O[e.type])throw new Error(`bitPosition(${e.bitPosition}) + bitSize(${e.bitSize}) exceeds ${e.type} size for ${t}`)}a(Yt,"v");function Ii(e,t){Yt(t,"read operation");let{type:i,bitPosition:r,bitSize:n}=t,s=Kt(n),o=e>>r&s;return fe(i)&&o&1<<n-1?o|~s:o}a(Ii,"Z");function ki(e,t,i){Yt(t,"write operation"),Ri(t,i);let{bitPosition:r,bitSize:n}=t,s=wi(t,i),o=Kt(n)<<r;return e&~o|s<<r&o}a(ki,"q");function Ti(e,t=0,i=0){let[r,n]=e.split(":",2),s=parseInt(n,10),o=O[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(Ti,"$");function Ci(){let e=this.descriptor.position+this.offset,t=this.descriptor.isBigEndian?"BE":"LE",i=this.buffer[`readUInt${t}`](e,this.descriptor.size);return Ii(i,this.descriptor)}a(Ci,"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=ki(r,this.descriptor,e);this.buffer[`writeUInt${i}`](n,t,this.descriptor.size)}a(Bi,"F");var Ht=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 Xt(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(qt(this.buffer,o)(n)),h=n+r;if(this.offset+=c,h+c>this.buffer.length)throw new Error(`String prefix length exceeds buffer position: ${h} size: ${c} > ${this.buffer.length}`);return this.buffer.subarray(h,h+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 h=o-n;return this.offset+=h+1,this.buffer.subarray(n,o).toString(s)}return this.buffer.subarray(n,n+r).toString(s)}a(Xt,"M");function Ai(){let e=[],{arraySize:t=0,size:i}=this.descriptor;e.length=t;for(let r=0;r<t;r++)e[r]=Xt.call(this,r*i);return e}a(Ai,"Y");function zi(){return"arraySize"in this.descriptor&&this.descriptor.arraySize?Ai.call(this):Xt.call(this)}a(zi,"L");function Zt(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);Wt(this.buffer,this.descriptor.lengthType)(c.length,s);let[h,f]=ue(this.buffer,s+n);this.buffer=Buffer.concat([h,c,f]),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`,h=Buffer.from(c,o),[f,g]=ue(this.buffer,s,n);this.buffer=Buffer.concat([f,h,g]),this.offset+=h.length;return}this.buffer.write(e,s,n,o)}a(Zt,"k");function ji(e){let{arraySize:t=0,size:i}=this.descriptor;for(let r=0;r<t;r++){let n=r<e.length?e[r]:"";Zt.call(this,n,r*i)}}a(ji,"O");function Oi(e){return"arraySize"in this.descriptor&&this.descriptor.arraySize?ji.call(this,Array.isArray(e)?e:[e]):Zt.call(this,Array.isArray(e)?e[0]||"":e)}a(Oi,"V");var M=class pe{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 mi.call(t);case"bitfield":return Ci.call(t);case"string":return zi.call(t);default:return Ei.call(t)}}writeValue(t,i,r){switch(i){case"struct":vi.call(t,r);break;case"bitfield":Bi.call(t,r);break;case"string":Oi.call(t,r);break;default:Si.call(t,r)}}computeFieldSize(t,i){if(t.type instanceof pe)return{...t,position:i,size:t.type.size,kind:"struct"};if(Ht.has(t.type))return this.computeStringFieldSize(t,i);let r=O[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=O[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=O.UInt16LE/8);return r}parseStringNotation(t,i){return t.includes(":")?Ti(t,i):[...Ht].find(r=>t.startsWith(r))?Li(t,i):bi(t,i)}convertToSizedField(t,i){return t instanceof pe?{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 Mi=new M({line:"UInt32LE",column:"UInt32LE",source:"string"}),Qt=new M({kind:"UInt8:4",suiteId:{type:"string",size:14},runnerId:{type:"string",size:14},timestamp:"string"}),Pi=new M({level:"UInt8",message:{type:"string",lengthType:"UInt32LE"},ancestry:{type:"string",lengthType:"UInt32LE"},invocation:Mi}),de=new M({error:{type:"string",lengthType:"UInt32LE"}}),Ni=new M({type:"UInt8:5",todo:"UInt8:1",skipped:"UInt8:1",duration:"UInt32LE",ancestry:{type:"string",lengthType:"UInt32LE"},description:{type:"string",lengthType:"UInt32LE"}}),Fi=new M({type:"UInt8:5",passed:"UInt8:1",duration:"UInt32LE",ancestry:{type:"string",lengthType:"UInt32LE"},description:{type:"string",lengthType:"UInt32LE"},errors:{type:"string",lengthType:"UInt32LE"}});function Ui(e,t,i){let r=Qt.toBuffer({kind:2,suiteId:t??"",runnerId:i??"",timestamp:new Date().toISOString()}),n=de.toBuffer({error:JSON.stringify(H(e))});return Buffer.concat([r,n])}a(Ui,"encodeErrorSchema");export{ee as MockState,Ui as encodeErrorSchema};
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(`
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.
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};
66
66
  //# sourceMappingURL=index.js.map