var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _reactNative = require("react-native");
var _useSyntaxHighlighter2 = require("../../hooks/useSyntaxHighlighter");
var _typescript = _interopRequireDefault(require("../../vendor/shiki/langs/typescript"));
var _githubDark = _interopRequireDefault(require("../../vendor/shiki/themes/github-dark"));var _jsxRuntime = require("react/jsx-runtime");var _jsxFileName = "/Users/ryan/Sites/rn-shiki/src/components/syntax/SyntaxHighlighter.tsx";










function SyntaxHighlighter(_ref)






{var _this = this;var text = _ref.text,_ref$lang = _ref.lang,lang = _ref$lang === void 0 ? _typescript.default : _ref$lang,_ref$langName = _ref.langName,langName = _ref$langName === void 0 ? 'typescript' : _ref$langName,_ref$theme = _ref.theme,theme = _ref$theme === void 0 ? _githubDark.default : _ref$theme,_ref$themeName = _ref.themeName,themeName = _ref$themeName === void 0 ? 'github-dark' : _ref$themeName,fontSize = _ref.fontSize;
  var _useSyntaxHighlighter = (0, _useSyntaxHighlighter2.useSyntaxHighlighter)({
      text: text,
      lang: lang,
      langName: langName,
      theme: theme,
      themeName: themeName
    }),tokens = _useSyntaxHighlighter.tokens,error = _useSyntaxHighlighter.error,isLoading = _useSyntaxHighlighter.isLoading;

  if (error) {
    return (/*#__PURE__*/
      (0, _jsxRuntime.jsxs)(_reactNative.Text, { style: { color: '#ff6b6b', fontFamily: 'monospace', fontSize: fontSize }, children: ["Error:",

        ' ',
        error] }
      ));

  }

  if (isLoading) {
    return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, { style: { color: '#f8f8f2', fontFamily: 'monospace', fontSize: fontSize }, children: "Loading..." });
  }

  return (/*#__PURE__*/
    (0, _jsxRuntime.jsx)(_reactNative.View, { children:
      tokens.map(function (line, lineIndex) {return (/*#__PURE__*/
          (0, _jsxRuntime.jsxs)(_reactNative.View, { style: { flexDirection: 'row', flexWrap: 'wrap' }, children: [
            line.map(function (token, tokenIndex) {return (/*#__PURE__*/
                (0, _jsxRuntime.jsx)(_reactNative.Text, {

                  style: {
                    color: token.color || '#FFFFFF',
                    fontFamily: 'monospace',
                    fontSize: fontSize,
                    fontStyle: token.fontStyle
                  }, children:

                  token.content.replace(/ /g, "\xA0") }, `${lineIndex}-${tokenIndex}`
                ));}
            ), /*#__PURE__*/
            (0, _jsxRuntime.jsx)(_reactNative.Text, { style: { color: '#FFFFFF', fontFamily: 'monospace', fontSize: fontSize }, children: '\n' })] }, `line-${lineIndex}`
          ));}
      ) }
    ));

}var _default = exports.default =

SyntaxHighlighter;
//# sourceMappingURL=SyntaxHighlighter.js.map