import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/slicedToArray";import{useState as r,useEffect as n}from"react";import{makeStyles as o,Tooltip as i,IconButton as a}from"@material-ui/core";import{LockOutlined as c,ReplayOutlined as l}from"@material-ui/icons";import{jsxs as s,jsx as u}from"react/jsx-runtime";function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function d(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?p(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var m=o((function(e){return{root:{display:"flex"},assetEditorWrapper:{width:"100%"},iconButtonWrapper:{height:36,marginTop:10,marginLeft:16},iconButton:{color:e.palette.primary.text6,width:36,height:36,"&:hover":{backgroundColor:e.palette.background.b7}}}})),f=function(e){return function(o){var p=m(),f=o.onChangeEditorField,b=o.onSettingsChange,h=r(!0),g=t(h,2),O=g[0],y=g[1],j=r(!0),v=t(j,2),w=v[0],P=v[1],k=function(){f("assetId",null),f("replacedAssetId",null),f("replacedAssetTime",null)},A=function(){b({rigId:null,wellId:null})};n((function(){w||P(!0)}),[w]);var B=O?c:l;return s("div",{className:p.root,children:[u(i,{title:O?"This app is using current dashboard asset.":"",placement:"bottom",children:u("div",{className:p.assetEditorWrapper,children:w&&u(e,d(d({},o),{},{disabled:O}))})}),u(i,{title:O?"Unlock Asset":"Return default",placement:"bottom",children:u("div",{className:p.iconButtonWrapper,children:u(a,{className:p.iconButton,"data-testid":"".concat(O?"UnlockAsset":"ReturnDefault","_IconButton"),onClick:function(){var e=!O;(y(e),e)&&((f?k:A)(),P(!1))},children:u(B,{})})})})]})}};export{f as default};
//# sourceMappingURL=withAssetEditorLockHOC.js.map
