import{r as a,a6 as W,a7 as F}from"./vendor.e6eaca24.js";var A=a.exports.useLayoutEffect,k=function(r){var t=a.exports.useRef(r);return A(function(){t.current=r}),t},R=function(r,t){if(typeof r=="function"){r(t);return}r.current=t},I=function(r,t){var e=a.exports.useRef();return a.exports.useCallback(function(n){r.current=n,e.current&&R(e.current,null),e.current=t,!!t&&R(t,n)},[t])},w={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},H=function(r){Object.keys(w).forEach(function(t){r.style.setProperty(t,w[t],"important")})},o=null,B=function(r,t){var e=r.scrollHeight;return t.sizingStyle.boxSizing==="border-box"?e+t.borderSize:e-t.paddingSize};function M(i,r,t,e){t===void 0&&(t=1),e===void 0&&(e=1/0),o||(o=document.createElement("textarea"),o.setAttribute("tabindex","-1"),o.setAttribute("aria-hidden","true"),H(o)),o.parentNode===null&&document.body.appendChild(o);var n=i.paddingSize,d=i.borderSize,u=i.sizingStyle,l=u.boxSizing;Object.keys(u).forEach(function(p){var v=p;o.style[v]=u[v]}),H(o),o.value=r;var s=B(o,i);o.value="x";var g=o.scrollHeight-n,h=g*t;l==="border-box"&&(h=h+n+d),s=Math.max(h,s);var c=g*e;return l==="border-box"&&(c=c+n+d),s=Math.min(c,s),[s,g]}var C=function(){},N=function(r,t){return r.reduce(function(e,n){return e[n]=t[n],e},{})},j=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak"],P=!!document.documentElement.currentStyle,_=function(r){var t=window.getComputedStyle(r);if(t===null)return null;var e=N(j,t),n=e.boxSizing;if(n==="")return null;P&&n==="border-box"&&(e.width=parseFloat(e.width)+parseFloat(e.borderRightWidth)+parseFloat(e.borderLeftWidth)+parseFloat(e.paddingRight)+parseFloat(e.paddingLeft)+"px");var d=parseFloat(e.paddingBottom)+parseFloat(e.paddingTop),u=parseFloat(e.borderBottomWidth)+parseFloat(e.borderTopWidth);return{sizingStyle:e,paddingSize:d,borderSize:u}},$=function(r){var t=k(r);a.exports.useLayoutEffect(function(){var e=function(d){t.current(d)};return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}},[])},O=function(r,t){var e=r.cacheMeasurements,n=r.maxRows,d=r.minRows,u=r.onChange,l=u===void 0?C:u,s=r.onHeightChange,g=s===void 0?C:s,h=W(r,["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"]),c=h.value!==void 0,p=a.exports.useRef(null),v=I(p,t),z=a.exports.useRef(0),b=a.exports.useRef(),S=function(){var f=p.current,m=e&&b.current?b.current:_(f);if(!!m){b.current=m;var y=M(m,f.value||f.placeholder||"x",d,n),x=y[0],T=y[1];z.current!==x&&(z.current=x,f.style.setProperty("height",x+"px","important"),g(x,{rowHeight:T}))}},L=function(f){c||S(),l(f)};return a.exports.useLayoutEffect(S),$(S),a.exports.createElement("textarea",F({},h,{onChange:L,ref:v}))},Y=a.exports.forwardRef(O),U=Y;export{U as T};
