"use strict";

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

var _react = _interopRequireDefault(require("react"));

var _facebook = _interopRequireDefault(require("../../assets/images/facebook-58.png"));

var _twitter = _interopRequireDefault(require("../../assets/images/twitter.png"));

var _gmail = _interopRequireDefault(require("../../assets/images/gmail.png"));

var _youtube = _interopRequireDefault(require("../../assets/images/youtube-64.png"));

var _instagram = _interopRequireDefault(require("../../assets/images/instagram.png"));

var _linkedin = _interopRequireDefault(require("../../assets/images/linkedin.png"));

var _userAvatar = _interopRequireDefault(require("../../assets/images/user-avatar.png"));

var _lodash = _interopRequireDefault(require("lodash"));

var _svgs = require("../../svgs");

require("lazysizes");

require("lazysizes/plugins/parent-fit/ls.parent-fit");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var BlogSideBar = function BlogSideBar(props) {
  return /*#__PURE__*/_react["default"].createElement("aside", {
    className: "blog-sidebar"
  }, props.children);
};

var AuthorPage = function AuthorPage(props) {
  var data = props.data;
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "blog-widget"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "author-widget"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "author-info"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "author-img"
  }, /*#__PURE__*/_react["default"].createElement("img", {
    src: data.profileImageUrl || _userAvatar["default"],
    alt: "Jason Miller"
  })), /*#__PURE__*/_react["default"].createElement("div", {
    className: "author-name"
  }, /*#__PURE__*/_react["default"].createElement("h2", null, "Author"), /*#__PURE__*/_react["default"].createElement("h3", null, data.firstName, " ", data.lastName))), /*#__PURE__*/_react["default"].createElement("div", {
    className: "author-bio"
  }, data.bio), props.links && /*#__PURE__*/_react["default"].createElement(SocialWidget, {
    links: props.links
  })));
};

var ReletedBlogs = function ReletedBlogs(props) {
  var blogs = props.blogs,
      Skeleton = props.Skeleton,
      loading = props.loading;

  var blogSeklton = function blogSeklton() {
    return [1, 2, 3].map(function (item) {
      return /*#__PURE__*/_react["default"].createElement("div", {
        key: item,
        "class": "col-sm-6 col-md-4 col-lg-4"
      }, /*#__PURE__*/_react["default"].createElement("div", {
        "class": "card"
      }, /*#__PURE__*/_react["default"].createElement(Skeleton, {
        rectangle: true,
        height: 200,
        width: '100%'
      }), /*#__PURE__*/_react["default"].createElement("div", {
        "class": "card-block"
      }, /*#__PURE__*/_react["default"].createElement("div", {
        className: "wizrd-recent-blog-tag"
      }, /*#__PURE__*/_react["default"].createElement(Skeleton, {
        count: 1
      })), /*#__PURE__*/_react["default"].createElement("h5", {
        "class": ""
      }, /*#__PURE__*/_react["default"].createElement(Skeleton, {
        count: 4
      })), /*#__PURE__*/_react["default"].createElement("div", {
        className: "wizrd-recent-blog-author"
      }, /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement(Skeleton, {
        width: 100,
        count: 1
      })), /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement(Skeleton, {
        width: 100,
        count: 1
      }))))));
    });
  };

  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "wizrd-recent-blog-wrap related-article"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "container"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "wizrd-recent-blogs"
  }, /*#__PURE__*/_react["default"].createElement("h3", null, !loading ? 'Related article' : /*#__PURE__*/_react["default"].createElement(Skeleton, {
    width: 200,
    count: 1
  }), " "), /*#__PURE__*/_react["default"].createElement("div", {
    className: "row"
  }, loading && blogSeklton(), blogs.map(function (item, index) {
    return /*#__PURE__*/_react["default"].createElement("div", {
      key: index,
      "class": "col-sm-6 col-md-4 col-lg-4"
    }, /*#__PURE__*/_react["default"].createElement("div", {
      "class": "card"
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: "card-image"
    }, /*#__PURE__*/_react["default"].createElement("img", {
      "data-sizes": "auto",
      "data-src": "https://picsum.photos/200/150/?random",
      "data-srcset": " https://picsum.photos/200/150/?random 600w, https://picsum.photos/200/150/?random 220w, https://picsum.photos/200/150/?random 300w, https://picsum.photos/200/150/?random 600w, https://picsum.photos/200/150/?random 900w, ",
      alt: "test".concat(index),
      "class": "lazyload"
    })), /*#__PURE__*/_react["default"].createElement("div", {
      "class": "card-block"
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: "wizrd-recent-blog-tag"
    }), /*#__PURE__*/_react["default"].createElement("h5", {
      "class": ""
    }, "Die Hard is a 1988 American action film directed by John McTiernan and written by"), /*#__PURE__*/_react["default"].createElement("div", {
      className: "wizrd-recent-blog-author"
    }, /*#__PURE__*/_react["default"].createElement("span", null, "Emil Kristensin"), /*#__PURE__*/_react["default"].createElement("span", null, "March  09, 2021")))));
  })))));
};

