!function(t){"use strict";var e=function(t,e){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.validator=null,this.init("sswTooltip",t,e)};e.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'
',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,ssw_validator:!1},e.prototype.init=function(e,i,o){this.enabled=!0,this.type=e,this.$element=t(i),this.options=this.getOptions(o);for(var s=this.options.trigger.split(" "),n=s.length;n--;){var r=s[n];if("click"===r)this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this));else if("manual"!==r){var a="hover"===r?"mouseenter":"focus",l="hover"===r?"mouseleave":"blur";this.$element.on(a+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(l+"."+this.type,this.options.selector,t.proxy(this.leave,this))}}this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},e.prototype.getDefaults=function(){return e.DEFAULTS},e.prototype.getOptions=function(e){return(e=t.extend({},this.getDefaults(),this.$element.data(),e)).delay&&"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),e},e.prototype.getDelegateOptions=function(){var e={},i=this.getDefaults();return this._options&&t.each(this._options,(function(t,o){i[t]!==o&&(e[t]=o)})),e},e.prototype.enter=function(e){var i=e instanceof this.constructor?e:t(e.currentTarget)[this.type](this.getDelegateOptions()).data("ssw."+this.type);if(clearTimeout(i.timeout),i.hoverState="in",!i.options.delay||!i.options.delay.show)return i.show();i.timeout=setTimeout((function(){"in"===i.hoverState&&i.show()}),i.options.delay.show)},e.prototype.leave=function(e){var i=e instanceof this.constructor?e:t(e.currentTarget)[this.type](this.getDelegateOptions()).data("ssw."+this.type);if(clearTimeout(i.timeout),i.hoverState="out",!i.options.delay||!i.options.delay.hide)return i.hide();i.timeout=setTimeout((function(){"out"===i.hoverState&&i.hide()}),i.options.delay.hide)},e.prototype.show=function(){var e=t.Event("show.ssw."+this.type);if(this.hasContent()&&this.enabled){if(this.$element.trigger(e),e.isDefaultPrevented())return;var i=this.tip();this.setContent(),this.options.animation&&i.addClass("ssw-fade");var o="function"==typeof this.options.placement?this.options.placement.call(this,i[0],this.$element[0]):this.options.placement,s=/\s?auto?\s?/i,n=s.test(o);n&&(o=o.replace(s,"")||"top"),i.detach().css({top:0,left:0,display:"block"}).addClass(o),this.options.container?i.appendTo(this.options.container):i.insertAfter(this.$element);var r=this.getPosition(),a=i[0].offsetWidth,l=i[0].offsetHeight;if(n){var h=this.$element.parent(),p=o,f=document.documentElement.scrollTop||document.body.scrollTop,c="body"===this.options.container?window.innerWidth:h.outerWidth(),d="body"===this.options.container?window.innerHeight:h.outerHeight(),u="body"===this.options.container?0:h.offset().left;o="bottom"===o&&r.top+r.height+l-f>d?"top":"top"===o&&r.top-f-l<0?"bottom":"right"===o&&r.right+a>c?"left":"left"===o&&r.left-a

'}),(o.prototype=t.extend({},t.fn.sswTooltip.Constructor.prototype)).constructor=o,o.prototype.getDefaults=function(){return o.DEFAULTS},o.prototype.setContent=function(){var t=this.tip(),o=this.getTitle(),s=this.getContent();t.find(".ssw-popover-title")[this.options.html?"html":"text"](o),t.find(".ssw-popover-content")[this.options.html?"html":"text"](s),t.removeClass("ssw-fade top bottom left right ssw-in"),t.find(".ssw-popover-title").html()||t.find(".ssw-popover-title").hide()},o.prototype.hasContent=function(){return this.getTitle()||this.getContent()},o.prototype.getContent=function(){var t=this.$element,o=this.options;return t.attr("data-content")||("function"==typeof o.content?o.content.call(t[0]):o.content)},o.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".ssw-arrow")},o.prototype.tip=function(){return this.$tip||(this.$tip=t(this.options.template)),this.$tip};var s=t.fn.sswPopover;t.fn.sswPopover=function(s){return this.each((function(){var e=t(this),n=e.data("ssw.sswPopover"),i="object"==typeof s&&s;n||e.data("ssw.sswPopover",n=new o(this,i)),"string"==typeof s&&n[s]()}))},t.fn.sswPopover.Constructor=o,t.fn.sswPopover.noConflict=function(){return t.fn.sswPopover=s,this}}(ssw);