{"ast":null,"code":"\"use strict\";\n\nimport { nanoid } from 'nanoid/non-secure';\nimport { BaseRouter } from \"./BaseRouter.js\";\nconst TYPE_ROUTE = 'route';\nexport const TabActions = {\n  jumpTo(name, params) {\n    return {\n      type: 'JUMP_TO',\n      payload: {\n        name,\n        params\n      }\n    };\n  }\n};\nconst getRouteHistory = (routes, index, backBehavior, initialRouteName) => {\n  const history = [{\n    type: TYPE_ROUTE,\n    key: routes[index].key\n  }];\n  let initialRouteIndex;\n  switch (backBehavior) {\n    case 'order':\n      for (let i = index; i > 0; i--) {\n        history.unshift({\n          type: TYPE_ROUTE,\n          key: routes[i - 1].key\n        });\n      }\n      break;\n    case 'firstRoute':\n      if (index !== 0) {\n        history.unshift({\n          type: TYPE_ROUTE,\n          key: routes[0].key\n        });\n      }\n      break;\n    case 'initialRoute':\n      initialRouteIndex = routes.findIndex(route => route.name === initialRouteName);\n      initialRouteIndex = initialRouteIndex === -1 ? 0 : initialRouteIndex;\n      if (index !== initialRouteIndex) {\n        history.unshift({\n          type: TYPE_ROUTE,\n          key: routes[initialRouteIndex].key\n        });\n      }\n      break;\n    case 'history':\n    case 'fullHistory':\n      break;\n  }\n  return history;\n};\nconst changeIndex = (state, index, backBehavior, initialRouteName) => {\n  let history = state.history;\n  if (backBehavior === 'history' || backBehavior === 'fullHistory') {\n    const currentRouteKey = state.routes[index].key;\n    if (backBehavior === 'history') {\n      history = history.filter(it => it.type === 'route' ? it.key !== currentRouteKey : false);\n    } else if (backBehavior === 'fullHistory') {\n      const lastHistoryRouteItemIndex = history.findLastIndex(item => item.type === 'route');\n      if (currentRouteKey === history[lastHistoryRouteItemIndex]?.key) {\n        history = [...history.slice(0, lastHistoryRouteItemIndex), ...history.slice(lastHistoryRouteItemIndex + 1)];\n      }\n    }\n    history = history.concat({\n      type: TYPE_ROUTE,\n      key: currentRouteKey\n    });\n  } else {\n    history = getRouteHistory(state.routes, index, backBehavior, initialRouteName);\n  }\n  return Object.assign({}, state, {\n    index,\n    history\n  });\n};\nexport function TabRouter({\n  initialRouteName,\n  backBehavior = 'firstRoute'\n}) {\n  const router = Object.assign({}, BaseRouter, {\n    type: 'tab',\n    getInitialState({\n      routeNames,\n      routeParamList\n    }) {\n      const index = initialRouteName !== undefined && routeNames.includes(initialRouteName) ? routeNames.indexOf(initialRouteName) : 0;\n      const routes = routeNames.map(name => ({\n        name,\n        key: `${name}-${nanoid()}`,\n        params: routeParamList[name]\n      }));\n      const history = getRouteHistory(routes, index, backBehavior, initialRouteName);\n      return {\n        stale: false,\n        type: 'tab',\n        key: `tab-${nanoid()}`,\n        index,\n        routeNames,\n        history,\n        routes,\n        preloadedRouteKeys: []\n      };\n    },\n    getRehydratedState(partialState, {\n      routeNames,\n      routeParamList\n    }) {\n      const state = partialState;\n      if (state.stale === false) {\n        return state;\n      }\n      const routes = routeNames.map(name => {\n        const route = state.routes.find(r => r.name === name);\n        return Object.assign({}, route, {\n          name,\n          key: route && route.name === name && route.key ? route.key : `${name}-${nanoid()}`,\n          params: routeParamList[name] !== undefined ? Object.assign({}, routeParamList[name], route ? route.params : undefined) : route ? route.params : undefined\n        });\n      });\n      const index = Math.min(Math.max(routeNames.indexOf(state.routes[state?.index ?? 0]?.name), 0), routes.length - 1);\n      const routeKeys = routes.map(route => route.key);\n      const history = state.history?.filter(it => routeKeys.includes(it.key)) ?? [];\n      return changeIndex({\n        stale: false,\n        type: 'tab',\n        key: `tab-${nanoid()}`,\n        index,\n        routeNames,\n        history,\n        routes,\n        preloadedRouteKeys: state.preloadedRouteKeys?.filter(key => routeKeys.includes(key)) ?? []\n      }, index, backBehavior, initialRouteName);\n    },\n    getStateForRouteNamesChange(state, {\n      routeNames,\n      routeParamList,\n      routeKeyChanges\n    }) {\n      const routes = routeNames.map(name => state.routes.find(r => r.name === name && !routeKeyChanges.includes(r.name)) || {\n        name,\n        key: `${name}-${nanoid()}`,\n        params: routeParamList[name]\n      });\n      const index = Math.max(0, routeNames.indexOf(state.routes[state.index].name));\n      let history = state.history.filter(it => it.type !== 'route' || routes.find(r => r.key === it.key));\n      if (!history.length) {\n        history = getRouteHistory(routes, index, backBehavior, initialRouteName);\n      }\n      return Object.assign({}, state, {\n        history,\n        routeNames,\n        routes,\n        index\n      });\n    },\n    getStateForRouteFocus(state, key) {\n      const index = state.routes.findIndex(r => r.key === key);\n      if (index === -1 || index === state.index) {\n        return state;\n      }\n      return changeIndex(state, index, backBehavior, initialRouteName);\n    },\n    getStateForAction(state, action, {\n      routeParamList,\n      routeGetIdList\n    }) {\n      switch (action.type) {\n        case 'JUMP_TO':\n        case 'NAVIGATE':\n        case 'NAVIGATE_DEPRECATED':\n          {\n            const index = state.routes.findIndex(route => route.name === action.payload.name);\n            if (index === -1) {\n              return null;\n            }\n            const updatedState = changeIndex(Object.assign({}, state, {\n              routes: state.routes.map(route => {\n                if (route.name !== action.payload.name) {\n                  return route;\n                }\n                const getId = routeGetIdList[route.name];\n                const currentId = getId?.({\n                  params: route.params\n                });\n                const nextId = getId?.({\n                  params: action.payload.params\n                });\n                const key = currentId === nextId ? route.key : `${route.name}-${nanoid()}`;\n                let params;\n                if ((action.type === 'NAVIGATE' || action.type === 'NAVIGATE_DEPRECATED') && action.payload.merge && currentId === nextId) {\n                  params = action.payload.params !== undefined || routeParamList[route.name] !== undefined ? Object.assign({}, routeParamList[route.name], route.params, action.payload.params) : route.params;\n                } else {\n                  params = routeParamList[route.name] !== undefined ? Object.assign({}, routeParamList[route.name], action.payload.params) : action.payload.params;\n                }\n                const path = action.type === 'NAVIGATE' && action.payload.path != null ? action.payload.path : route.path;\n                return params !== route.params || path !== route.path ? Object.assign({}, route, {\n                  key,\n                  path,\n                  params\n                }) : route;\n              })\n            }), index, backBehavior, initialRouteName);\n            return Object.assign({}, updatedState, {\n              preloadedRouteKeys: updatedState.preloadedRouteKeys.filter(key => key !== state.routes[updatedState.index].key)\n            });\n          }\n        case 'GO_BACK':\n          {\n            if (state.history.length === 1) {\n              return null;\n            }\n            const previousKey = state.history[state.history.length - 2]?.key;\n            const index = state.routes.findLastIndex(route => route.key === previousKey);\n            if (index === -1) {\n              return null;\n            }\n            return Object.assign({}, state, {\n              preloadedRouteKeys: state.preloadedRouteKeys.filter(key => key !== state.routes[index].key),\n              history: state.history.slice(0, -1),\n              index\n            });\n          }\n        case 'PRELOAD':\n          {\n            const routeIndex = state.routes.findIndex(route => route.name === action.payload.name);\n            if (routeIndex === -1) {\n              return null;\n            }\n            const route = state.routes[routeIndex];\n            const getId = routeGetIdList[route.name];\n            const currentId = getId?.({\n              params: route.params\n            });\n            const nextId = getId?.({\n              params: action.payload.params\n            });\n            const key = currentId === nextId ? route.key : `${route.name}-${nanoid()}`;\n            const params = action.payload.params !== undefined || routeParamList[route.name] !== undefined ? Object.assign({}, routeParamList[route.name], action.payload.params) : undefined;\n            const newRoute = params !== route.params ? Object.assign({}, route, {\n              key,\n              params\n            }) : route;\n            return Object.assign({}, state, {\n              preloadedRouteKeys: state.preloadedRouteKeys.filter(key => key !== route.key).concat(newRoute.key),\n              routes: state.routes.map((route, index) => index === routeIndex ? newRoute : route),\n              history: key === route.key ? state.history : state.history.filter(record => record.key !== route.key)\n            });\n          }\n        default:\n          return BaseRouter.getStateForAction(state, action);\n      }\n    },\n    actionCreators: TabActions\n  });\n  return router;\n}","map":{"version":3,"names":["nanoid","BaseRouter","TYPE_ROUTE","TabActions","jumpTo","name","params","type","payload","getRouteHistory","routes","index","backBehavior","initialRouteName","history","key","initialRouteIndex","i","unshift","findIndex","route","changeIndex","state","currentRouteKey","filter","it","lastHistoryRouteItemIndex","findLastIndex","item","slice","concat","Object","assign","TabRouter","router","getInitialState","routeNames","routeParamList","undefined","includes","indexOf","map","stale","preloadedRouteKeys","getRehydratedState","partialState","find","r","Math","min","max","length","routeKeys","getStateForRouteNamesChange","routeKeyChanges","getStateForRouteFocus","getStateForAction","action","routeGetIdList","updatedState","getId","currentId","nextId","merge","path","previousKey","routeIndex","newRoute","record","actionCreators"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/@react-navigation/routers/src/TabRouter.tsx"],"sourcesContent":["import { nanoid } from 'nanoid/non-secure';\n\nimport { BaseRouter } from './BaseRouter';\nimport type {\n  CommonNavigationAction,\n  DefaultRouterOptions,\n  NavigationState,\n  ParamListBase,\n  PartialState,\n  Route,\n  Router,\n} from './types';\n\nexport type TabActionType = {\n  type: 'JUMP_TO';\n  payload: { name: string; params?: object };\n  source?: string;\n  target?: string;\n};\n\nexport type BackBehavior =\n  | 'firstRoute'\n  | 'initialRoute'\n  | 'order'\n  | 'history'\n  | 'fullHistory'\n  | 'none';\n\nexport type TabRouterOptions = DefaultRouterOptions & {\n  /**\n   * Control how going back should behave\n   * - `firstRoute` - return to the first defined route\n   * - `initialRoute` - return to the route from `initialRouteName`\n   * - `order` - return to the route defined before the focused route\n   * - `history` - return to last visited route; if the same route is visited multiple times, the older entries are dropped from the history\n   * - `fullHistory` - return to last visited route; doesn't drop duplicate entries unlike `history` - matches behavior of web pages\n   * - `none` - do not handle going back\n   */\n  backBehavior?: BackBehavior;\n};\n\nexport type TabNavigationState<ParamList extends ParamListBase> = Omit<\n  NavigationState<ParamList>,\n  'history'\n> & {\n  /**\n   * Type of the router, in this case, it's tab.\n   */\n  type: 'tab';\n  /**\n   * List of previously visited route keys.\n   */\n  history: { type: 'route'; key: string }[];\n  /**\n   * List of routes' key, which are supposed to be preloaded before navigating to.\n   */\n  preloadedRouteKeys: string[];\n};\n\nexport type TabActionHelpers<ParamList extends ParamListBase> = {\n  /**\n   * Jump to an existing tab.\n   *\n   * @param screen Name of the route to jump to.\n   * @param [params] Params object for the route.\n   */\n  jumpTo<RouteName extends keyof ParamList>(\n    ...args: RouteName extends unknown\n      ? undefined extends ParamList[RouteName]\n        ? [screen: RouteName, params?: ParamList[RouteName]]\n        : [screen: RouteName, params: ParamList[RouteName]]\n      : never\n  ): void;\n};\n\nconst TYPE_ROUTE = 'route' as const;\n\nexport const TabActions = {\n  jumpTo(name: string, params?: object) {\n    return {\n      type: 'JUMP_TO',\n      payload: { name, params },\n    } as const satisfies TabActionType;\n  },\n};\n\nconst getRouteHistory = (\n  routes: Route<string>[],\n  index: number,\n  backBehavior: BackBehavior,\n  initialRouteName: string | undefined\n) => {\n  const history = [{ type: TYPE_ROUTE, key: routes[index].key }];\n  let initialRouteIndex;\n\n  switch (backBehavior) {\n    case 'order':\n      for (let i = index; i > 0; i--) {\n        history.unshift({ type: TYPE_ROUTE, key: routes[i - 1].key });\n      }\n      break;\n    case 'firstRoute':\n      if (index !== 0) {\n        history.unshift({\n          type: TYPE_ROUTE,\n          key: routes[0].key,\n        });\n      }\n      break;\n    case 'initialRoute':\n      initialRouteIndex = routes.findIndex(\n        (route) => route.name === initialRouteName\n      );\n      initialRouteIndex = initialRouteIndex === -1 ? 0 : initialRouteIndex;\n\n      if (index !== initialRouteIndex) {\n        history.unshift({\n          type: TYPE_ROUTE,\n          key: routes[initialRouteIndex].key,\n        });\n      }\n      break;\n    case 'history':\n    case 'fullHistory':\n      // The history will fill up on navigation\n      break;\n  }\n\n  return history;\n};\n\nconst changeIndex = (\n  state: TabNavigationState<ParamListBase>,\n  index: number,\n  backBehavior: BackBehavior,\n  initialRouteName: string | undefined\n) => {\n  let history = state.history;\n\n  if (backBehavior === 'history' || backBehavior === 'fullHistory') {\n    const currentRouteKey = state.routes[index].key;\n\n    if (backBehavior === 'history') {\n      // Remove the existing key from the history to de-duplicate it\n      history = history.filter((it) =>\n        it.type === 'route' ? it.key !== currentRouteKey : false\n      );\n    } else if (backBehavior === 'fullHistory') {\n      const lastHistoryRouteItemIndex = history.findLastIndex(\n        (item) => item.type === 'route'\n      );\n\n      if (currentRouteKey === history[lastHistoryRouteItemIndex]?.key) {\n        // For full-history, only remove if it matches the last route\n        // Useful for drawer, if current route was in history, then drawer state changed\n        // Then we only need to move the route to the front\n        history = [\n          ...history.slice(0, lastHistoryRouteItemIndex),\n          ...history.slice(lastHistoryRouteItemIndex + 1),\n        ];\n      }\n    }\n\n    history = history.concat({\n      type: TYPE_ROUTE,\n      key: currentRouteKey,\n    });\n  } else {\n    history = getRouteHistory(\n      state.routes,\n      index,\n      backBehavior,\n      initialRouteName\n    );\n  }\n\n  return {\n    ...state,\n    index,\n    history,\n  };\n};\n\nexport function TabRouter({\n  initialRouteName,\n  backBehavior = 'firstRoute',\n}: TabRouterOptions) {\n  const router: Router<\n    TabNavigationState<ParamListBase>,\n    TabActionType | CommonNavigationAction\n  > = {\n    ...BaseRouter,\n\n    type: 'tab',\n\n    getInitialState({ routeNames, routeParamList }) {\n      const index =\n        initialRouteName !== undefined && routeNames.includes(initialRouteName)\n          ? routeNames.indexOf(initialRouteName)\n          : 0;\n\n      const routes = routeNames.map((name) => ({\n        name,\n        key: `${name}-${nanoid()}`,\n        params: routeParamList[name],\n      }));\n\n      const history = getRouteHistory(\n        routes,\n        index,\n        backBehavior,\n        initialRouteName\n      );\n\n      return {\n        stale: false,\n        type: 'tab',\n        key: `tab-${nanoid()}`,\n        index,\n        routeNames,\n        history,\n        routes,\n        preloadedRouteKeys: [],\n      };\n    },\n\n    getRehydratedState(partialState, { routeNames, routeParamList }) {\n      const state = partialState;\n\n      if (state.stale === false) {\n        return state;\n      }\n\n      const routes = routeNames.map((name) => {\n        const route = (\n          state as PartialState<TabNavigationState<ParamListBase>>\n        ).routes.find((r) => r.name === name);\n\n        return {\n          ...route,\n          name,\n          key:\n            route && route.name === name && route.key\n              ? route.key\n              : `${name}-${nanoid()}`,\n          params:\n            routeParamList[name] !== undefined\n              ? {\n                  ...routeParamList[name],\n                  ...(route ? route.params : undefined),\n                }\n              : route\n                ? route.params\n                : undefined,\n        } as Route<string>;\n      });\n\n      const index = Math.min(\n        Math.max(routeNames.indexOf(state.routes[state?.index ?? 0]?.name), 0),\n        routes.length - 1\n      );\n\n      const routeKeys = routes.map((route) => route.key);\n\n      const history =\n        state.history?.filter((it) => routeKeys.includes(it.key)) ?? [];\n\n      return changeIndex(\n        {\n          stale: false,\n          type: 'tab',\n          key: `tab-${nanoid()}`,\n          index,\n          routeNames,\n          history,\n          routes,\n          preloadedRouteKeys:\n            state.preloadedRouteKeys?.filter((key) =>\n              routeKeys.includes(key)\n            ) ?? [],\n        },\n        index,\n        backBehavior,\n        initialRouteName\n      );\n    },\n\n    getStateForRouteNamesChange(\n      state,\n      { routeNames, routeParamList, routeKeyChanges }\n    ) {\n      const routes = routeNames.map(\n        (name) =>\n          state.routes.find(\n            (r) => r.name === name && !routeKeyChanges.includes(r.name)\n          ) || {\n            name,\n            key: `${name}-${nanoid()}`,\n            params: routeParamList[name],\n          }\n      );\n\n      const index = Math.max(\n        0,\n        routeNames.indexOf(state.routes[state.index].name)\n      );\n\n      let history = state.history.filter(\n        // Type will always be 'route' for tabs, but could be different in a router extending this (e.g. drawer)\n        (it) => it.type !== 'route' || routes.find((r) => r.key === it.key)\n      );\n\n      if (!history.length) {\n        history = getRouteHistory(\n          routes,\n          index,\n          backBehavior,\n          initialRouteName\n        );\n      }\n\n      return {\n        ...state,\n        history,\n        routeNames,\n        routes,\n        index,\n      };\n    },\n\n    getStateForRouteFocus(state, key) {\n      const index = state.routes.findIndex((r) => r.key === key);\n\n      if (index === -1 || index === state.index) {\n        return state;\n      }\n\n      return changeIndex(state, index, backBehavior, initialRouteName);\n    },\n\n    getStateForAction(state, action, { routeParamList, routeGetIdList }) {\n      switch (action.type) {\n        case 'JUMP_TO':\n        case 'NAVIGATE':\n        case 'NAVIGATE_DEPRECATED': {\n          const index = state.routes.findIndex(\n            (route) => route.name === action.payload.name\n          );\n\n          if (index === -1) {\n            return null;\n          }\n\n          const updatedState = changeIndex(\n            {\n              ...state,\n              routes: state.routes.map((route) => {\n                if (route.name !== action.payload.name) {\n                  return route;\n                }\n\n                const getId = routeGetIdList[route.name];\n\n                const currentId = getId?.({ params: route.params });\n                const nextId = getId?.({ params: action.payload.params });\n\n                const key =\n                  currentId === nextId\n                    ? route.key\n                    : `${route.name}-${nanoid()}`;\n\n                let params;\n\n                if (\n                  (action.type === 'NAVIGATE' ||\n                    action.type === 'NAVIGATE_DEPRECATED') &&\n                  action.payload.merge &&\n                  currentId === nextId\n                ) {\n                  params =\n                    action.payload.params !== undefined ||\n                    routeParamList[route.name] !== undefined\n                      ? {\n                          ...routeParamList[route.name],\n                          ...route.params,\n                          ...action.payload.params,\n                        }\n                      : route.params;\n                } else {\n                  params =\n                    routeParamList[route.name] !== undefined\n                      ? {\n                          ...routeParamList[route.name],\n                          ...action.payload.params,\n                        }\n                      : action.payload.params;\n                }\n\n                const path =\n                  action.type === 'NAVIGATE' && action.payload.path != null\n                    ? action.payload.path\n                    : route.path;\n\n                return params !== route.params || path !== route.path\n                  ? { ...route, key, path, params }\n                  : route;\n              }),\n            },\n            index,\n            backBehavior,\n            initialRouteName\n          );\n\n          return {\n            ...updatedState,\n            preloadedRouteKeys: updatedState.preloadedRouteKeys.filter(\n              (key) => key !== state.routes[updatedState.index].key\n            ),\n          };\n        }\n\n        case 'GO_BACK': {\n          if (state.history.length === 1) {\n            return null;\n          }\n\n          const previousKey = state.history[state.history.length - 2]?.key;\n          const index = state.routes.findLastIndex(\n            (route) => route.key === previousKey\n          );\n\n          if (index === -1) {\n            return null;\n          }\n\n          return {\n            ...state,\n            preloadedRouteKeys: state.preloadedRouteKeys.filter(\n              (key) => key !== state.routes[index].key\n            ),\n            history: state.history.slice(0, -1),\n            index,\n          };\n        }\n\n        case 'PRELOAD': {\n          const routeIndex = state.routes.findIndex(\n            (route) => route.name === action.payload.name\n          );\n\n          if (routeIndex === -1) {\n            return null;\n          }\n\n          const route = state.routes[routeIndex];\n\n          const getId = routeGetIdList[route.name];\n\n          const currentId = getId?.({ params: route.params });\n          const nextId = getId?.({ params: action.payload.params });\n\n          const key =\n            currentId === nextId ? route.key : `${route.name}-${nanoid()}`;\n\n          const params =\n            action.payload.params !== undefined ||\n            routeParamList[route.name] !== undefined\n              ? {\n                  ...routeParamList[route.name],\n                  ...action.payload.params,\n                }\n              : undefined;\n\n          const newRoute =\n            params !== route.params ? { ...route, key, params } : route;\n\n          return {\n            ...state,\n            preloadedRouteKeys: state.preloadedRouteKeys\n              .filter((key) => key !== route.key)\n              .concat(newRoute.key),\n            routes: state.routes.map((route, index) =>\n              index === routeIndex ? newRoute : route\n            ),\n            history:\n              key === route.key\n                ? state.history\n                : state.history.filter((record) => record.key !== route.key),\n          };\n        }\n\n        default:\n          return BaseRouter.getStateForAction(state, action);\n      }\n    },\n\n    actionCreators: TabActions,\n  };\n\n  return router;\n}\n"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,mBAAmB;AAE1C,SAASC,UAAU;AAyEnB,MAAMC,UAAU,GAAG,OAAgB;AAEnC,OAAO,MAAMC,UAAU,GAAG;EACxBC,MAAMA,CAACC,IAAY,EAAEC,MAAe,EAAE;IACpC,OAAO;MACLC,IAAI,EAAE,SAAS;MACfC,OAAO,EAAE;QAAEH,IAAI;QAAEC;MAAO;IAC1B,CAAC;EACH;AACF,CAAC;AAED,MAAMG,eAAe,GAAGA,CACtBC,MAAuB,EACvBC,KAAa,EACbC,YAA0B,EAC1BC,gBAAoC,KACjC;EACH,MAAMC,OAAO,GAAG,CAAC;IAAEP,IAAI,EAAEL,UAAU;IAAEa,GAAG,EAAEL,MAAM,CAACC,KAAK,CAAC,CAACI;EAAI,CAAC,CAAC;EAC9D,IAAIC,iBAAiB;EAErB,QAAQJ,YAAY;IAClB,KAAK,OAAO;MACV,KAAK,IAAIK,CAAC,GAAGN,KAAK,EAAEM,CAAC,GAAG,CAAC,EAAEA,CAAC,EAAE,EAAE;QAC9BH,OAAO,CAACI,OAAO,CAAC;UAAEX,IAAI,EAAEL,UAAU;UAAEa,GAAG,EAAEL,MAAM,CAACO,CAAC,GAAG,CAAC,CAAC,CAACF;QAAI,CAAC,CAAC;MAC/D;MACA;IACF,KAAK,YAAY;MACf,IAAIJ,KAAK,KAAK,CAAC,EAAE;QACfG,OAAO,CAACI,OAAO,CAAC;UACdX,IAAI,EAAEL,UAAU;UAChBa,GAAG,EAAEL,MAAM,CAA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