"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = exports.JSONFormatter = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));

var _standalone = _interopRequireDefault(require("prettier/standalone"));

var _parserBabylon = _interopRequireDefault(require("prettier/parser-babylon"));

var _utils = require("../utils");

var JSONFormatter = /*#__PURE__*/function () {
  function JSONFormatter() {
    (0, _classCallCheck2["default"])(this, JSONFormatter);
  }

  (0, _createClass2["default"])(JSONFormatter, [{
    key: "getFormatted",
    value: function getFormatted(rawText) {
      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : JSONFormatter.defaultOptions;
      var t = rawText;

      try {
        t = _standalone["default"].format(rawText, options);
      } catch (error) {// 
      }

      return t;
    }
  }, {
    key: "getRaw",
    value: function getRaw(formattedText) {
      return (0, _utils.removeUnprintableChar)(formattedText);
    }
  }]);
  return JSONFormatter;
}();

exports.JSONFormatter = JSONFormatter;
JSONFormatter.defaultOptions = {
  parser: 'json',
  plugins: [_parserBabylon["default"]]
};

var _default = new JSONFormatter();

exports["default"] = _default;
//# sourceMappingURL=JSONFormatter.js.map
