text: "use strict";
  
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  
  var _react = _interopRequireDefault(require("react"));
  
  var _reactTypography = require("react-typography");
  
  var _typographyPluginCacheEndpoint = _interopRequireDefault(require("typography-plugin-cache-endpoint"));
  
  exports.onRenderBody = function (_ref, pluginOptions) {
    var setHeadComponents = _ref.setHeadComponents;
    var googleFont = [].concat(pluginOptions.omitGoogleFont ? [] : /*#__PURE__*/_react.default.createElement(_reactTypography.GoogleFont, {
      key: "GoogleFont",
      typography: _typographyPluginCacheEndpoint.default
    }));
    setHeadComponents([/*#__PURE__*/_react.default.createElement(_reactTypography.TypographyStyle, {
      key: "TypographyStyle",
      typography: _typographyPluginCacheEndpoint.default
    })].concat(googleFont));
  }; // Move Typography.js styles to the top of the head section so they're loaded first
  // and don't accidentally overwrite other styles. Typography.js is meant to
  // be a configurable CSS reset so should always load first.
  
  
  exports.onPreRenderHTML = function (_ref2) {
    var getHeadComponents = _ref2.getHeadComponents,
        replaceHeadComponents = _ref2.replaceHeadComponents;
    var headComponents = getHeadComponents();
    headComponents.sort(function (x, y) {
      if (x && x.key === "TypographyStyle") {
        return -1;
      } else if (y && y.key === "TypographyStyle") {
        return 1;
      }
  
      return 0;
    });
    replaceHeadComponents(headComponents);
  };