"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3977],{337598:function(e,t,n){n.d(t,{u:function(){return m}});var r=n(487462),o=n(263366),u=n(667294),i=n(973935),c=n(33703),l=n(574161),s=n(39336),a=n(573546),f=n(785893);const d=["onChange","maxRows","minRows","style","value"];function h(e){return parseInt(e,10)||0}const v={visibility:"hidden",position:"absolute",overflow:"hidden",height:0,top:0,left:0,transform:"translateZ(0)"};function w(e){return void 0===e||null===e||0===Object.keys(e).length||0===e.outerHeightStyle&&!e.overflow}const m=u.forwardRef((function(e,t){const{onChange:n,maxRows:m,minRows:y=1,style:g,value:p}=e,b=(0,o.Z)(e,d),{current:Z}=u.useRef(null!=p),x=u.useRef(null),S=(0,c.Z)(t,x),R=u.useRef(null),H=u.useRef(0),[E,C]=u.useState({outerHeightStyle:0}),k=u.useCallback((()=>{const t=x.current,n=(0,l.Z)(t).getComputedStyle(t);if("0px"===n.width)return{outerHeightStyle:0};const r=R.current;r.style.width=n.width,r.value=t.value||e.placeholder||"x","\n"===r.value.slice(-1)&&(r.value+=" ");const o=n.boxSizing,u=h(n.paddingBottom)+h(n.paddingTop),i=h(n.borderBottomWidth)+h(n.borderTopWidth),c=r.scrollHeight;r.value="x";const s=r.scrollHeight;let a=c;y&&(a=Math.max(Number(y)*s,a)),m&&(a=Math.min(Number(m)*s,a)),a=Math.max(a,s);return{outerHeightStyle:a+("border-box"===o?u+i:0),overflow:Math.abs(a-c)<=1}}),[m,y,e.placeholder]),M=(e,t)=>{const{outerHeightStyle:n,overflow:r}=t;return H.current<20&&(n>0&&Math.abs((e.outerHeightStyle||0)-n)>1||e.overflow!==r)?(H.current+=1,{overflow:r,outerHeightStyle:n}):e},N=u.useCallback((()=>{const e=k();w(e)||C((t=>M(t,e)))}),[k]);u.useEffect((()=>{const e=(0,s.Z)((()=>{H.current=0,x.current&&(()=>{const e=k();w(e)||i.flushSync((()=>{C((t=>M(t,e)))}))})()}));let t;const n=x.current,r=(0,l.Z)(n);return r.addEventListener("resize",e),"undefined"!==typeof ResizeObserver&&(t=new ResizeObserver(e),t.observe(n)),()=>{e.clear(),r.removeEventListener("resize",e),t&&t.disconnect()}})),(0,a.Z)((()=>{N()})),u.useEffect((()=>{H.current=0}),[p]);return(0,f.jsxs)(u.Fragment,{children:[(0,f.jsx)("textarea",(0,r.Z)({value:p,onChange:e=>{H.current=0,Z||N(),n&&n(e)},ref:S,rows:y,style:(0,r.Z)({height:E.outerHeightStyle,overflow:E.overflow?"hidden":void 0},g)},b)),(0,f.jsx)("textarea",{"aria-hidden":!0,className:e.className,readOnly:!0,ref:R,tabIndex:-1,style:(0,r.Z)({},v,g,{paddingTop:0,paddingBottom:0})})]})}))},283977:function(e,t,n){n.r(t),n.d(t,{default:function(){return r.u}});var r=n(337598)},39336:function(e,t,n){function r(e,t=166){let n;function r(...r){clearTimeout(n),n=setTimeout((()=>{e.apply(this,r)}),t)}return r.clear=()=>{clearTimeout(n)},r}n.d(t,{Z:function(){return r}})},382690:function(e,t,n){function r(e){return e&&e.ownerDocument||document}n.d(t,{Z:function(){return r}})},574161:function(e,t,n){n.d(t,{Z:function(){return o}});var r=n(382690);function o(e){return(0,r.Z)(e).defaultView||window}},407960:function(e,t,n){function r(e,t){"function"===typeof e?e(t):e&&(e.current=t)}n.d(t,{Z:function(){return r}})},573546:function(e,t,n){var r=n(667294);const o="undefined"!==typeof window?r.useLayoutEffect:r.useEffect;t.Z=o},33703:function(e,t,n){n.d(t,{Z:function(){return u}});var r=n(667294),o=n(407960);function u(...e){return r.useMemo((()=>e.every((e=>null==e))?null:t=>{e.forEach((e=>{(0,o.Z)(e,t)}))}),e)}}}]);