var d=new Map;function H(o){var n=d.get(o);n&&n.destroy()}function L(o){var n=d.get(o);n&&n.update()}var u=null;typeof window>"u"?((u=function(o){return o}).destroy=function(o){return o},u.update=function(o){return o}):((u=function(o,n){return o&&Array.prototype.forEach.call(o.length?o:[o],function(m){return function(e){if(e&&e.nodeName&&e.nodeName==="TEXTAREA"&&!d.has(e)){var c,y=null,t=window.getComputedStyle(e),g=(c=e.value,function(){v({testForHeightReduction:c===""||!e.value.startsWith(c),restoreTextAlign:null}),c=e.value}),p=function(a){e.removeEventListener("autosize:destroy",p),e.removeEventListener("autosize:update",i),e.removeEventListener("input",g),window.removeEventListener("resize",i),Object.keys(a).forEach(function(l){return e.style[l]=a[l]}),d.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,textAlign:e.style.textAlign,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",p),e.addEventListener("autosize:update",i),e.addEventListener("input",g),window.addEventListener("resize",i),e.style.overflowX="hidden",e.style.wordWrap="break-word",d.set(e,{destroy:p,update:i}),i()}function v(a){var l,s,w=a.restoreTextAlign,f=w===void 0?null:w,E=a.testForHeightReduction,b=E===void 0||E,T=t.overflowY;if(e.scrollHeight!==0&&(t.resize==="vertical"?e.style.resize="none":t.resize==="both"&&(e.style.resize="horizontal"),b&&(l=function(r){for(var z=[];r&&r.parentNode&&r.parentNode instanceof Element;)r.parentNode.scrollTop&&z.push([r.parentNode,r.parentNode.scrollTop]),r=r.parentNode;return function(){return z.forEach(function(A){var h=A[0],F=A[1];h.style.scrollBehavior="auto",h.scrollTop=F,h.style.scrollBehavior=null})}}(e),e.style.height=""),s=t.boxSizing==="content-box"?e.scrollHeight-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):e.scrollHeight+parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),t.maxHeight!=="none"&&s>parseFloat(t.maxHeight)?(t.overflowY==="hidden"&&(e.style.overflow="scroll"),s=parseFloat(t.maxHeight)):t.overflowY!=="hidden"&&(e.style.overflow="hidden"),e.style.height=s+"px",f&&(e.style.textAlign=f),l&&l(),y!==s&&(e.dispatchEvent(new Event("autosize:resized",{bubbles:!0})),y=s),T!==t.overflow&&!f)){var x=t.textAlign;t.overflow==="hidden"&&(e.style.textAlign=x==="start"?"end":"start"),v({restoreTextAlign:x,testForHeightReduction:!0})}}function i(){v({testForHeightReduction:!0,restoreTextAlign:null})}}(m)}),o}).destroy=function(o){return o&&Array.prototype.forEach.call(o.length?o:[o],H),o},u.update=function(o){return o&&Array.prototype.forEach.call(o.length?o:[o],L),o});var N=u,W=N;export{W as default};
