import{jsxs as o,Fragment as s,jsx as n}from"react/jsx-runtime";import{useRef as c,useState as i,useEffect as t,Children as e,isValidElement as r,cloneElement as m}from"react";import l from"classnames";import p from"../Button/components/Button/index.js";import"moment-timezone";import"@material-ui/core";import{CloseIcon as a}from"../../icons/iconParkIcons.js";import"../../icons/customIcons/icons/AddMessage.js";import"../../icons/customIcons/icons/Attention.js";import"../../icons/customIcons/icons/Collapse.js";import"../../icons/customIcons/icons/Dashboard.js";import"../../icons/customIcons/icons/Expand.js";import"../../icons/customIcons/icons/FolderClosed.js";import"../../icons/customIcons/icons/FolderClosedFilled.js";import"../../icons/customIcons/icons/FolderOpened.js";import"../../icons/customIcons/icons/GreaterOrEqual.js";import"../../icons/customIcons/icons/LessOrEqual.js";import"../../icons/customIcons/icons/Search.js";import"../../icons/customIcons/icons/Wellhub.js";import"../../icons/customIcons/icons/MultiRuler.js";import"../../icons/customIcons/icons/Checkbox.js";import"../../icons/customIcons/icons/CheckboxChecked.js";import"../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../icons/customIcons/icons/Radio.js";import"../../icons/customIcons/icons/RadioChecked.js";import"../../icons/customIcons/icons/SimulFrac.js";import"../../icons/customIcons/icons/ZipperFrac.js";import"../../icons/customIcons/icons/CautionFilled.js";import"../../icons/customIcons/icons/MoreApp.js";import"../Button/components/LiveButton/components/LiveButtonStateIndicator/index.js";import"../Button/components/LiveButton/styles.js";import{Regular14 as u}from"../Typography.js";import{Popper as d}from"../Popper/Popper.js";import j from"../IconButton/index.js";import{useStyles as h}from"./styles.js";var I=function(I){var f=h(),C=c(),x=i(),b=x[0],v=x[1],k=i(),B=k[0],E=k[1];if(t((function(){setTimeout((function(){return E(I.open?I.anchorEl||C.current:void 0)}),100)})),!I.anchorEl&&e.count(I.children)>1)throw new Error("Hint expects a single reffable element as a child");var N=I.anchorEl?I.children:e.map(I.children,(function(o){return r(o)?m(o,{ref:C}):o}));return o(s,{children:[N,o(d,{className:l(f.popper,I.className),transition:!0,open:!!B,anchorEl:B,placement:I.placement,modifiers:{flip:{enabled:!0},arrow:{enabled:!!b,element:b}},children:[n("div",{ref:v,className:f.arrow}),o("div",{className:f.tooltip,children:[I.title&&n("span",{className:l(f.title,I.onClose&&f.hasClose),children:I.title}),I.onClose&&n(j,{onClick:I.onClose,className:f.close,size:"small",children:n(a,{})}),I.content&&n(u,{className:f.content,children:I.content}),I.onConfirm&&n(p,{color:"inherit",className:f.button,onClick:I.onConfirm,children:I.confirmText||"Got It"})]})]})]})};export{I as Hint};
