"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=`
  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;
`,y=["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"],s={};let e;function m(i,p=!1){const o=i.getAttribute("id")||i.getAttribute("data-reactid")||i.getAttribute("name");if(p&&s[o])return s[o];const t=window.getComputedStyle(i),l=t.getPropertyValue("box-sizing")||t.getPropertyValue("-moz-box-sizing")||t.getPropertyValue("-webkit-box-sizing"),g=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:y.map(r=>`${r}:${t.getPropertyValue(r)}`).join(";"),paddingSize:g,borderSize:d,boxSizing:l};return p&&o&&(s[o]=n),n}function S(i,p=!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:g,boxSizing:d,sizingStyle:b}=m(i,p);e.setAttribute("style",`${b};${f}`),e.value=i.value||i.placeholder||"";let n,r,h,a=e.scrollHeight;if(d==="border-box"?a+=g:d==="content-box"&&(a-=l),o!==null||t!==null){e.value=" ";const c=e.scrollHeight-l;o!==null&&(n=c*o,d==="border-box"&&(n=n+l+g),a=Math.max(n,a)),t!==null&&(r=c*t,d==="border-box"&&(r=r+l+g),h=a>r?"":"hidden",a=Math.min(r,a))}const u={height:`${a}px`,overflowY:h,resize:"none"};return n&&(u.minHeight=`${n}px`),r&&(u.maxHeight=`${r}px`),u}exports.calculateNodeStyling=m;exports.default=S;
