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 650 Industries.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport React from 'react';\nimport { ScrollView, StyleSheet, Text, View } from 'react-native';\n\nimport { LogBoxInspectorSection } from './LogBoxInspectorSection';\nimport type { CodeFrame } from '../Data/parseLogBoxLog';\nimport { Ansi } from '../UI/AnsiHighlight';\nimport { LogBoxButton } from '../UI/LogBoxButton';\nimport * as LogBoxStyle from '../UI/LogBoxStyle';\nimport { CODE_FONT } from '../UI/constants';\nimport { formatProjectFilePath } from '../formatProjectFilePath';\nimport openFileInEditor from '../modules/openFileInEditor';\n\ndeclare const process: any;\n\nexport function LogBoxInspectorCodeFrame({ codeFrame }: { codeFrame?: CodeFrame }) {\n  if (codeFrame == null) {\n    return null;\n  }\n\n  function getFileName() {\n    return formatProjectFilePath(process.env.EXPO_PROJECT_ROOT, codeFrame?.fileName);\n  }\n\n  function getLocation() {\n    const location = codeFrame?.location;\n    if (location != null) {\n      return ` (${location.row}:${location.column + 1 /* Code frame columns are zero indexed */})`;\n    }\n\n    return null;\n  }\n\n  return (\n    <LogBoxInspectorSection heading=\"Source\">\n      <View style={styles.box}>\n        <View style={styles.frame}>\n          <ScrollView horizontal>\n            <Ansi style={styles.content} text={codeFrame.content} />\n          </ScrollView>\n        </View>\n        <LogBoxButton\n          backgroundColor={{\n            default: 'transparent',\n            pressed: LogBoxStyle.getBackgroundDarkColor(1),\n          }}\n          style={styles.button}\n          onPress={() => {\n            openFileInEditor(codeFrame.fileName, codeFrame.location?.row ?? 0);\n          }}>\n          <Text style={styles.fileText}>\n            {getFileName()}\n            {getLocation()}\n          </Text>\n        </LogBoxButton>\n      </View>\n    </LogBoxInspectorSection>\n  );\n}\n\nconst styles = StyleSheet.create({\n  box: {\n    backgroundColor: LogBoxStyle.getBackgroundColor(),\n    borderWidth: 1,\n    borderColor: '#323232',\n    marginLeft: 10,\n    marginRight: 10,\n    marginTop: 5,\n    borderRadius: 3,\n  },\n  frame: {\n    padding: 10,\n    borderBottomColor: LogBoxStyle.getTextColor(0.1),\n    borderBottomWidth: 1,\n  },\n  button: {\n    paddingTop: 10,\n    paddingBottom: 10,\n  },\n  content: {\n    color: LogBoxStyle.getTextColor(1),\n    fontSize: 12,\n    includeFontPadding: false,\n    lineHeight: 20,\n    fontFamily: CODE_FONT,\n  },\n  fileText: {\n    userSelect: 'none',\n    color: LogBoxStyle.getTextColor(0.5),\n    textAlign: 'center',\n    flex: 1,\n    fontSize: 16,\n    includeFontPadding: false,\n    fontFamily: CODE_FONT,\n  },\n});\n"]}