/**
 * Minified by jsDelivr using Terser v5.19.2.
 * Original file: /npm/textarea-caret-position@0.1.1/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
var properties=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing"];function CaretCoordinates(e){var t=this;this.element=e,this.div=document.createElement("div"),e.parentNode.insertBefore(this.div,e);var i=this.div.style;this.computed=window.getComputedStyle?getComputedStyle(e):e.currentStyle,i.whiteSpace="pre-wrap","INPUT"!==e.nodeName&&(i.wordWrap="break-word"),i.position="absolute",i.visibility="hidden",properties.forEach((function(e){i[e]=t.computed[e]})),i.overflow="hidden",this.divText=document.createTextNode(""),this.div.appendChild(this.divText),this.span=document.createElement("span"),this.spanText=document.createTextNode(""),this.span.appendChild(this.spanText),this.div.appendChild(this.span),window.addEventListener("resize",(function(){i.width=t.computed.width}))}CaretCoordinates.prototype.get=function(e,t){this.divText.nodeValue=this.element.value.substring(0,e),"INPUT"===this.element.nodeName&&(this.divText.nodeValue=this.divText.nodeValue.replace(/\s/g," ")),this.spanText.nodeValue=this.element.value.substring(e)||".";var i=this.span.offsetLeft+parseInt(this.computed.borderLeftWidth,10);this.divText.nodeValue=this.element.value.substring(0,t),"INPUT"===this.element.nodeName&&(this.divText.nodeValue=this.divText.nodeValue.replace(/\s/g," ")),this.spanText.nodeValue=this.element.value.substring(t)||".";var d=this.span.offsetLeft+parseInt(this.computed.borderLeftWidth,10);return d<=i&&(d=this.div.offsetWidth+parseInt(this.computed.borderLeftWidth,10)),{top:this.span.offsetTop+parseInt(this.computed.borderTopWidth,10),left:i,right:d}},module.exports=CaretCoordinates;
//# sourceMappingURL=/sm/b4ed10c271029238157f2da02f159dd61fed1efe3c69babfea1595b5dee7b9e5.map