"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("moment"),a=require("lodash"),i=require("@material-ui/core"),l=require("@material-ui/icons/ArrowForward"),n=require("../../Tooltip/Tooltip.js");require("../../Tooltip/ScrollableTooltip.js");var s=require("../utils.js"),o=require("../constants.js"),c=require("../../DevCenter/DevCenterRouterContext/UniversalLink/UniversalLink.js"),p=require("../styles.js"),d=require("../../../constants/mixpanel.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=m(r),x=m(l),h=i.makeStyles((function(e){return{errorIcon:{width:20,height:18},title:{maxWidth:198,padding:"0 0 8px",fontSize:16,lineHeight:"22px",color:e.palette.primary.text1,display:"flex",alignItems:"center"},emptyMessage:{padding:"0",fontSize:16,lineHeight:"22px",color:e.palette.primary.contrastText},alertTime:{fontSize:14,color:e.palette.primary.text6,"& span":{color:e.palette.primary.text1}},alertMessage:{width:"100%",height:40,margin:0,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box","-webkit-line-clamp":2,"-webkit-box-orient":"vertical",whiteSpace:"pre-wrap",fontSize:14,lineHeight:"20px",color:e.palette.primary.text1},alertMessageFull:{marginBottom:8,fontSize:14,lineHeight:"20px",color:e.palette.primary.text1,whiteSpace:"pre-wrap"},alertInfo:{display:"flex",alignItems:"center",flexWrap:"wrap",marginBottom:8,fontSize:14,textTransform:"capitalize","& span":{color:e.palette.primary.text6,marginRight:8},"& .error":{color:e.palette.error.main},"& .warning":{color:"#ffa500"}},resolvedInfo:{display:"flex",alignItems:"center",marginBottom:8,color:e.palette.primary.text6,fontSize:14},infoIcon:{color:e.palette.info.main,marginRight:8,fontSize:16},popover:{marginLeft:77,width:270,padding:12,display:"flex",flexDirection:"column",justifyContent:"space-between",backgroundColor:e.palette.background.b9,border:"1px solid ".concat(e.palette.primary.text9),boxShadow:"0px 3px 10px rgba(0, 0, 0, 0.4)",borderRadius:4,zIndex:500,"& .MuiTooltip-tooltip":{backgroundColor:e.palette.background.b10,fontWeight:400,lineHeight:"20px",margin:0}},message:{whiteSpace:"pre-wrap"},note:{marginBottom:4},ok:{color:"#F99500 !important"},good:{color:"".concat(e.palette.warning.light," !important")}}})),g=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"MMM D YYYY, hh:mm A";return e?u.default.unix(e).format(t):null},f=function(e){return u.default.unix(e).format("DD MMM HH:mm (Z)")},j=function(t){var r=t.children,i=h(),l=a.template(r)({timestampFormatter:f}).split("**").map((function(t,r){return r%2==1?e.jsx("b",{children:t}):t}));return e.jsx("span",{className:i.message,children:l})},S=t.memo((function(t){var r,a=t.alert,i=t.alertIcon,l=t.children,m=t.linkToDQPage,u=h(),f=p.useDQUnvalidatedContentStyles({}),S=Math.max(a.statusUpdatedAt,a.lastCheckedAt),v=g(S);return e.jsx(n.Tooltip,{interactive:!0,children:l,PopperProps:{className:u.popover},placement:"right",title:e.jsxs(e.Fragment,{children:[a.emptyMessage&&e.jsx("div",{className:u.emptyMessage,children:a.statusUpdatedAt?g(a.statusUpdatedAt):a.emptyMessage}),!a.emptyMessage&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:u.title,children:[a.name,e.jsx(n.Tooltip,{isFullScreen:!1,title:"Go to Data Quality page",children:e.jsx("div",{children:e.jsx(c.UniversalLink,{className:f.link,href:m,onClick:function(){var e,t;null===(e=(t=window)[Symbol.for("logToMixpanel")])||void 0===e||e.call(t,d.MIXPANEL_ACTION_TYPES.REDIRECT.ASSET_DASHBOARD,{referer:"DQ Badge"})},children:e.jsx(x.default,{className:f.linkIcon})})})})]}),e.jsxs("span",{className:u.alertInfo,children:[e.jsx("span",{children:"Category:"})," ",a.category]}),e.jsxs("span",{className:u.alertInfo,children:[e.jsx("span",{children:"Status:"})," ",a.status]}),e.jsxs("span",{className:u.alertInfo,children:[e.jsx("span",{children:"Error Type:"}),e.jsx("div",{className:u.errorIcon,children:i}),e.jsx("span",{className:a.state===o.ALERT_STATES.issue?o.BADGE_ICON_STATUSES.warning:o.BADGE_ICON_STATUSES.error,children:a.state})]}),e.jsxs("span",{className:u.alertInfo,children:[e.jsx("span",{children:"Score Deduction:"}),e.jsx("span",{className:s.getDeductsFromScoreClass(u,a.deductsFromScore,s.isResolved(a.status)),children:s.getDeductsFromScoreValue(a.deductsFromScore,s.isResolved(a.status))})]}),e.jsxs("div",{className:u.alertMessageFull,children:[a.isThrottled&&e.jsx("b",{children:"[Throttled]: "}),e.jsx(j,{children:a.message})]}),e.jsxs("span",{className:u.alertInfo,children:[e.jsx("span",{className:u.note,children:"Note:"})," ",null!==(r=a.note)&&void 0!==r&&r.length?a.note:"—"]}),e.jsxs("span",{className:u.alertTime,children:["Updated at: ",e.jsx("span",{children:v})]})]})]})})}),(function(e,t){return a.isEqual(e.alert,t.alert)}));exports.DQAlertsTooltip=S;
//# sourceMappingURL=DQAlertsTooltip.js.map
