const c=`
  min-height:0 !important;
  max-height:none !important;
  height:0 !important;
  visibility:hidden !important;
  overflow:hidden !important;
  position:absolute !important;
  z-index:-1000 !important;
  top:0 !important;
  right:0 !important;
  pointer-events: none !important;
`,f=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break","white-space"],b={};let e;function y(i,g=!1){const o=i.getAttribute("id")||i.getAttribute("data-reactid")||i.getAttribute("name");if(g&&b[o])return b[o];const t=window.getComputedStyle(i),l=t.getPropertyValue("box-sizing")||t.getPropertyValue("-moz-box-sizing")||t.getPropertyValue("-webkit-box-sizing"),p=Number.parseFloat(t.getPropertyValue("padding-bottom"))+Number.parseFloat(t.getPropertyValue("padding-top")),d=Number.parseFloat(t.getPropertyValue("border-bottom-width"))+Number.parseFloat(t.getPropertyValue("border-top-width")),n={sizingStyle:f.map(r=>`${r}:${t.getPropertyValue(r)}`).join(";"),paddingSize:p,borderSize:d,boxSizing:l};return g&&o&&(b[o]=n),n}function x(i,g=!1,o=null,t=null){e||(e=document.createElement("textarea"),e.setAttribute("tab-index","-1"),e.setAttribute("aria-hidden","true"),document.body.appendChild(e)),i.getAttribute("wrap")?e.setAttribute("wrap",i.getAttribute("wrap")):e.removeAttribute("wrap");const{paddingSize:l,borderSize:p,boxSizing:d,sizingStyle:u}=y(i,g);e.setAttribute("style",`${u};${c}`),e.value=i.value||i.placeholder||"";let n,r,h,a=e.scrollHeight;if(d==="border-box"?a+=p:d==="content-box"&&(a-=l),o!==null||t!==null){e.value=" ";const m=e.scrollHeight-l;o!==null&&(n=m*o,d==="border-box"&&(n=n+l+p),a=Math.max(n,a)),t!==null&&(r=m*t,d==="border-box"&&(r=r+l+p),h=a>r?"":"hidden",a=Math.min(r,a))}const s={height:`${a}px`,overflowY:h,resize:"none"};return n&&(s.minHeight=`${n}px`),r&&(s.maxHeight=`${r}px`),s}export{y as calculateNodeStyling,x as default};
