(function(){var e={}.hasOwnProperty;window.jQueryAce={initialize:function(e,t){return new(!0===$(e).is("textarea")?jQueryAce.TextareaEditor:jQueryAce.BaseEditor)(e,t)},defaults:{theme:null,lang:null,mode:null,width:null,height:null},version:"1.0.3",require:function(){switch(!0){case"function"==typeof ace.require:return ace.require.apply(null,arguments);case"function"==typeof window.require:return window.require.apply(null,arguments);default:throw"Can't find 'require' function"}}},jQueryAce.BaseEditor=function(){function e(e,t){null==t&&(t={}),this.element=$(e),this.options=$.extend({},jQueryAce.defaults,t)}return e.prototype.create=function(){return this.editor=new jQueryAce.AceDecorator(ace.edit(this.element)),this.update()},e.prototype.update=function(e){var t;if(null!=e&&(this.options=$.extend({},this.options,e)),null!=this.options.theme&&this.editor.theme(this.options.theme),null!=(t=this.options.lang||this.options.mode))return this.editor.lang(t)},e.prototype.destroy=function(){return this.element.data("ace",null),this.editor.destroy(),this.element.empty()},e}(),jQueryAce.TextareaEditor=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return function(t,n){for(var i in n)e.call(n,i)&&(t[i]=n[i]);function r(){this.constructor=t}r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype}(n,jQueryAce.BaseEditor),n.prototype.show=function(){var e;return null!=(e=this.container)&&e.show(),this.element.hide()},n.prototype.hide=function(){var e;return null!=(e=this.container)&&e.hide(),this.element.show()},n.prototype.create=function(){var e=this;return this.container=this.createAceContainer(),this.editor=new jQueryAce.AceDecorator(ace.edit(this.container.get(0))),this.update(),this.editor.value(this.element.val()),this.editor.ace.on("change",(function(t){return e.element.val(e.editor.value())})),this.show()},n.prototype.destroy=function(){return n.__super__.destroy.call(this),this.hide(),this.container.remove()},n.prototype.createAceContainer=function(){return this.buildAceContainer().insertAfter(this.element)},n.prototype.buildAceContainer=function(){return $("<div></div>").css({display:"none",position:"relative",width:this.options.width||this.element.width(),height:this.options.height||this.element.height()})},n}(),jQueryAce.AceDecorator=function(){function e(e){this.ace=e}return e.prototype.theme=function(e){return this.ace.setTheme("ace/theme/"+e)},e.prototype.lang=function(e){var t;return t=jQueryAce.require("ace/mode/"+e).Mode,this.session().setMode(new t)},e.prototype.mode=function(e){return this.lang(e)},e.prototype.session=function(){return this.ace.getSession()},e.prototype.destroy=function(){return this.ace.destroy()},e.prototype.value=function(e){return null!=e?this.ace.insert(e):this.ace.getValue()},e}(),function(e){e.ace=function(t,n){return e(t).ace(n)},e.fn.ace=function(t){return this.each((function(){var n;return null!=(n=e(this).data("ace"))?n.update(t):((n=jQueryAce.initialize(this,t)).create(),e(this).data("ace",n))}))}}(jQuery)}).call(this);