/*!
 * LABELAUTY jQuery Plugin
 *
 * @file: jquery-labelauty.js
 * @author: Francisco Neves (@fntneves)
 * @site: www.francisconeves.com
 * @license: MIT License
 */
!function(e){function a(e){var a=0,l=e,t="position: absolute !important; top: -1000 !important; ";return l=l.clone().attr("style",t).appendTo("body"),a=l.width(!0),l.remove(),a}function l(e,a){e&&window.console&&window.console.log&&window.console.log("jQuery-LABELAUTY: "+a)}function t(e,a,l,t,n){var o,i,s;return null==a?i=s="":(i=a[0],s=null==a[1]?i:a[1]),1==l?(o="<label ","undefined"!=typeof n&&(o+='data-toggle="tooltip" data-placement="bottom" title="'+n+'"'),o+=' for="'+e+'">',"undefined"!=typeof n&&(o+='<i title="'+n+'" class="smpush-info"></i>'),o+='<img src="'+t+'" /><span class="labelauty-unchecked">'+i+'</span><span class="labelauty-checked">'+s+'</span></label>'):o='<label for="'+e+'"><span class="labelauty-unchecked-image"></span></label>',o}e.fn.labelauty=function(n){var o=e.extend({development:!1,"class":"labelauty",label:!0,separator:"|",checked_label:"Checked",unchecked_label:"Unchecked",force_random_id:!1,minimum_width:!1,same_width:!0},n);return this.each(function(){var n,i,s,d=e(this),r=!0;if(d.is(":checkbox")===!1&&d.is(":radio")===!1)return this;if(d.addClass(o["class"]),n=d.attr("data-labelauty"),r=o.label,r===!0&&(null==n||0===n.length?(i=new Array,i[0]=o.unchecked_label,i[1]=o.checked_label):(i=n.split(o.separator),i.length>2?(r=!1,l(o.development,"There's more than two labels. LABELAUTY will not use labels.")):1===i.length&&l(o.development,"There's just one label. LABELAUTY will use this one for both cases."))),d.css({display:"none"}),d.removeAttr("data-labelauty"),s=d.attr("id"),o.force_random_id||null==s||""===s.trim()){var c=1+Math.floor(1024e3*Math.random());for(s="labelauty-"+c;0!==e(s).length;)c++,s="labelauty-"+c,l(o.development,"Holy crap, between 1024 thousand numbers, one raised a conflict. Trying again.");d.attr("id",s)}if(d.after(t(s,i,r,d.attr("data-icon"),d.attr("data-note"))),o.minimum_width!==!1&&d.next("label[for="+s+"]").css({"min-width":o.minimum_width}),0!=o.same_width&&1==o.label){var u=d.next("label[for="+s+"]"),h=a(u.find("span.labelauty-unchecked")),b=a(u.find("span.labelauty-checked"));h>b?u.find("span.labelauty-checked").width(h):u.find("span.labelauty-unchecked").width(b)}})}}(jQuery);
