"use strict";var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),r=require("prop-types"),i=require("@material-ui/core"),o=require("@material-ui/icons"),l=require("./AutoCompleteAssetSearch/AutoCompleteAssetSearch.js"),a=require("react/jsx-runtime");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=n(e),c=n(r),p=i.makeStyles((function(e){return{searchInput:{fontSize:"16px",width:"270px","&:hover":{"&::before":{borderBottom:"2px solid ".concat(e.palette.primary.text1," !important")}},"&:hover $searchIcon":{fill:"".concat(e.palette.primary.text1," !important")}},searchIcon:{fill:"".concat(e.palette.primary.text6," !important"),fontSize:"24px !important"},paper:{background:e.palette.background.b9,overflow:"hidden"},dialogTitle:{padding:"16px",height:"60px"},titleWrapper:{display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"20px"},title:{fontSize:"20px"},dialogContent:{display:"flex",width:"100%",height:"100%",flexFlow:"row wrap",alignContent:"flex-start",padding:0,justifyContent:"space-between",overflow:"hidden"},closeIcon:{color:e.palette.primary.text6}}}));function d(e){var r=e.company,n=e.onClickAsset,c=e.isTablet,d=e.isMobile,u=p(),h=t.useState(null),m=s.default(h,2),f=m[0],x=m[1],b=function(){x(null)},g=function(e){var t=e.redirectAssetId;t&&(n(t),b())};return a.jsxs(a.Fragment,{children:[a.jsx(i.TextField,{type:"text",id:"well-section-search-textfield",placeholder:!c&&d?"Well/Rig Search":"Add to List by Well/Rig Search",InputProps:{startAdornment:a.jsx(i.InputAdornment,{position:"start",children:a.jsx(o.Search,{className:u.searchIcon})}),className:u.searchInput},onClick:function(e){x(e.currentTarget)}}),(c||!d)&&a.jsx(i.Popover,{open:Boolean(f),anchorEl:f,onClose:b,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:a.jsx(l,{company:r,onClickAsset:g,onClose:b,isTablet:c,isMobile:d})}),!c&&d&&a.jsxs(i.Dialog,{fullScreen:!0,open:Boolean(f),classes:{paper:u.paper},children:[a.jsx(i.DialogTitle,{className:u.dialogTitle,children:a.jsxs("div",{className:u.titleWrapper,children:[a.jsx(i.Typography,{className:u.title,children:"Search"}),a.jsx(o.Close,{className:u.closeIcon,onClick:b})]})}),a.jsx(i.DialogContent,{className:u.dialogContent,children:a.jsx(l,{company:r,onClickAsset:g,onClose:b,isTablet:c,isMobile:d})})]})]})}d.propTypes={company:c.default.number.isRequired,onClickAsset:c.default.func.isRequired,isTablet:c.default.bool.isRequired,isMobile:c.default.bool.isRequired};var u=t.memo(d);module.exports=u;
