/*! For license information please see tooltip.js.LICENSE.txt */
!function(){var t={93967:function(t,e){var i;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var t="",e=0;e<arguments.length;e++){var i=arguments[e];i&&(t=a(t,r(i)))}return t}function r(t){if("string"==typeof t||"number"==typeof t)return t;if("object"!=typeof t)return"";if(Array.isArray(t))return o.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var e="";for(var i in t)n.call(t,i)&&t[i]&&(e=a(e,i));return e}function a(t,e){return e?t?t+" "+e:t+e:t}t.exports?(o.default=o,t.exports=o):void 0===(i=function(){return o}.apply(e,[]))||(t.exports=i)}()}},e={};function i(n){var o=e[n];if(void 0!==o)return o.exports;var r=e[n]={exports:{}};return t[n](r,r.exports,i),r.exports}i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,{a:e}),e},i.d=function(t,e){for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};!function(){"use strict";i.r(n),i.d(n,{Tooltip:function(){return l},TooltipContainer:function(){return g}});var t=window.vendor.React,e=i.n(t),o=window.divi.data,r=window.vendor.ReactDOM,a=i(93967),p=i.n(a),d=window.lodash,s=window.divi.window;const c=({position:t,target:e,tooltip:i,verticalDistance:n=10,horizontalDistance:o=10,windowWidth:r,appWindowMarginLeft:a=0,appWindowMarginTop:p=0,appWindowMarginRight:d=0,windowLocation:s})=>{const[c,l]=t.split("-");let u=(({verticalPosition:t,target:e,tooltip:i,distance:n=10})=>{switch(t){case"top":return e.top-(i.height+n);case"center":return e.top+e.height/2-i.height/2;case"bottom":return e.top+(e.height+n);default:return 0}})({verticalPosition:c,target:e,tooltip:i,distance:n}),g=(({horizontalPosition:t,target:e,tooltip:i,distance:n=10})=>{switch(t){case"left":return e.left-i.width-n;case"center":return e.left+e.width/2-i.width/2;case"right":return e.left+e.width+n;default:return 0}})({horizontalPosition:l,target:e,tooltip:i,distance:o});const w=g+i.width,f="app"===s?-a:0,h="app"===s?r+d:r;return g<f?g=f:w>h&&(g-=Math.ceil(w-h)),"app"===s&&(u+=p,g+=a),{top:u,left:g}},l=({children:i,id:n,delay:o=700,position:a="top-center",windowLocation:l="auto",className:u="",verticalDistance:g=10,horizontalDistance:w=10,appWindowMarginLeft:f=0,appWindowMarginTop:h=0,appWindowMarginRight:v=0,visible:m=!1,setVisible:b})=>{const y=(0,t.useRef)(null),M=(0,t.useRef)({}),T=""!==u,[W,L]=(0,t.useState)({top:0,left:0});return(0,t.useEffect)((()=>{let t;const e=(0,s.getWindow)(l),i=e.document.querySelector(`[data-tooltip-id="${n}"]`),r=()=>{const n=e.etVbTooltipIsHiding?0:o;e.etVbTooltipIsHiding=!1,t=setTimeout((()=>{const t=i.getBoundingClientRect();M.current={position:a,target:{top:t?.top,left:t?.left,width:t?.width,height:t?.height},tooltip:{width:y?.current?.clientWidth,height:y?.current?.clientHeight},verticalDistance:g,horizontalDistance:w,windowWidth:e?.innerWidth,appWindowMarginLeft:f,appWindowMarginTop:h,appWindowMarginRight:v,windowLocation:l},b(!0),L(c(M.current))}),n)},p=()=>{clearTimeout(t),b(!1),clearTimeout(e.etVbTooltipIsHidingTimeout),e.etVbTooltipIsHiding=!0,e.etVbTooltipIsHidingTimeout=setTimeout((()=>{e.etVbTooltipIsHiding=!1}),1e3)};return i&&(i.addEventListener("mouseenter",r),i.addEventListener("mouseleave",p)),()=>{clearTimeout(t),i&&(i.removeEventListener("mouseenter",r),i.removeEventListener("mouseleave",p))}}),[]),(0,t.useEffect)((()=>{(0,d.isEmpty)(M.current)||L(c({...M.current,appWindowMarginLeft:f,appWindowMarginTop:h}))}),[f,h,m]),(0,r.createPortal)(e().createElement("span",{ref:y,className:p()({"et-vb-tooltip":!0,"et-vb-tooltip--visible":m,[`et-vb-tooltip-position--${a}`]:!0,[`${u}`]:T}),style:W},i),(0,s.topWindowPortalDomTarget)())},u=(0,t.memo)(l),g=({children:e,id:i,delay:n=700,position:r="top-center",windowLocation:a="auto",className:p="",verticalDistance:d=10,horizontalDistance:s=10})=>{const[c,l]=(0,t.useState)(!1),{appWindowMarginLeft:g,appWindowMarginTop:w,appWindowMarginRight:f}=(0,o.useSelect)((t=>{const e=t("divi/app-ui")?.getElementProperty({elementName:"sidebarRight",propertyGroup:"dimension",propertyName:"width"})??0,i=t("divi/app-ui")?.getAppFrameMarginLeft()??"0",n=t("divi/app-ui")?.getAppFrameMarginTop()??"0";return{appWindowMarginLeft:parseInt(i),appWindowMarginTop:parseInt(n),appWindowMarginRight:e}}));return(0,t.createElement)(u,{id:i,delay:n,position:r,windowLocation:a,className:p,verticalDistance:d,horizontalDistance:s,appWindowMarginLeft:g,appWindowMarginTop:w,appWindowMarginRight:f,visible:c,setVisible:l},e)}}(),(window.divi=window.divi||{}).tooltip=n}();