import e from"@babel/runtime/helpers/defineProperty";import{memo as t,useMemo as a}from"react";import i from"prop-types";import{makeStyles as r}from"@material-ui/core";import n from"./icons/Critical.js";import s from"./icons/Major.js";import c from"./icons/Minor.js";import l from"../../../Attachment/index.js";import{convertValue as o}from"../../../../utils/convert.js";import{jsxs as m,jsx as d}from"react/jsx-runtime";function p(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,i)}return a}function u(t){for(var a=1;a<arguments.length;a++){var i=null!=arguments[a]?arguments[a]:{};a%2?p(Object(i),!0).forEach((function(a){e(t,a,i[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):p(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}var h="LessonsLearnedFeedItem",v=r({item:{marginTop:"4px"},itemLabel:{fontWeight:"normal",fontSize:"14px",color:"#BDBDBD",marginRight:"8px"},itemValue:{fontSize:"14px",color:"#FFFFFF"},attachment:{paddingTop:10,width:300}});function f(e){var t,i=e.feedItem,r=v(),p=a((function(){var e,t,a=(null===(e=i.context)||void 0===e||null===(t=e.lessons_learned)||void 0===t?void 0:t.data)||{};return u(u({},a),{},{md_start:o(a.md_start,"length","ft"),tvd_start:o(a.tvd_start,"length","ft")})}),[i]),f=null===(t=i.context)||void 0===t?void 0:t.lessons_learned.attachment;return m("div",{children:[d("div",{className:r.item,children:d("span",{"data-testid":"".concat(h,"_topic"),className:r.itemLabel,children:p.topic})}),m("div",{className:r.item,children:[d("span",{className:r.itemLabel,children:"Event Cause:"}),d("span",{"data-testid":"".concat(h,"_Cause"),className:r.itemValue,children:p.cause})]}),m("div",{className:r.item,style:{display:"flex",alignItems:"center"},children:[d("span",{className:r.itemLabel,children:"Event Severity:"}),d("span",{"data-testid":"".concat(h,"_severityIcon"),children:"Major"===p.severity?d(s,{}):"Critical"===p.severity?d(n,{}):"Minor"===p.severity?d(c,{}):null}),d("span",{"data-testid":"".concat(h,"_Severity"),className:r.itemValue,children:p.severity})]}),m("div",{className:r.item,children:[d("span",{className:r.itemLabel,children:"MD/TVD:"}),m("span",{"data-testid":"".concat(h,"_MD/TVD"),className:r.itemValue,children:[Number.isFinite(p.md_start)?p.md_start.fixFloat(2):"-","/",Number.isFinite(p.tvd_start)?p.tvd_start.fixFloat(2):"-"]})]}),m("div",{className:r.item,children:[d("span",{className:r.itemLabel,children:"Hole Section:"}),d("span",{"data-testid":"".concat(h,"_HoleSection"),className:r.itemValue,children:p.section})]}),m("div",{className:r.item,children:[d("span",{className:r.itemLabel,children:"Operation:"}),d("span",{"data-testid":"".concat(h,"_Operation"),className:r.itemValue,children:p.activity})]}),m("div",{className:r.item,children:[d("span",{className:r.itemLabel,children:"Description:"}),d("div",{"data-testid":"".concat(h,"_Description"),className:r.itemValue,children:p.description})]}),f&&(f.signed_url||f.url||f.name)&&d("div",{className:r.attachment,children:d(l,{small:!0,attachmentUrl:f.signed_url||f.url,fileName:f.name,displayName:f.name})})]})}f.propTypes={feedItem:i.shape().isRequired};var b=t(f);export{b as default};
