text: /**
   * bootstrap-imageupload v1.1.2
   * https://github.com/egonolieux/bootstrap-imageupload
   * Copyright 2016 Egon Olieux
   * Released under the MIT license
   */
  
  if("undefined"==typeof jQuery)throw new Error("bootstrap-imageupload's JavaScript requires jQuery.");!function(i){"use strict";function e(e){b=i.extend({},i.fn.imageupload.defaultOptions,e);var n=this,t=n.find(".file-tab"),o=n.find(".panel-heading .btn:eq(0)"),l=t.find('input[type="file"]'),d=t.find(".btn:eq(1)"),r=n.find(".url-tab"),s=n.find(".panel-heading .btn:eq(1)"),h=r.find(".btn:eq(0)"),g=r.find(".btn:eq(1)");u(t),m(r),f(t),a.call(n),o.off(),l.off(),d.off(),s.off(),h.off(),g.off(),o.on("click",function(){i(this).blur(),f(t)}),l.on("change",function(){i(this).blur(),p(t)}),d.on("click",function(){i(this).blur(),u(t)}),s.on("click",function(){i(this).blur(),c(r)}),h.on("click",function(){i(this).blur(),v(r)}),g.on("click",function(){i(this).blur(),m(r)})}function n(){var i=this;i.addClass("imageupload-disabled")}function a(){var i=this;i.removeClass("imageupload-disabled")}function t(){var i=this;e.call(i,b)}function o(i){var e=[];return e.push('<div class="alert alert-danger alert-dismissible">'),e.push('<button type="button" class="close" data-dismiss="alert">'),e.push("<span>&times;</span>"),e.push("</button>"+i),e.push("</div>"),e.join("")}function l(i){return'<img src="'+i+'" alt="Image preview" class="thumbnail" style="max-width: '+b.maxWidth+"px; max-height: "+b.maxHeight+'px">'}function d(i){return i.substr(i.lastIndexOf(".")+1).toLowerCase()}function r(e,n){if(e.size/1024>b.maxFileSizeKb)return void n(!1,"File is too large (max "+b.maxFileSizeKb+"kB).");var a=d(e.name);i.inArray(a,b.allowedFormats)>-1?n(!0,"Image file is valid."):n(!1,"File type is not allowed.")}function s(e,n){var a=null,t=3e3,o=!1,l=new Image;l.onload=function(){if(!o){window.clearTimeout(a);var t=e;t.indexOf("?")!==-1&&(t=t.split("?")[0].split("#")[0]);var l=d(t);i.inArray(l,b.allowedFormats)>-1?n(!0,"Image URL is valid."):n(!1,"File type is not allowed.")}},l.onerror=function(){o||(window.clearTimeout(a),n(!1,"Image could not be found."))},l.src=e,a=window.setTimeout(function(){o=!0,l.src="???",n(!1,"Loading image timed out.")},t)}function f(i){var e=i.closest(".imageupload"),n=e.find(".panel-heading .btn:eq(0)");if(!n.hasClass("active")){var a=e.find(".url-tab");e.find(".panel-heading .btn:eq(1)").removeClass("active"),n.addClass("active"),a.hide(),i.show(),m(a)}}function u(i){i.find(".alert").remove(),i.find("img").remove(),i.find(".btn span").text("Browse"),i.find(".btn:eq(1)").hide(),i.find("input").val("")}function p(i){var e=i.find(".btn:eq(0)"),n=i.find(".btn:eq(1)"),a=e.find("input");if(i.find(".alert").remove(),i.find("img").remove(),n.hide(),a[0].files&&a[0].files[0]){e.prop("disabled",!0);var t=a[0].files[0];r(t,function(d,r){if(d){var s=new FileReader;s.onload=function(a){i.prepend(l(a.target.result)),e.find("span").text("Change"),n.css("display","inline-block")},s.onerror=function(){i.prepend(o("Error loading image file.")),a.val("")},s.readAsDataURL(t)}else i.prepend(o(r)),e.find("span").text("Browse"),a.val("");e.prop("disabled",!1)})}}function c(i){var e=i.closest(".imageupload"),n=e.find(".panel-heading .btn:eq(1)");if(!n.hasClass("active")){var a=e.find(".file-tab");e.find(".panel-heading .btn:eq(0)").removeClass("active"),n.addClass("active"),a.hide(),i.show(),u(a)}}function m(i){i.find(".alert").remove(),i.find("img").remove(),i.find(".btn:eq(1)").hide(),i.find("input").val("")}function v(e){var n=e.find('input[type="text"]'),a=e.find(".btn:eq(0)"),t=e.find(".btn:eq(1)");e.find(".alert").remove(),e.find("img").remove(),t.hide();var d=n.val();return d?(n.prop("disabled",!0),a.prop("disabled",!0),void s(d,function(r,s){r?(e.find('input[type="hidden"]').val(d),i(l(d)).insertAfter(a.closest(".input-group")),t.css("display","inline-block")):e.prepend(o(s)),n.prop("disabled",!1),a.prop("disabled",!1)})):void e.prepend(o("Please enter an image URL."))}var b={},h={init:e,disable:n,enable:a,reset:t};i.fn.imageupload=function(e){var n=arguments;return this.filter("div").each(function(){if(h[e])h[e].apply(i(this),Array.prototype.slice.call(n,1));else{if("object"!=typeof e&&e)throw new Error('Method "'+e+'" is not defined for imageupload.');h.init.apply(i(this),n)}})},i.fn.imageupload.defaultOptions={allowedFormats:["jpg","jpeg","png","gif"],maxWidth:250,maxHeight:250,maxFileSizeKb:2048}}(jQuery);