{"version":3,"file":"not-found.cjs","sources":["../../src/not-found.tsx"],"sourcesContent":["import * as React from 'react'\nimport { isNotFound } from '@tanstack/router-core'\nimport { CatchBoundary } from './CatchBoundary'\nimport { useRouterState } from './useRouterState'\nimport type { ErrorInfo } from 'react'\nimport type { NotFoundError } from '@tanstack/router-core'\n\nexport function CatchNotFound(props: {\n  fallback?: (error: NotFoundError) => React.ReactElement\n  onCatch?: (error: Error, errorInfo: ErrorInfo) => void\n  children: React.ReactNode\n}) {\n  // TODO: Some way for the user to programmatically reset the not-found boundary?\n  const resetKey = useRouterState({\n    select: (s) => `not-found-${s.location.pathname}-${s.status}`,\n  })\n\n  return (\n    <CatchBoundary\n      getResetKey={() => resetKey}\n      onCatch={(error, errorInfo) => {\n        if (isNotFound(error)) {\n          props.onCatch?.(error, errorInfo)\n        } else {\n          throw error\n        }\n      }}\n      errorComponent={({ error }) => {\n        if (isNotFound(error)) {\n          return props.fallback?.(error)\n        } else {\n          throw error\n        }\n      }}\n    >\n      {props.children}\n    </CatchBoundary>\n  )\n}\n\nexport function DefaultGlobalNotFound() {\n  return <p>Not Found</p>\n}\n"],"names":["useRouterState","jsx","CatchBoundary","isNotFound"],"mappings":";;;;;;AAOO,SAAS,cAAc,OAI3B;AAED,QAAM,WAAWA,eAAAA,eAAe;AAAA,IAC9B,QAAQ,CAAC,MAAM,aAAa,EAAE,SAAS,QAAQ,IAAI,EAAE,MAAM;AAAA,EAAA,CAC5D;AAED,SACEC,2BAAAA;AAAAA,IAACC,cAAAA;AAAAA,IAAA;AAAA,MACC,aAAa,MAAM;AAAA,MACnB,SAAS,CAAC,OAAO,cAAc;AAC7B,YAAIC,WAAAA,WAAW,KAAK,GAAG;AACrB,gBAAM,UAAU,OAAO,SAAS;AAAA,QAClC,OAAO;AACL,gBAAM;AAAA,QACR;AAAA,MACF;AAAA,MACA,gBAAgB,CAAC,EAAE,YAAY;AAC7B,YAAIA,WAAAA,WAAW,KAAK,GAAG;AACrB,iBAAO,MAAM,WAAW,KAAK;AAAA,QAC/B,OAAO;AACL,gBAAM;AAAA,QACR;AAAA,MACF;AAAA,MAEC,UAAA,MAAM;AAAA,IAAA;AAAA,EAAA;AAGb;AAEO,SAAS,wBAAwB;AACtC,SAAOF,2BAAAA,IAAC,OAAE,UAAA,YAAA,CAAS;AACrB;;;"}