{"ast":null,"code":"\"use strict\";\n\nimport * as queryString from 'query-string';\nimport { getPatternParts } from \"./getPatternParts.js\";\nimport { validatePathConfig } from \"./validatePathConfig.js\";\nconst getActiveRoute = state => {\n  const route = typeof state.index === 'number' ? state.routes[state.index] : state.routes[state.routes.length - 1];\n  if (route.state) {\n    return getActiveRoute(route.state);\n  }\n  return route;\n};\nconst cachedNormalizedConfigs = new WeakMap();\nconst getNormalizedConfigs = options => {\n  if (!options?.screens) return {};\n  const cached = cachedNormalizedConfigs.get(options?.screens);\n  if (cached) return cached;\n  const normalizedConfigs = createNormalizedConfigs(options.screens);\n  cachedNormalizedConfigs.set(options.screens, normalizedConfigs);\n  return normalizedConfigs;\n};\nexport function getPathFromState(state, options) {\n  if (state == null) {\n    throw Error(`Got '${String(state)}' for the navigation state. You must pass a valid state object.`);\n  }\n  if (options) {\n    validatePathConfig(options);\n  }\n  const configs = getNormalizedConfigs(options);\n  let path = '/';\n  let current = state;\n  const allParams = {};\n  while (current) {\n    let index = typeof current.index === 'number' ? current.index : 0;\n    let route = current.routes[index];\n    let parts;\n    let focusedParams;\n    let currentOptions = configs;\n    const focusedRoute = getActiveRoute(state);\n    const nestedRouteNames = [];\n    let hasNext = true;\n    while (route.name in currentOptions && hasNext) {\n      parts = currentOptions[route.name].parts;\n      nestedRouteNames.push(route.name);\n      if (route.params) {\n        const options = currentOptions[route.name];\n        const currentParams = Object.fromEntries(Object.entries(route.params).map(([key, value]) => {\n          if (value === undefined) {\n            if (options) {\n              const optional = options.parts?.find(part => part.param === key)?.optional;\n              if (optional) {\n                return null;\n              }\n            } else {\n              return null;\n            }\n          }\n          const stringify = options?.stringify?.[key] ?? String;\n          return [key, stringify(value)];\n        }).filter(entry => entry != null));\n        if (parts?.length) {\n          Object.assign(allParams, currentParams);\n        }\n        if (focusedRoute === route) {\n          focusedParams = Object.assign({}, currentParams);\n          parts?.forEach(({\n            param\n          }) => {\n            if (param) {\n              if (focusedParams) {\n                delete focusedParams[param];\n              }\n            }\n          });\n        }\n      }\n      if (!currentOptions[route.name].screens || route.state === undefined) {\n        hasNext = false;\n      } else {\n        index = typeof route.state.index === 'number' ? route.state.index : route.state.routes.length - 1;\n        const nextRoute = route.state.routes[index];\n        const nestedConfig = currentOptions[route.name].screens;\n        if (nestedConfig && nextRoute.name in nestedConfig) {\n          route = nextRoute;\n          currentOptions = nestedConfig;\n        } else {\n          hasNext = false;\n        }\n      }\n    }\n    if (currentOptions[route.name] !== undefined) {\n      path += parts?.map(({\n        segment,\n        param,\n        optional\n      }) => {\n        if (segment === '*') {\n          return route.name;\n        }\n        if (param) {\n          const value = allParams[param];\n          if (value === undefined && optional) {\n            return '';\n          }\n          return String(value).replace(/[^A-Za-z0-9\\-._~!$&'()*+,;=:@]/g, char => encodeURIComponent(char));\n        }\n        return encodeURIComponent(segment);\n      }).join('/');\n    } else {\n      path += encodeURIComponent(route.name);\n    }\n    if (!focusedParams && focusedRoute.params) {\n      focusedParams = Object.fromEntries(Object.entries(focusedRoute.params).map(([key, value]) => [key, String(value)]));\n    }\n    if (route.state) {\n      path += '/';\n    } else if (focusedParams) {\n      for (const param in focusedParams) {\n        if (focusedParams[param] === 'undefined') {\n          delete focusedParams[param];\n        }\n      }\n      const query = queryString.stringify(focusedParams, {\n        sort: false\n      });\n      if (query) {\n        path += `?${query}`;\n      }\n    }\n    current = route.state;\n  }\n  if (options?.path) {\n    path = `${options.path}/${path}`;\n  }\n  path = path.replace(/\\/+/g, '/');\n  path = path.length > 1 ? path.replace(/\\/$/, '') : path;\n  if (!path.startsWith('/')) {\n    path = `/${path}`;\n  }\n  return path;\n}\nconst createConfigItem = (config, parentParts) => {\n  if (typeof config === 'string') {\n    const parts = getPatternParts(config);\n    if (parentParts) {\n      return {\n        parts: [...parentParts, ...parts]\n      };\n    }\n    return {\n      parts\n    };\n  }\n  if (config.exact && config.path === undefined) {\n    throw new Error(\"A 'path' needs to be specified when specifying 'exact: true'. If you don't want this screen in the URL, specify it as empty string, e.g. `path: ''`.\");\n  }\n  const parts = config.exact !== true ? [...(parentParts || []), ...(config.path ? getPatternParts(config.path) : [])] : config.path ? getPatternParts(config.path) : undefined;\n  const screens = config.screens ? createNormalizedConfigs(config.screens, parts) : undefined;\n  return {\n    parts,\n    stringify: config.stringify,\n    screens\n  };\n};\nconst createNormalizedConfigs = (options, parts) => Object.fromEntries(Object.entries(options).map(([name, c]) => {\n  const result = createConfigItem(c, parts);\n  return [name, result];\n}));","map":{"version":3,"names":["queryString","getPatternParts","validatePathConfig","getActiveRoute","state","route","index","routes","length","cachedNormalizedConfigs","WeakMap","getNormalizedConfigs","options","screens","cached","get","normalizedConfigs","createNormalizedConfigs","set","getPathFromState","Error","String","configs","path","current","allParams","parts","focusedParams","currentOptions","focusedRoute","nestedRouteNames","hasNext","name","push","params","currentParams","Object","fromEntries","entries","map","key","value","undefined","optional","find","part","param","stringify","filter","entry","assign","forEach","nextRoute","nestedConfig","segment","replace","char","encodeURIComponent","join","query","sort","startsWith","createConfigItem","config","parentParts","exact","c","result"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/@react-navigation/core/src/getPathFromState.tsx"],"sourcesContent":["import type {\n  NavigationState,\n  PartialState,\n  Route,\n} from '@react-navigation/routers';\nimport * as queryString from 'query-string';\n\nimport { getPatternParts, type PatternPart } from './getPatternParts';\nimport type { PathConfig, PathConfigMap } from './types';\nimport { validatePathConfig } from './validatePathConfig';\n\ntype Options<ParamList extends {}> = {\n  path?: string;\n  initialRouteName?: string;\n  screens: PathConfigMap<ParamList>;\n};\n\ntype State = NavigationState | Omit<PartialState<NavigationState>, 'stale'>;\n\ntype StringifyConfig = Record<string, (value: unknown) => string>;\n\ntype ConfigItem = {\n  parts?: PatternPart[];\n  stringify?: StringifyConfig;\n  screens?: Record<string, ConfigItem>;\n};\n\nconst getActiveRoute = (state: State): { name: string; params?: object } => {\n  const route =\n    typeof state.index === 'number'\n      ? state.routes[state.index]\n      : state.routes[state.routes.length - 1];\n\n  if (route.state) {\n    return getActiveRoute(route.state);\n  }\n\n  return route;\n};\n\nconst cachedNormalizedConfigs = new WeakMap<\n  PathConfigMap<{}>,\n  Record<string, ConfigItem>\n>();\n\nconst getNormalizedConfigs = (options?: Options<{}>) => {\n  if (!options?.screens) return {};\n\n  const cached = cachedNormalizedConfigs.get(options?.screens);\n\n  if (cached) return cached;\n\n  const normalizedConfigs = createNormalizedConfigs(options.screens);\n\n  cachedNormalizedConfigs.set(options.screens, normalizedConfigs);\n\n  return normalizedConfigs;\n};\n\n/**\n * Utility to serialize a navigation state object to a path string.\n *\n * @example\n * ```js\n * getPathFromState(\n *   {\n *     routes: [\n *       {\n *         name: 'Chat',\n *         params: { author: 'Jane', id: 42 },\n *       },\n *     ],\n *   },\n *   {\n *     screens: {\n *       Chat: {\n *         path: 'chat/:author/:id',\n *         stringify: { author: author => author.toLowerCase() }\n *       }\n *     }\n *   }\n * )\n * ```\n *\n * @param state Navigation state to serialize.\n * @param options Extra options to fine-tune how to serialize the path.\n * @returns Path representing the state, e.g. /foo/bar?count=42.\n */\nexport function getPathFromState<ParamList extends {}>(\n  state: State,\n  options?: Options<ParamList>\n): string {\n  if (state == null) {\n    throw Error(\n      `Got '${String(state)}' for the navigation state. You must pass a valid state object.`\n    );\n  }\n\n  if (options) {\n    validatePathConfig(options);\n  }\n\n  const configs = getNormalizedConfigs(options);\n\n  let path = '/';\n  let current: State | undefined = state;\n\n  const allParams: Record<string, string> = {};\n\n  while (current) {\n    let index = typeof current.index === 'number' ? current.index : 0;\n    let route = current.routes[index] as Route<string> & {\n      state?: State;\n    };\n\n    let parts: PatternPart[] | undefined;\n\n    let focusedParams: Record<string, string> | undefined;\n    let currentOptions = configs;\n\n    const focusedRoute = getActiveRoute(state);\n\n    // Keep all the route names that appeared during going deeper in config in case the pattern is resolved to undefined\n    const nestedRouteNames = [];\n\n    let hasNext = true;\n\n    while (route.name in currentOptions && hasNext) {\n      parts = currentOptions[route.name].parts;\n\n      nestedRouteNames.push(route.name);\n\n      if (route.params) {\n        const options = currentOptions[route.name];\n\n        const currentParams = Object.fromEntries(\n          Object.entries(route.params)\n            .map(([key, value]): [string, string] | null => {\n              if (value === undefined) {\n                if (options) {\n                  const optional = options.parts?.find(\n                    (part) => part.param === key\n                  )?.optional;\n\n                  if (optional) {\n                    return null;\n                  }\n                } else {\n                  return null;\n                }\n              }\n\n              const stringify = options?.stringify?.[key] ?? String;\n\n              return [key, stringify(value)];\n            })\n            .filter((entry) => entry != null)\n        );\n\n        if (parts?.length) {\n          Object.assign(allParams, currentParams);\n        }\n\n        if (focusedRoute === route) {\n          // If this is the focused route, keep the params for later use\n          // We save it here since it's been stringified already\n          focusedParams = { ...currentParams };\n\n          parts\n            // eslint-disable-next-line no-loop-func\n            ?.forEach(({ param }) => {\n              if (param) {\n                // Remove the params present in the pattern since we'll only use the rest for query string\n                if (focusedParams) {\n                  // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n                  delete focusedParams[param];\n                }\n              }\n            });\n        }\n      }\n\n      // If there is no `screens` property or no nested state, we return pattern\n      if (!currentOptions[route.name].screens || route.state === undefined) {\n        hasNext = false;\n      } else {\n        index =\n          typeof route.state.index === 'number'\n            ? route.state.index\n            : route.state.routes.length - 1;\n\n        const nextRoute = route.state.routes[index];\n        const nestedConfig = currentOptions[route.name].screens;\n\n        // if there is config for next route name, we go deeper\n        if (nestedConfig && nextRoute.name in nestedConfig) {\n          route = nextRoute as Route<string> & { state?: State };\n          currentOptions = nestedConfig;\n        } else {\n          // If not, there is no sense in going deeper in config\n          hasNext = false;\n        }\n      }\n    }\n\n    if (currentOptions[route.name] !== undefined) {\n      path += parts\n        ?.map(({ segment, param, optional }) => {\n          // We don't know what to show for wildcard patterns\n          // Showing the route name seems ok, though whatever we show here will be incorrect\n          // Since the page doesn't actually exist\n          if (segment === '*') {\n            return route.name;\n          }\n\n          // If the path has a pattern for a param, put the param in the path\n          if (param) {\n            const value = allParams[param];\n\n            if (value === undefined && optional) {\n              // Optional params without value assigned in route.params should be ignored\n              return '';\n            }\n\n            // Valid characters according to\n            // https://datatracker.ietf.org/doc/html/rfc3986#section-3.3 (see pchar definition)\n            return String(value).replace(\n              /[^A-Za-z0-9\\-._~!$&'()*+,;=:@]/g,\n              (char) => encodeURIComponent(char)\n            );\n          }\n\n          return encodeURIComponent(segment);\n        })\n        .join('/');\n    } else {\n      path += encodeURIComponent(route.name);\n    }\n\n    if (!focusedParams && focusedRoute.params) {\n      focusedParams = Object.fromEntries(\n        Object.entries(focusedRoute.params).map(([key, value]) => [\n          key,\n          String(value),\n        ])\n      );\n    }\n\n    if (route.state) {\n      path += '/';\n    } else if (focusedParams) {\n      for (const param in focusedParams) {\n        if (focusedParams[param] === 'undefined') {\n          // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n          delete focusedParams[param];\n        }\n      }\n\n      const query = queryString.stringify(focusedParams, { sort: false });\n\n      if (query) {\n        path += `?${query}`;\n      }\n    }\n\n    current = route.state;\n  }\n\n  // Include the root path if specified\n  if (options?.path) {\n    path = `${options.path}/${path}`;\n  }\n\n  // Remove multiple as well as trailing slashes\n  path = path.replace(/\\/+/g, '/');\n  path = path.length > 1 ? path.replace(/\\/$/, '') : path;\n\n  // If path doesn't start with a slash, add it\n  // This makes sure that history.pushState will update the path correctly instead of appending\n  if (!path.startsWith('/')) {\n    path = `/${path}`;\n  }\n\n  return path;\n}\n\nconst createConfigItem = (\n  config: PathConfig<object> | string,\n  parentParts?: PatternPart[]\n): ConfigItem => {\n  if (typeof config === 'string') {\n    // If a string is specified as the value of the key(e.g. Foo: '/path'), use it as the pattern\n    const parts = getPatternParts(config);\n\n    if (parentParts) {\n      return { parts: [...parentParts, ...parts] };\n    }\n\n    return { parts };\n  }\n\n  if (config.exact && config.path === undefined) {\n    throw new Error(\n      \"A 'path' needs to be specified when specifying 'exact: true'. If you don't want this screen in the URL, specify it as empty string, e.g. `path: ''`.\"\n    );\n  }\n\n  // If an object is specified as the value (e.g. Foo: { ... }),\n  // It can have `path` property and `screens` prop which has nested configs\n  const parts =\n    config.exact !== true\n      ? [\n          ...(parentParts || []),\n          ...(config.path ? getPatternParts(config.path) : []),\n        ]\n      : config.path\n        ? getPatternParts(config.path)\n        : undefined;\n\n  const screens = config.screens\n    ? createNormalizedConfigs(config.screens, parts)\n    : undefined;\n\n  return {\n    parts,\n    stringify: config.stringify,\n    screens,\n  };\n};\n\nconst createNormalizedConfigs = (\n  options: PathConfigMap<object>,\n  parts?: PatternPart[]\n): Record<string, ConfigItem> =>\n  Object.fromEntries(\n    Object.entries(options).map(([name, c]) => {\n      const result = createConfigItem(c, parts);\n\n      return [name, result];\n    })\n  );\n"],"mappings":";;AAKA,OAAO,KAAKA,WAAW,MAAM,cAAc;AAE3C,SAASC,eAAe;AAExB,SAASC,kBAAkB;AAkB3B,MAAMC,cAAc,GAAIC,KAAY,IAAwC;EAC1E,MAAMC,KAAK,GACT,OAAOD,KAAK,CAACE,KAAK,KAAK,QAAQ,GAC3BF,KAAK,CAACG,MAAM,CAACH,KAAK,CAACE,KAAK,CAAC,GACzBF,KAAK,CAACG,MAAM,CAACH,KAAK,CAACG,MAAM,CAACC,MAAM,GAAG,CAAC,CAAC;EAE3C,IAAIH,KAAK,CAACD,KAAK,EAAE;IACf,OAAOD,cAAc,CAACE,KAAK,CAACD,KAAK,CAAC;EACpC;EAEA,OAAOC,KAAK;AACd,CAAC;AAED,MAAMI,uBAAuB,GAAG,IAAIC,OAAO,CAGzC,CAAC;AAEH,MAAMC,oBAAoB,GAAIC,OAAqB,IAAK;EACtD,IAAI,CAACA,OAAO,EAAEC,OAAO,EAAE,OAAO,CAAC,CAAC;EAEhC,MAAMC,MAAM,GAAGL,uBAAuB,CAACM,GAAG,CAACH,OAAO,EAAEC,OAAO,CAAC;EAE5D,IAAIC,MAAM,EAAE,OAAOA,MAAM;EAEzB,MAAME,iBAAiB,GAAGC,uBAAuB,CAACL,OAAO,CAACC,OAAO,CAAC;EAElEJ,uBAAuB,CAACS,GAAG,CAACN,OAAO,C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