import{useMemo as t}from"react";var e="top",i="bottom",r="top-left",o="top-right",n="bottom-left",h="bottom-right",a={maxWidth:320,estimatedHeight:140,estimatedHeightWithAction:170},f=29,c=18,u=[i,e,n,h,r,o],l=function(l){var s=l.mapRef,d=l.coords,g=l.isSubjectWell,p=l.isViewOnly,m=l.isClickable,b=l.hintsWidth,v=void 0===b?0:b,k=l.hintsHeight,w=void 0===k?0:k;return t((function(){var t=i,l=g?f:c;if(!d||!s.current)return{anchor:t,offset:l};var b=s.current,k=b.getCanvas(),W=k.clientWidth,H=k.clientHeight,x=b.project([d.longitude,d.latitude]),j=x.x,y=x.y,A=!p&&!g&&m?a.estimatedHeightWithAction:a.estimatedHeight,C=a.maxWidth,O=function(t,e){var i=t>0?t+8+8:170;return[{top:0,left:0,width:170,height:50},{top:0,left:-i,width:i,height:e>0?e+8+8:50},{top:-90,left:0,width:90,height:90},{top:-110,left:-110,width:110,height:110}]}(v,w),R=u.find((function(t){var a=function(t,a,f,c,u,l){var s,d;switch(f){case i:s=a-l-u,d=t-c/2;break;case e:s=a+l,d=t-c/2;break;case n:s=a-l-u,d=t;break;case h:s=a-l-u,d=t-c;break;case r:s=a+l,d=t;break;case o:s=a+l,d=t-c;break;default:s=a-l-u,d=t-c/2}return{top:s,left:d,right:d+c,bottom:s+u}}(j,y,t,C,A,l);return function(t,e,i){return t.top>=0&&t.left>=0&&t.right<=e&&t.bottom<=i}(a,W,H)&&!function(t,e,i,r){return e.some((function(e){return function(t,e,i,r){var o=e.left>=0?e.left:i+e.left,n=e.top>=0?e.top:r+e.top,h=o+e.width,a=n+e.height;return!(t.right<o||t.left>h||t.bottom<n||t.top>a)}(t,e,i,r)}))}(a,O,W,H)}));return{anchor:null!=R?R:t,offset:l}}),[d,s,g,p,m,v,w])};export{a as TOOLTIP_DIMENSIONS,l as useTooltipAnchor};
//# sourceMappingURL=useTooltipAnchor.js.map
