import{top as t,left as e,right as o,end as i,bottom as r}from"../enums.js";import s from"../dom-utils/getOffsetParent.js";import a from"../dom-utils/getWindow.js";import p from"../dom-utils/getDocumentElement.js";import n from"../dom-utils/getComputedStyle.js";import l from"../utils/getBasePlacement.js";import f from"../utils/getVariation.js";import{round as m}from"../utils/math.js";var c={top:"auto",right:"auto",bottom:"auto",left:"auto"};function d(l){var f,d=l.popper,u=l.popperRect,v=l.placement,g=l.variation,y=l.offsets,h=l.position,x=l.gpuAcceleration,b=l.adaptive,w=l.roundOffsets,O=l.isFixed,j=y.x,S=void 0===j?0:j,D=y.y,P=void 0===D?0:D,V="function"==typeof w?w({x:S,y:P}):{x:S,y:P};S=V.x,P=V.y;var C=y.hasOwnProperty("x"),W=y.hasOwnProperty("y"),R=e,A=t,E=window;if(b){var F=s(d),H="clientHeight",N="clientWidth";if(F===a(d)&&(F=p(d),"static"!==n(F).position&&"absolute"===h&&(H="scrollHeight",N="scrollWidth")),v===t||(v===e||v===o)&&g===i)A=r,P-=(O&&F===E&&E.visualViewport?E.visualViewport.height:F[H])-u.height,P*=x?1:-1;if(v===e||(v===t||v===r)&&g===i)R=o,S-=(O&&F===E&&E.visualViewport?E.visualViewport.width:F[N])-u.width,S*=x?1:-1}var k,B=Object.assign({position:h},b&&c),_=!0===w?function(t,e){var o=t.x,i=t.y,r=e.devicePixelRatio||1;return{x:m(o*r)/r||0,y:m(i*r)/r||0}}({x:S,y:P},a(d)):{x:S,y:P};return S=_.x,P=_.y,x?Object.assign({},B,((k={})[A]=W?"0":"",k[R]=C?"0":"",k.transform=(E.devicePixelRatio||1)<=1?"translate("+S+"px, "+P+"px)":"translate3d("+S+"px, "+P+"px, 0)",k)):Object.assign({},B,((f={})[A]=W?P+"px":"",f[R]=C?S+"px":"",f.transform="",f))}var u={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,o=t.options,i=o.gpuAcceleration,r=void 0===i||i,s=o.adaptive,a=void 0===s||s,p=o.roundOffsets,m=void 0===p||p;if("production"!==process.env.NODE_ENV){var c=n(e.elements.popper).transitionProperty||"";a&&["transform","top","right","bottom","left"].some((function(t){return c.indexOf(t)>=0}))&&console.warn(["Popper: Detected CSS transitions on at least one of the following",'CSS properties: "transform", "top", "right", "bottom", "left".',"\n\n",'Disable the "computeStyles" modifier\'s `adaptive` option to allow',"for smooth transitions, or remove these properties from the CSS","transition declaration on the popper element if only transitioning","opacity or background-color for example.","\n\n","We recommend using the popper element as a wrapper around an inner","element that can have any CSS property transitioned for animations."].join(" "))}var u={placement:l(e.placement),variation:f(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,d(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:m})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,d(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:m})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}};export{u as default,d as mapToStyles};
//# sourceMappingURL=computeStyles.js.map