var TopBlogs = function TopBlogs(props) {
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "blog-widget"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "top-wizrd-blog-article-widget"
  }, props.children));
};

var SocialWidget = function SocialWidget(props) {
  var assessment = props.assessment,
      blog = props.blog;
  var url = "https://".concat((assessment === null || assessment === void 0 ? void 0 : assessment.customDomain) || (assessment === null || assessment === void 0 ? void 0 : assessment.domain));
  var arr = ['facebook', 'twitter', 'linkedin', 'email'];
  var SHARING_URLS = {
    'facebook': 'https://www.facebook.com/sharer/sharer.php?u=',
    'linkedin': 'https://www.linkedin.com/sharing/share-offsite/?url=',
    'twitter': 'https://twitter.com/intent/tweet/?url=',
    'email': function email(subject, body) {
      return "mailto:?subject=".concat(subject, "&body=").concat(body);
    }
  };

  var displayEmail = function displayEmail(blog, url) {
    return ('Hello, \n' || JSON.stringify(blog.content)) + "".concat(url, "/blog/").concat(blog === null || blog === void 0 ? void 0 : blog.slug);
  };

  var displayUrl = function displayUrl(item) {
    switch (item) {
      case 'facebook':
        return "".concat(SHARING_URLS[item]).concat(url, "/blog/").concat(blog === null || blog === void 0 ? void 0 : blog.slug, "&display=page");

      case 'linkedin':
        return "".concat(SHARING_URLS[item]).concat(url, "/blog/").concat(blog === null || blog === void 0 ? void 0 : blog.slug);

      case 'twitter':
        return "".concat(SHARING_URLS[item]).concat(url, "/blog/").concat(blog === null || blog === void 0 ? void 0 : blog.slug);

      case 'email':
        return "".concat(SHARING_URLS[item](blog === null || blog === void 0 ? void 0 : blog.title, displayEmail(blog, url)));
    }
  };

  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "social-follow-widget"
  }, /*#__PURE__*/_react["default"].createElement("ul", {
    className: "social-media-icons"
  }, arr.map(function (item) {
    return /*#__PURE__*/_react["default"].createElement("li", {
      className: item
    }, /*#__PURE__*/_react["default"].createElement("a", {
      href: displayUrl(item),
      "aria-label": item,
      rel: "noopener noreferrer",
      target: "_blank"
    }, (0, _svgs.svgBWData)()[item]));
  })));
};

BlogSideBar.TopBlogs = TopBlogs;
BlogSideBar.AuthorPage = AuthorPage;
BlogSideBar.ReletedBlogs = ReletedBlogs;
BlogSideBar.SocialWidget = SocialWidget;
var _default = BlogSideBar;
exports["default"] = _default;