/*
 * XenForo notice.min.js
 * Copyright 2010-2018 XenForo Ltd.
 * Released under the XenForo License Agreement: https://xenforo.com/license-agreement
 */
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,g,c){a instanceof String&&(a=String(a));for(var h=a.length,d=0;d<h;d++){var b=a[d];if(g.call(c,b,d,a))return{i:d,v:b}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,g,c){a!=Array.prototype&&a!=Object.prototype&&(a[g]=c.value)};
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,g,c,h){if(g){c=$jscomp.global;a=a.split(".");for(h=0;h<a.length-1;h++){var d=a[h];d in c||(c[d]={});c=c[d]}a=a[a.length-1];h=c[a];g=g(h);g!=h&&null!=g&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:g})}};
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,c){return $jscomp.findInternal(this,a,c).v}},"es6","es3");
!function(a,g,c,h){XF.Notices=XF.Element.newHandler({options:{type:"block",target:".js-notice",scrollInterval:5},$notices:null,slider:null,dismissing:!1,init:function(){this.updateNoticeList();this.filter();this.handleNoticeListChange()&&(this.$target.on("click",".js-noticeDismiss",XF.proxy(this,"dismiss")),this.start())},updateNoticeList:function(){a(c).trigger("xf:notice-change");return this.$notices=this.$target.find(this.options.target).not(".clone")},handleNoticeListChange:function(){var a=this.$notices.length;
a?1==a&&this.$target.removeClass("notices--isMulti"):(this.slider&&(this.slider.destroy(),this.slider=null),this.$target.remove());return a},filter:function(){var d=this.getCookies(),b=!1;this.$notices.each(function(){var e=a(this),f=parseInt(e.data("notice-id"),10),c=e.data("visibility");d&&f&&-1!=a.inArray(f,d)&&(e.remove(),b=!0);c&&("none"==e.css("display")?(e.remove(),b=!0):e.addClass("is-vis-processed"))});b&&this.updateNoticeList()},start:function(){var d=this,b=this.$notices,e=this.options.type;
if("floating"==e)b.each(function(){var b=a(this),e=b.data("display-duration"),f=b.data("delay-duration"),c=b.data("auto-dismiss");f?setTimeout(function(){d.displayFloating(b,XF.config.speed.normal,e,c)},f):d.displayFloating(b,XF.config.speed.fast,e,c)});else if("scrolling"==e&&1<this.$notices.length)if(a.fn.lightSlider){if(!Modernizr.flexbox){var f=0;this.$notices.each(function(){f=Math.max(a(this).outerHeight(),f)});this.$notices.css("height",f)}this.slider=this.$target.lightSlider({item:1,addClass:"noticeScrollContainer",
slideMargin:0,galleryMargin:0,controls:!1,auto:!0,pause:1E3*this.options.scrollInterval,speed:Modernizr.flexbox?400:0,pauseOnHover:!0,loop:!0,rtl:XF.isRtl(),enableDrag:!1});a(g).on("resize",XF.proxy(this,"refreshSlider"))}else console.error("Lightslider must be loaded first.")},displayFloating:function(a,b,e,f){a.xfFadeDown(b,function(){e&&setTimeout(function(){a.xfFadeUp(XF.config.speed.normal);f&&a.find("a.js-noticeDismiss").trigger("click")},e)})},getCookies:function(){if(!XF.config.userId){var a=
XF.Cookie.get("notice_dismiss");a=a?a.split(","):[];for(var b=[],e,f=0;f<a.length;f++)(e=parseInt(a[f],10))&&b.push(e);return b}},dismiss:function(d){d.preventDefault();if(!this.dismissing){this.dismissing=!0;var b=a(d.target);d=b.parents(".js-notice");var e=parseInt(d.data("notice-id"),10),f=XF.config.userId,c=this.getCookies();f?XF.ajax("post",b.attr("href"),{},function(){},{skipDefault:!0}):e&&-1==a.inArray(e,c)&&(c.push(e),c.sort(function(a,b){return a-b}),b=new Date,b.setUTCMonth(b.getUTCMonth()+
1),XF.Cookie.set("notice_dismiss",c.join(","),b));this.removeNotice(d);this.dismissing=!1}},removeNotice:function(a){var b=this;if(this.slider){var c=this.$notices.length,d=this.slider.getCurrentSlideCount(),g=function(){a.remove();b.updateNoticeList();b.handleNoticeListChange()&&(b.refreshSlider(),b.slider.goToSlide(d))};1<c?(d>=b.slider.getTotalSlideCount()&&(d=1),this.slider.goToNextSlide(),setTimeout(g,500)):g()}else a.xfFadeUp(XF.config.speed.fast,function(){a.remove();b.updateNoticeList();b.handleNoticeListChange()})},
refreshSlider:function(){this.$target.css("height","");this.slider.refresh()}});XF.Element.register("notices","XF.Notices")}(jQuery,window,document);
