text: "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("react-loading-skeleton");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=n(e),r=n(t);function o(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&a.firstChild?a.insertBefore(r,a.firstChild):a.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}o("/* common */\n.Container {\n  text-align: left;\n  background-color: white;\n  display: flex;\n  flex-direction: column;\n  border-radius: 7px;\n  border: 1px solid #ccc;\n  color: black;\n  transition: 0.3s all ease;\n  height: fit-content; }\n  .Container:hover {\n    background-color: #fafafa !important;\n    cursor: pointer; }\n\n.Secondary {\n  color: #646464; }\n\n.LowerContainer {\n  padding: 10px; }\n\n.Title {\n  margin-top: 0;\n  margin-bottom: 10px; }\n\n.Image {\n  width: 100%;\n  border-top-left-radius: 7px;\n  border-top-right-radius: 7px;\n  background-size: cover;\n  background-repeat: no-repeat;\n  background-position: center;\n  height: 30vh; }\n\n.SiteDetails {\n  margin-top: 10px; }\n\n/* sm */\n@media (max-width: 640px) {\n  .Description {\n    display: none; } }\n\n/* md */\n@media (min-width: 641px) and (max-width: 768px) {\n  .Description {\n    display: none; } }\n");o(".skeleton-container {\n  border-radius: 7px;\n  border: 1px solid #eee; }\n\n.skeleton-lower-container {\n  padding: 10px; }\n");var i=function(e){var t=e.width,n=void 0===t?"100%":t,o=e.imageHeight,i=void 0===o?"30vh":o,l=e.margin;return a.default.createElement("div",{className:"skeleton-container",style:{width:n,margin:l}},a.default.createElement(r.default,{width:n,height:i}),a.default.createElement("div",{className:"skeleton-lower-container"},a.default.createElement(r.default,{count:3})))};exports.LinkPreview=function(t){var n=t.url,r=t.className,o=void 0===r?"":r,l=t.width,d=t.height,c=t.descriptionLength,s=t.borderRadius,u=t.imageHeight,m=t.textAlign,f=t.margin,h=t.fallback,p=void 0===h?null:h,g=t.backgroundColor,v=void 0===g?"white":g,b=t.primaryTextColor,x=void 0===b?"black":b,y=t.secondaryTextColor,w=void 0===y?"rgb(100, 100, 100)":y,k=t.borderColor,E=void 0===k?"#ccc":k,C=t.showLoader,N=void 0===C||C,S=t.customLoader,T=void 0===S?null:S,L=e.useRef(!0),R=e.useState(),D=R[0],j=R[1],A=e.useState(!0),H=A[0],I=A[1];if(e.useEffect((function(){return L.current=!0,I(!0),fetch("http://localhost:8080/v2?url="+n).then((function(e){return e.json()})).then((function(e){L.current&&(j(e.metadata),I(!1))})).catch((function(e){console.error(e),console.error("No metadata could be found for the given URL."),L.current&&(j(null),I(!1))})),function(){L.current=!1}}),[n]),H&&N)return T?a.default.createElement(a.default.Fragment,null,T):a.default.createElement(i,{width:l,imageHeight:u,margin:f});if(!D)return a.default.createElement(a.default.Fragment,null,p);var _=D.image,q=D.description,B=D.title,F=D.siteName,P=D.hostname;return a.default.createElement("div",{"data-testid":"container",onClick:function(){window.open(n,"_blank")},className:"Container "+o,style:{width:l,height:d,borderRadius:s,textAlign:m,margin:f,backgroundColor:v,borderColor:E}},a.default.createElement("div",{"data-testid":"image-container",style:{borderTopLeftRadius:s,borderTopRightRadius:s,backgroundImage:"url("+_+")",height:u},className:"Image"}),a.default.createElement("div",{className:"LowerContainer"},a.default.createElement("h3",{"data-testid":"title",className:"Title",style:{color:x}},B),q&&a.default.createElement("span",{"data-testid":"desc",className:"Description Secondary",style:{color:w}},c&&q.length>c?q.slice(0,c)+"...":q),a.default.createElement("div",{className:"Secondary SiteDetails",style:{color:w}},F&&a.default.createElement("span",null,F," • "),a.default.createElement("span",null,P))))};
  //# sourceMappingURL=index.js.map
  