"use strict";var e=require("react/jsx-runtime"),o=require("react"),s=require("prop-types"),i=require("classnames"),n=require("@material-ui/core"),t=require("@material-ui/icons"),c=require("../IconButton/index.js"),r=require("../../icons/iconParkIcons.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/Attention.js"),require("../../icons/customIcons/icons/Collapse.js"),require("../../icons/customIcons/icons/Dashboard.js"),require("../../icons/customIcons/icons/Expand.js"),require("../../icons/customIcons/icons/FolderClosed.js"),require("../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../icons/customIcons/icons/FolderOpened.js"),require("../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../icons/customIcons/icons/LessOrEqual.js"),require("../../icons/customIcons/icons/Search.js"),require("../../icons/customIcons/icons/Wellhub.js"),require("../../icons/customIcons/icons/MultiRuler.js"),require("../../icons/customIcons/icons/Checkbox.js"),require("../../icons/customIcons/icons/CheckboxChecked.js"),require("../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../icons/customIcons/icons/Radio.js"),require("../../icons/customIcons/icons/RadioChecked.js"),require("../../icons/customIcons/icons/SimulFrac.js"),require("../../icons/customIcons/icons/ZipperFrac.js"),require("../../icons/customIcons/icons/CautionFilled.js"),require("../../icons/customIcons/icons/MoreApp.js");var l=a(s),u=a(i),d=n.makeStyles((function(e){var o=e.palette;return{disabled:{opacity:.4,pointerEvents:"none"},offsetContainer:{cursor:"pointer",display:"flex",whiteSpace:"nowrap",flexWrap:"nowrap",alignItems:"center",width:"fit-content"},hoveredContainer:{backgroundColor:"rgba(255, 255, 255, 0.16)",color:o.primary.light},offsetText:{color:o.primary.text6,fontSize:12,paddingRight:4,"&:hover":{color:o.primary.contrastText}},buttons:{display:"flex",alignItems:"center"},isActive:{color:o.primary.contrastText},primaryIcon:{"&:hover":{backgroundColor:"rgba(255, 255, 255, 0.16)"}},infoIcon:{marginRight:"8px",fontSize:"20px",color:o.info.light},infoTooltip:{maxWidth:"264px"}}})),p=function(s){var i=s.onClick,a=s.wells,l=s.label,p=s.disabled,f=s.expanded,m=s.onExpand,x=s.offsetWellsLimited,I=s.isTooltipDisabled,j=s.iconElement,q=o.useState(!1),b=q[0],h=q[1],g=d(),C=a.length,y=!(!C||!m),v=e.jsxs("div",{"data-testid":"offsetWellsButton",className:u.default(g.offsetContainer,p&&g.disabled),onClick:i,onMouseMove:function(e){var o=e.target,s=o.parentNode;o.getAttribute("data-icon")||s.getAttribute("data-icon")?h(!1):h(!0)},onMouseLeave:function(){h(!1)},children:[e.jsxs(n.Typography,{className:u.default(g.offsetText,b&&g.isActive),children:[l," (",C,")"]}),e.jsx(c,{className:u.default(g.primaryIcon,b&&g.hoveredContainer),color:"primary",size:"medium",children:j||e.jsx(r.WriteIcon,{size:24})})]});return e.jsxs("div",{className:g.buttons,children:[x&&e.jsx(n.Tooltip,{title:"".concat(l," list wasn't populated completely due to technical limitations of the app."),classes:{tooltip:g.infoTooltip},children:e.jsx(t.Info,{className:g.infoIcon})}),e.jsx(n.Tooltip,{title:"Edit ".concat(l),placement:"bottom",children:v}),y&&e.jsx(c,{"data-testid":"expandOffsetWellChipsTabButton",tooltipProps:!I&&{title:f?"Collapse ".concat(l):"Expand ".concat(l)},onClick:function(e){e.stopPropagation(),m()},color:"default",size:"medium","data-icon":"expandIcon",children:f?e.jsx(r.UpIcon,{"data-icon":"expandIcon"}):e.jsx(r.DownIcon,{"data-icon":"expandIcon"})})]})},f={onClick:l.default.func.isRequired,wells:l.default.arrayOf(l.default.shape({id:l.default.number,title:l.default.string})),label:l.default.string,disabled:l.default.bool,onExpand:l.default.func,expanded:l.default.bool,offsetWellsLimited:l.default.bool,isTooltipDisabled:l.default.bool,iconElement:l.default.node};p.propTypes=f,p.defaultProps={onExpand:null,expanded:!1,wells:[],disabled:!1,offsetWellsLimited:!1,isTooltipDisabled:!1,label:"Offset Wells",iconElement:null},module.exports=p;
