1{"version":3,"file":"NavigationContainer.native.js","sourceRoot":"","sources":["../../src/fork/NavigationContainer.native.tsx"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,6GAA6G;AAC7G,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAIhB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,YAAY,EAEZ,cAAc,EAGd,aAAa,GACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,aAAa,MAAM,4CAA4C,CAAC;AACvE,OAAO,gBAAgB,MAAM,+CAA+C,CAAC;AAC7E,OAAO,WAAW,MAAM,0CAA0C,CAAC;AACnE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,MAAM,CAAC,yBAAyB,GAAG,IAAI,OAAO,EAAE,CAAC;AAUjD;;;;;;;;;;;;;GAaG;AACH,SAAS,wBAAwB,CAC/B,EACE,KAAK,GAAG,YAAY,EACpB,OAAO,EACP,QAAQ,GAAG,IAAI,EACf,aAAa,EACb,OAAO,EACP,GAAG,IAAI,EACc,EACvB,GAA6D;IAE7D,MAAM,gBAAgB,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAErE,IAAI,OAAO,EAAE,MAAM,EAAE;QACnB,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;KACpC;IAED,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAwC,IAAI,CAAC,CAAC;IAE/E,aAAa,CAAC,YAAY,CAAC,CAAC;IAC5B,gBAAgB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;IAE9C,MAAM,EAAE,eAAe,EAAE,GAAG,UAAU,CAAC,YAAY,EAAE;QACnD,iCAAiC;QACjC,OAAO,EAAE,gBAAgB;QACzB,QAAQ,EAAE,EAAE;QACZ,GAAG,OAAO;KACX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,EAAE,CAAC;SACxB;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,IAAI,CAAC,OAAO,EAAE;QACZ,6DAA6D;QAC7D,qEAAqE;QACrE,OAAO,QAA8B,CAAC;KACvC;IAED,OAAO,CACL,oBAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,cAAc;QAC5C,oBAAC,aAAa,IAAC,KAAK,EAAE,KAAK;YACzB,oBAAC,uBAAuB,OAClB,IAAI,EACR,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAC1E,GAAG,EAAE,YAAY,GACjB,CACY,CACQ,CAC3B,CAAC;AACJ,CAAC;AAED,MAAM,mBAAmB,GAAG,KAAK,CAAC,UAAU,CAAC,wBAAwB,CAM9C,CAAC;AAExB,eAAe,mBAAmB,CAAC","sourcesContent":["// Forked from React Navigation in order to use a custom `useLinking` -> `extractPathFromURL` function.\n// https://github.com/react-navigation/react-navigation/blob/main/packages/native/src/NavigationContainer.tsx\nimport {\n  BaseNavigationContainer,\n  getActionFromState,\n  getPathFromState,\n  getStateFromPath,\n  NavigationContainerProps,\n  NavigationContainerRef,\n  ParamListBase,\n  validatePathConfig,\n} from '@react-navigation/core';\nimport {\n  DefaultTheme,\n  DocumentTitleOptions,\n  LinkingContext,\n  LinkingOptions,\n  Theme,\n  ThemeProvider,\n} from '@react-navigation/native';\nimport useBackButton from '@react-navigation/native/src/useBackButton';\nimport useDocumentTitle from '@react-navigation/native/src/useDocumentTitle';\nimport useThenable from '@react-navigation/native/src/useThenable';\nimport * as React from 'react';\n\nimport useLinking from './useLinking';\n\nglobal.REACT_NAVIGATION_DEVTOOLS = new WeakMap();\n\ntype Props<ParamList extends object> = NavigationContainerProps & {\n  theme?: Theme;\n  linking?: LinkingOptions<ParamList>;\n  fallback?: React.ReactNode;\n  documentTitle?: DocumentTitleOptions;\n  onReady?: () => void;\n};\n\n/**\n * Container component which holds the navigation state designed for React Native apps.\n * This should be rendered at the root wrapping the whole app.\n *\n * @param props.initialState Initial state object for the navigation tree. When deep link handling is enabled, this will override deep links when specified. Make sure that you don't specify an `initialState` when there's a deep link (`Linking.getInitialURL()`).\n * @param props.onReady Callback which is called after the navigation tree mounts.\n * @param props.onStateChange Callback which is called with the latest navigation state when it changes.\n * @param props.theme Theme object for the navigators.\n * @param props.linking Options for deep linking. Deep link handling is enabled when this prop is provided, unless `linking.enabled` is `false`.\n * @param props.fallback Fallback component to render until we have finished getting initial state when linking is enabled. Defaults to `null`.\n * @param props.documentTitle Options to configure the document title on Web. Updating document title is handled by default unless `documentTitle.enabled` is `false`.\n * @param props.children Child elements to render the content.\n * @param props.ref Ref object which refers to the navigation object containing helper methods.\n */\nfunction NavigationContainerInner(\n  {\n    theme = DefaultTheme,\n    linking,\n    fallback = null,\n    documentTitle,\n    onReady,\n    ...rest\n  }: Props<ParamListBase>,\n  ref?: React.Ref<NavigationContainerRef<ParamListBase> | null>\n) {\n  const isLinkingEnabled = linking ? linking.enabled !== false : false;\n\n  if (linking?.config) {\n    validatePathConfig(linking.config);\n  }\n\n  const refContainer = React.useRef<NavigationContainerRef<ParamListBase>>(null);\n\n  useBackButton(refContainer);\n  useDocumentTitle(refContainer, documentTitle);\n\n  const { getInitialState } = useLinking(refContainer, {\n    // independent: rest.independent,\n    enabled: isLinkingEnabled,\n    prefixes: [],\n    ...linking,\n  });\n\n  // Add additional linking related info to the ref\n  // This will be used by the devtools\n  React.useEffect(() => {\n    if (refContainer.current) {\n      REACT_NAVIGATION_DEVTOOLS.set(refContainer.current, {\n        get linking() {\n          return {\n            ...linking,\n            enabled: isLinkingEnabled,\n            prefixes: linking?.prefixes ?? [],\n            getStateFromPath: linking?.getStateFromPath ?? getStateFromPath,\n            getPathFromState: linking?.getPathFromState ?? getPathFromState,\n            getActionFromState: linking?.getActionFromState ?? getActionFromState,\n          };\n        },\n      });\n    }\n  });\n\n  const [isResolved, initialState] = useThenable(getInitialState);\n\n  React.useImperativeHandle(ref, () => refContainer.current);\n\n  const linkingContext = React.useMemo(() => ({ options: linking }), [linking]);\n\n  const isReady = rest.initialState != null || !isLinkingEnabled || isResolved;\n\n  const onReadyRef = React.useRef(onReady);\n\n  React.useEffect(() => {\n    onReadyRef.current = onReady;\n  });\n\n  React.useEffect(() => {\n    if (isReady) {\n      onReadyRef.current?.();\n    }\n  }, [isReady]);\n\n  if (!isReady) {\n    // This is temporary until we have Suspense for data-fetching\n    // Then the fallback will be handled by a parent `Suspense` component\n    return fallback as React.ReactElement;\n  }\n\n  return (\n    <LinkingContext.Provider value={linkingContext}>\n      <ThemeProvider value={theme}>\n        <BaseNavigationContainer\n          {...rest}\n          initialState={rest.initialState == null ? initialState : rest.initialState}\n          ref={refContainer}\n        />\n      </ThemeProvider>\n    </LinkingContext.Provider>\n  );\n}\n\nconst NavigationContainer = React.forwardRef(NavigationContainerInner) as <\n  RootParamList extends object = ReactNavigation.RootParamList,\n>(\n  props: Props<RootParamList> & {\n    ref?: React.Ref<NavigationContainerRef<RootParamList>>;\n  }\n) => React.ReactElement;\n\nexport default NavigationContainer;\n"]}