(function(w){var e={className:"autosizejs",id:"autosizejs",append:"\n",callback:false,resizeDelay:10,placeholder:true},t='<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; padding: 0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden; transition:none; -webkit-transition:none; -moz-transition:none;"/>',z=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent","whiteSpace"],g,y=w(t).data("autosize",true)[0];y.style.lineHeight="99px";if(w(y).css("lineHeight")==="99px"){z.push("lineHeight")}y.style.lineHeight="";w.fn.autosize=function(p){if(!this.length){return this}p=w.extend({},e,p||{});if(y.parentNode!==document.body){w(document.body).append(y)}return this.each(function(){var s=this,a=w(s),o,i,n=0,r=w.isFunction(p.callback),e={height:s.style.height,overflow:s.style.overflow,overflowY:s.style.overflowY,wordWrap:s.style.wordWrap,resize:s.style.resize},t,l=a.width(),d=a.css("resize");if(a.data("autosize")){return}a.data("autosize",true);if(a.css("box-sizing")==="border-box"||a.css("-moz-box-sizing")==="border-box"||a.css("-webkit-box-sizing")==="border-box"){n=a.outerHeight()-a.height()}i=Math.max(parseFloat(a.css("minHeight"))-n||0,a.height());a.css({overflow:"hidden",overflowY:"hidden",wordWrap:"break-word"});if(d==="vertical"){a.css("resize","none")}else if(d==="both"){a.css("resize","horizontal")}function u(){var i;var o=window.getComputedStyle?window.getComputedStyle(s,null):false;if(o){i=s.getBoundingClientRect().width;if(i===0||typeof i!=="number"){i=parseFloat(o.width)}w.each(["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"],function(e,t){i-=parseFloat(o[t])})}else{i=a.width()}y.style.width=Math.max(i,0)+"px"}function f(){var i={};g=s;y.className=p.className;y.id=p.id;o=parseFloat(a.css("maxHeight"));w.each(z,function(e,t){i[t]=a.css(t)});w(y).css(i).attr("wrap",a.attr("wrap"));u();if(window.chrome){var e=s.style.width;s.style.width="0px";var t=s.offsetWidth;s.style.width=e}}function c(){var e,t;if(g!==s){f()}else{u()}if(!s.value&&p.placeholder){y.value=a.attr("placeholder")||""}else{y.value=s.value}y.value+=p.append||"";y.style.overflowY=s.style.overflowY;t=parseFloat(s.style.height);y.scrollTop=0;y.scrollTop=9e4;e=y.scrollTop;if(o&&e>o){s.style.overflowY="scroll";e=o}else{s.style.overflowY="hidden";if(e<i){e=i}}e+=n;if(t!==e){s.style.height=e+"px";y.className=y.className;if(r){p.callback.call(s,s)}a.trigger("autosize.resized")}}function h(){clearTimeout(t);t=setTimeout(function(){var e=a.width();if(e!==l){l=e;c()}},parseInt(p.resizeDelay,10))}if("onpropertychange"in s){if("oninput"in s){a.on("input.autosize keyup.autosize",c)}else{a.on("propertychange.autosize",function(){if(event.propertyName==="value"){c()}})}}else{a.on("input.autosize",c)}if(p.resizeDelay!==false){w(window).on("resize.autosize",h)}a.on("autosize.resize",c);a.on("autosize.resizeIncludeStyle",function(){g=null;c()});a.on("autosize.destroy",function(){g=null;clearTimeout(t);w(window).off("resize",h);a.off("autosize").off(".autosize").css(e).removeData("autosize")});c()})}})(jQuery||$);