function matchesValue(e,t,n){if(e instanceof RegExp)return testRegExpAgainst(e,t);if(typeof e==`function`){let r=e(t,n);return typeof r==`boolean`?r:typeof r==`function`?Object.is(r,t):matchesValue(r,t,n)}return Array.isArray(e)?!Array.isArray(t)||t.length!==e.length?!1:e.every((e,r)=>matchesValue(e,t[r],n)):isPlainObject(e)?isPlainObject(t)?Object.entries(e).every(([e,r])=>matchesValue(r,t[e],n)):!1:Object.is(e,t)}function toolCallMatches(e,t,n){return!(t.input!==void 0&&!matchesValue(t.input,e.input,n)||t.output!==void 0&&!matchesValue(t.output,e.output,n)||t.isError!==void 0&&e.isError!==t.isError)}function subagentCallMatches(e,t,n){return!(t.remoteUrl!==void 0&&!matchesValue(t.remoteUrl,e.remoteUrl,n)||t.output!==void 0&&!matchesValue(t.output,e.output,n))}function deepEquals(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>deepEquals(e,t[n]));if(isPlainObject(e)&&isPlainObject(t)){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length?n.every(n=>deepEquals(e[n],t[n])):!1}return!1}function testRegExpAgainst(e,t){if(typeof t==`string`)return testRegExp(e,t);if(t===void 0)return!1;let n=JSON.stringify(t);return n!==void 0&&testRegExp(e,n)}function testRegExp(e,t){return(e.global||e.sticky)&&(e.lastIndex=0),e.test(t)}function isPlainObject(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{deepEquals,matchesValue,subagentCallMatches,testRegExp,toolCallMatches};