!function(a,b){"use strict";var c=0,d=b("head"),e=a.BigText,f=b.fn.bigtext,g={DEBUG_MODE:!1,DEFAULT_MIN_FONT_SIZE_PX:null,DEFAULT_MAX_FONT_SIZE_PX:528,GLOBAL_STYLE_ID:"bigtext-style",STYLE_ID:"bigtext-id",LINE_CLASS_PREFIX:"bigtext-line",EXEMPT_CLASS:"bigtext-exempt",noConflict:function(c){return c&&(b.fn.bigtext=f,a.BigText=e),g},supports:{wholeNumberFontSizeOnly:function(){if(!("getComputedStyle"in a))return!0;var c=b("<div/>").css({position:"absolute","font-size":"14.1px"}).insertBefore(b("script").eq(0)),d=a.getComputedStyle(c[0],null),e=d&&"14px"===d.getPropertyValue("font-size");return c.remove(),e}()},init:function(){b("#"+g.GLOBAL_STYLE_ID).length||d.append(g.generateStyleTag(g.GLOBAL_STYLE_ID,[".bigtext * { white-space: nowrap; } .bigtext > * { display: block; }",".bigtext ."+g.EXEMPT_CLASS+", .bigtext ."+g.EXEMPT_CLASS+" * { white-space: normal; }"]))},bindResize:function(c,d){var e;b(a).off(c).on(c,function(){e&&clearTimeout(e),e=setTimeout(d,100)})},getStyleId:function(a){return g.STYLE_ID+"-"+a},generateStyleTag:function(a,c){return b("<style>"+c.join("\n")+"</style>").attr("id",a)},clearCss:function(a){var c=g.getStyleId(a);b("#"+c).remove()},generateCss:function(a,b,c,d){var e=[];g.clearCss(a);for(var f=0,h=b.length;f<h;f++)e.push("#"+a+" ."+g.LINE_CLASS_PREFIX+f+" {"+(d[f]?" white-space: normal;":"")+(b[f]?" font-size: "+b[f]+"px;":"")+(c[f]?" word-spacing: "+c[f]+"px;":"")+"}");return g.generateStyleTag(g.getStyleId(a),e)},jQueryMethod:function(a){return g.init(),a=b.extend({minfontsize:g.DEFAULT_MIN_FONT_SIZE_PX,maxfontsize:g.DEFAULT_MAX_FONT_SIZE_PX,childSelector:"",resize:!0},a||{}),this.each(function(){var e=b(this).addClass("bigtext"),f=e.width(),h=e.attr("id"),i=a.childSelector?e.find(a.childSelector):e.children();h||(h="bigtext-id"+c++,e.attr("id",h)),a.resize&&g.bindResize("resize.bigtext-event-"+h,function(){g.jQueryMethod.call(b("#"+h),a)}),g.clearCss(h),i.addClass(function(a,b){return[b.replace(new RegExp("\\b"+g.LINE_CLASS_PREFIX+"\\d+\\b"),""),g.LINE_CLASS_PREFIX+a].join(" ")});var j=g.calculateSizes(e,i,f,a.maxfontsize,a.minfontsize);d.append(g.generateCss(h,j.fontSizes,j.wordSpacings,j.minFontSizes))}),this.trigger("bigtext:complete")},testLineDimensions:function(a,b,c,d,e,f,g){var h;if(g="number"==typeof g?g:0,a.css(c,d+f),h=a.width(),h>=b){if(a.css(c,""),h===b)return{match:"exact",size:parseFloat((parseFloat(d)-.1).toFixed(3))};var i=b-g,j=h-b;return{match:"estimate",size:parseFloat((parseFloat(d)-("word-spacing"===c&&g&&j<i?0:e)).toFixed(3))}}return h},calculateSizes:function(a,c,d,e,f){var h=a.clone(!0).addClass("bigtext-cloned").css({fontFamily:a.css("font-family"),textTransform:a.css("text-transform"),wordSpacing:a.css("word-spacing"),letterSpacing:a.css("letter-spacing"),position:"absolute",left:g.DEBUG_MODE?0:-9999,top:g.DEBUG_MODE?0:-9999}).appendTo(document.body),i=[],j=[],k=[],l=[];return c.css("float","left").each(function(){var a,c,h=b(this),j=g.supports.wholeNumberFontSizeOnly?[8,4,1]:[8,4,1,.1];if(h.hasClass(g.EXEMPT_CLASS))return i.push(null),l.push(null),void k.push(!1);var m=32,n=parseFloat(h.css("font-size")),o=(h.width()/n).toFixed(6);c=parseInt(d/o,10)-m;a:for(var p=0,q=j.length;p<q;p++)b:for(var r=1,s=10;r<=s;r++){if(c+r*j[p]>e){c=e;break a}if(a=g.testLineDimensions(h,d,"font-size",c+r*j[p],j[p],"px",a),"number"!=typeof a){if(c=a.size,"exact"===a.match)break a;break b}}l.push(d/c),c>e?(i.push(e),k.push(!1)):f&&c<f?(i.push(f),k.push(!0)):(i.push(c),k.push(!1))}).each(function(a){var c,e=b(this),f=0,h=1;if(e.hasClass(g.EXEMPT_CLASS))return void j.push(null);e.css("font-size",i[a]+"px");for(var k=1,l=3;k<l;k+=h)if(c=g.testLineDimensions(e,d,"word-spacing",k,h,"px",c),"number"!=typeof c){f=c.size;break}e.css("font-size",""),j.push(f)}).removeAttr("style"),g.DEBUG_MODE?h.css({"background-color":"rgba(255,255,255,.4)"}):h.remove(),{fontSizes:i,wordSpacings:j,ratios:l,minFontSizes:k}}};b.fn.bigtext=g.jQueryMethod,a.BigText=g}(this,jQuery);