"use strict";var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react/jsx-runtime"),i=require("react"),r=require("@material-ui/core"),o=require("@material-ui/icons"),l=require("../MiddleTruncate/MiddleTruncate.js"),a=require("../../utils/main.js"),n=require("./icons/SubjectIcon.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=s(e),u=r.makeStyles((function(e){return{chipRoot:{position:"relative",height:30,padding:"7px 12px",fontSize:12,color:e.palette.primary.text6,margin:"2px 4px","&:hover":{cursor:"pointer",backgroundColor:"rgba(255, 255, 255, 0.1)",color:e.palette.primary.contrastText}},root:{width:"100%",display:"flex",alignItems:"center"},label:{padding:0},mark:{marginRight:4,width:8,height:8,borderRadius:8},subject:{display:"flex",marginRight:4},closeIcon:{fontSize:"1rem",marginLeft:"4px"},closeArea:{position:"absolute",top:0,right:0,width:32,height:30},tooltip:{marginTop:"8px"},titleContainer:{display:"flex",alignItems:"center"}}})),d=function(e){var s=e.title,d=e.onClick,p=e.markColor,m=e.isSubject,h=e.rigName,x=e.maxWidth,g=e.wellId,f=e.onRemoveOffsetWell,j=e.isShowMark,b=i.useState(null),k=c.default(b,2),C=k[0],v=k[1],y=u({isShowMark:j}),S=!!C,T=h?"".concat(s," | ").concat(h):s,q=p||"#".concat(a.default.getColorFromString(s)),N=t.jsxs("div",{className:y.root,children:[t.jsx(r.Tooltip,{title:S?T:null!=h?h:"",classes:{popper:y.tooltip},children:t.jsxs("div",{className:y.titleContainer,children:[m?t.jsx("span",{className:y.subject,children:t.jsx(n,{})}):t.jsx("span",{style:{backgroundColor:q,display:j?"block":"none"},className:y.mark}),t.jsx(l,{onTruncate:function(e){v(e)},truncatedText:C,maxWidth:x,children:s})]})}),!m&&!!f&&t.jsxs(t.Fragment,{children:[t.jsx(o.Close,{className:y.closeIcon}),t.jsx(r.Tooltip,{title:"Remove",classes:{popper:y.tooltip},children:t.jsx("div",{className:y.closeArea,onClick:function(e){e.stopPropagation(),f&&f(g)}})})]})]});return t.jsx(r.Chip,{"data-not-migrated-MuiChip":!0,variant:"outlined",size:"medium",label:N,classes:{root:y.chipRoot,label:y.label},onClick:function(e){return d&&d(e,g)},"data-testid":"".concat(s,"_offsetWellChip")})};d.defaultProps={onClick:null,markColor:null,maxWidth:200,rigName:null,isShowMark:!0,onRemoveOffsetWell:null},module.exports=d;
//# sourceMappingURL=Chip.js.map
