{"version":3,"file":"notHandler.cjs","sources":["../../../src/matchers/notHandler.js"],"sourcesContent":["import { getSpyMatcherResult } from './spyErrorReporting.js';\n\n/**\n * Creates a .not handler for a matcher function that inverts the matcher's logic\n * \n * Logic:\n * - If the original matcher passes (returns true), .not should fail\n * - If the original matcher fails (throws error), .not should pass\n * - Uses specialized spy error reporting for proper .not case error messages\n * \n * @param {Function} matcherFn - The original matcher function\n * @param {string} matcherName - The name of the matcher\n * @returns {Function} - A function that handles .not logic with inverted behavior\n */\nexport function createNotHandler(matcherFn, matcherName) {\n  return function(received, ...args) {\n    try {\n      const result = matcherFn(received, ...args);\n      // Original matcher passed, so .not should fail with specialized error reporting\n      return getSpyMatcherResult(false, matcherName, received, args.length === 1 ? args[0] : args, true);\n    } catch (matcherError) {\n      // Check if this error is already a .not failure to avoid double-negation\n      if (matcherError.isNot) {\n        throw matcherError;\n      }\n      // Original matcher failed, so .not should pass\n      return true;\n    }\n  };\n}\n\n/**\n * Wraps a matcher function to handle both normal and .not cases\n * @param {Function} matcherFn - The original matcher function\n * @param {string} matcherName - The name of the matcher\n * @returns {Function} - A function that handles both cases\n */\nexport function wrapMatcher(matcherFn, matcherName) {\n  return function(received, ...args) {\n    return matcherFn(received, ...args);\n  };\n}\n\n/**\n * Creates a matcher with .not support\n * @param {Function} matcherFn - The original matcher function\n * @param {string} matcherName - The name of the matcher\n * @returns {Object} - Object with normal and .not versions\n */\nexport function createMatcherWithNot(matcherFn, matcherName) {\n  return {\n    normal: wrapMatcher(matcherFn, matcherName),\n    not: createNotHandler(matcherFn, matcherName)\n  };\n} "],"names":["getSpyMatcherResult"],"mappings":";;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gBAAgB,CAAC,SAAS,EAAE,WAAW,EAAE;AACzD,EAAE,OAAO,SAAS,QAAQ,EAAE,GAAG,IAAI,EAAE;AACrC,IAAI,IAAI;AACR,MAAM,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC;AACjD;AACA,MAAM,OAAOA,qCAAmB,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC;AACxG,IAAI,CAAC,CAAC,OAAO,YAAY,EAAE;AAC3B;AACA,MAAM,IAAI,YAAY,CAAC,KAAK,EAAE;AAC9B,QAAQ,MAAM,YAAY;AAC1B,MAAM;AACN;AACA,MAAM,OAAO,IAAI;AACjB,IAAI;AACJ,EAAE,CAAC;AACH;;;;"}