/*! jQuery UI Virtual Keyboard Virtual Caret v1.1.5 (beta) */ !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&"object"==typeof module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var t=e.keyboard;t.firefox=void 0!==window.mozInnerScreenX,e.extend(t.css,{caret:"ui-keyboard-caret",caretMirror:"ui-keyboard-mirror-div"}),e.fn.addCaret=function(r){var i={caretClass:"",charAttr:"data-character",charIndex:1,offsetX:0,offsetY:0,adjustHt:0};return this.each(function(){var o,n,a=t.events,s=e(this).data("keyboard");s&&(o=s.caret_options=e.extend({},i,r),n=s.caret_namespace=s.namespace+"caret",s.extensionNamespace.push(n),s.textareaCaretProperties=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"],s.caret_setup=function(){var r=t.css,i="keyup keypress mouseup mouseleave ".split(" ").join(n+" "),d="position:absolute;visibility:hidden;top:-9999em;left:-9999em;white-space:pre-wrap;z-index:-10;"+("INPUT"===s.preview.nodeName?"":"word-wrap:break-word;");s.$keyboard.find("."+r.caretMirror).remove(),s.caret_$div=e('
').appendTo(s.$keyboard),s.$caret&&s.$caret.remove(),s.$caret=e('
').insertAfter(s.$preview),s.$el.unbind(a.kbChange+n).bind(a.kbChange+n,function(){s.findCaretPos()}),s.$preview.unbind(i).bind(i,function(){s.findCaretPos()})},s.findCaretPos=function(){if(s.caret_$div){var r,i,n,a,d,c,p,l,f=s.preview,u=parseFloat(s.$preview.css("fontSize")),b="INPUT"===f.nodeName,h=s.caret_$div[0];r=h.style,i=window.getComputedStyle?getComputedStyle(f,null):f.currentStyle,a=t.caret(s.$preview),d=Math["ltr"===i.direction?"max":"min"](a.start,a.end),s.textareaCaretProperties.forEach(function(e){r[e]=i[e]}),t.firefox&&(r.width=parseInt(i.width,10)-2+"px",f.scrollHeight>parseInt(i.height,10)&&(r.overflowY="scroll")),r.width=parseInt(b?f.scrollWidth:i.width,10)+(b?2*u:0)+"px",h.textContent=f.value.substring(0,d),"INPUT"===f.nodeName&&(h.textContent=h.textContent.replace(/\x20/g," ")),(p=document.createElement("span")).textContent=f.value.substring(d)||"​",h.appendChild(p),l=e(p).position(),a="center"===r.textAlign?u:0,s.caretPos={top:l.top+parseInt(i.borderTopWidth,10)+o.offsetY,left:l.left+parseInt(i.borderLeftWidth,10)+o.offsetX-a},n=parseInt(s.$caret.css("margin-top"),10),r=Math.round(u+2*n)+o.adjustHt,l=s.$preview.position(),s.$caret.css({top:l.top-f.scrollTop+s.caretPos.top-n,left:l.left-f.scrollLeft+s.caretPos.left,height:r}),c=f.value.substring(d,d+o.charIndex).replace(/\s/," ")||" ",s.$caret.attr(o.charAttr,c)}},s.$el.unbind(n).bind(a.kbBeforeVisible+n,function(){s.caret_setup()}).bind(a.kbVisible+n,function(){s.findCaretPos()}).bind(a.kbHidden+n,function(){var e="keyup keypress mouseup mouseleave ".split(" ").join(n+" ");s.$preview.unbind(e),s.$caret.remove(),s.$caret=null,s.caret_$div=null}),s.options.alwaysOpen&&s.isVisible()&&(s.caret_setup(),s.findCaretPos()))})}});