{"version":3,"sources":["../../../src/client/react-client-callbacks/on-recoverable-error.ts"],"sourcesContent":["// This module can be shared between both pages router and app router\n\nimport type { HydrationOptions } from 'react-dom/client'\nimport { isBailoutToCSRError } from '../../shared/lib/lazy-dynamic/bailout-to-csr'\nimport isError from '../../lib/is-error'\nimport { reportGlobalError } from './report-global-error'\n\nconst recoverableErrors = new WeakSet<Error>()\n\nconst isInstantTest =\n  process.env.__NEXT_EXPOSE_TESTING_API &&\n  typeof self !== 'undefined' &&\n  !!self.__next_instant_test\n\nexport function isRecoverableError(error: Error): boolean {\n  return recoverableErrors.has(error)\n}\n\nexport const onRecoverableError: HydrationOptions['onRecoverableError'] = (\n  error\n) => {\n  // x-ref: https://github.com/facebook/react/pull/28736\n  let cause = isError(error) && 'cause' in error ? error.cause : error\n  // Skip certain custom errors which are not expected to be reported on client\n  if (isBailoutToCSRError(cause)) return\n\n  // Instant Navigation Testing API: suppress \"server could not finish this\n  // Suspense boundary\" errors (React error #419) during instant test mode.\n  // The static shell intentionally has incomplete Suspense boundaries — React\n  // correctly falls back to client rendering, which is expected.\n  if (isInstantTest) {\n    if (isError(cause)) {\n      if (process.env.NODE_ENV === 'production') {\n        if (cause.message.includes('#419')) return\n      } else {\n        if (cause.message.includes('could not finish this Suspense boundary'))\n          return\n      }\n    }\n  }\n\n  if (process.env.NODE_ENV !== 'production') {\n    const { decorateDevError } =\n      require('../../next-devtools/userspace/app/errors/stitched-error') as typeof import('../../next-devtools/userspace/app/errors/stitched-error')\n    const causeError = decorateDevError(cause)\n    recoverableErrors.add(causeError)\n    cause = causeError\n  }\n\n  reportGlobalError(cause)\n}\n"],"names":["isRecoverableError","onRecoverableError","recoverableErrors","WeakSet","isInstantTest","process","env","__NEXT_EXPOSE_TESTING_API","self","__next_instant_test","error","has","cause","isError","isBailoutToCSRError","NODE_ENV","message","includes","decorateDevError","require","causeError","add","reportGlobalError"],"mappings":"AAAA,qEAAqE;;;;;;;;;;;;;;;;IAcrDA,kBAAkB;eAAlBA;;IAIHC,kBAAkB;eAAlBA;;;;8BAfuB;kEAChB;mCACc;AAElC,MAAMC,oBAAoB,IAAIC;AAE9B,MAAMC,gBACJC,QAAQC,GAAG,CAACC,yBAAyB,IACrC,OAAOC,SAAS,eAChB,CAAC,CAACA,KAAKC,mBAAmB;AAErB,SAAST,mBAAmBU,KAAY;IAC7C,OAAOR,kBAAkBS,GAAG,CAACD;AAC/B;AAEO,MAAMT,qBAA6D,CACxES;IAEA,sDAAsD;IACtD,IAAIE,QAAQC,IAAAA,gBAAO,EAACH,UAAU,WAAWA,QAAQA,MAAME,KAAK,GAAGF;IAC/D,6EAA6E;IAC7E,IAAII,IAAAA,iCAAmB,EAACF,QAAQ;IAEhC,yEAAyE;IACzE,yEAAyE;IACzE,4EAA4E;IAC5E,+DAA+D;IAC/D,IAAIR,eAAe;QACjB,IAAIS,IAAAA,gBAAO,EAACD,QAAQ;YAClB,IAAIP,QAAQC,GAAG,CAACS,QAAQ,KAAK,cAAc;gBACzC,IAAIH,MAAMI,OAAO,CAACC,QAAQ,CAAC,SAAS;YACtC,OAAO;gBACL,IAAIL,MAAMI,OAAO,CAACC,QAAQ,CAAC,4CACzB;YACJ;QACF;IACF;IAEA,IAAIZ,QAAQC,GAAG,CAACS,QAAQ,KAAK,cAAc;QACzC,MAAM,EAAEG,gBAAgB,EAAE,GACxBC,QAAQ;QACV,MAAMC,aAAaF,iBAAiBN;QACpCV,kBAAkBmB,GAAG,CAACD;QACtBR,QAAQQ;IACV;IAEAE,IAAAA,oCAAiB,EAACV;AACpB","ignoreList":[0]}