!function($){"use strict";(new function(){var e=this;this.init=function(){window.ppFormRecaptchaLoadCallback=this.recaptcha_processing,$(".pp-del-profile-avatar").on("click",this.delete_avatar),$(".pp-del-cover-image").on("click",this.delete_profile_image_cover),$(document).on("click",".has-password-visibility-icon .pp-form-material-icons",this.toggle_password_visibility),$(document.body).on("click","a.showlogin",(function(){$(".pp_wc_login").slideToggle()})),$(window).on("load resize ppress_updated_checkout",(function(){e.defaultUserProfileResponsive()})),$(window).on("ppress_updated_checkout",(function(){e.recaptcha_processing()})),$(document).on("click",".ppress-confirm-delete",(function(e){e.preventDefault(),confirm(pp_ajax_form.confirm_delete)&&(window.location.href=$(this).attr("href"))})),this.submit_reload_form_on_billing_country_field_change(),this.myaccount_password_strength_meter(),"true"!==pp_ajax_form.disable_ajax_form&&($(document).on("submit",'form[data-pp-form-submit="login"]',this.ajax_login),$(document).on("submit",'form[data-pp-form-submit="signup"]',this.ajax_registration),$(document).on("submit",'form[data-pp-form-submit="passwordreset"]',this.ajax_password_reset),$(document).on("submit",'form[data-pp-form-submit="editprofile"]',this.ajax_edit_profile))},this.recaptcha_processing=function(){$(".pp-g-recaptcha").each((function(s,t){var r=$(t).attr("data-sitekey"),o=$(this).parents(".pp-form-container").find("form");if("v3"===$(t).attr("data-type"))o.find("input.pp-submit-form").on("click",(function(s){s.preventDefault(),e._add_processing_label(o),grecaptcha.ready((function(){grecaptcha.execute(r,{action:"form"}).then((function(e){o.find('[name="g-recaptcha-response"]').remove(),o.append($(" ",{type:"hidden",value:e,name:"g-recaptcha-response"})),o.trigger("submit")}))}))}));else{try{var a=grecaptcha.render(t,{sitekey:r,theme:$(t).attr("data-theme"),size:$(t).attr("data-size")})}catch(e){}o.on("pp_form_submitted",(function(){grecaptcha.reset(a)})),$(document).on("ppress_process_checkout_success_callback ppress_process_checkout_error_callback",(function(){grecaptcha.reset(a)}))}}))},this.toggle_password_visibility=function(e){e.preventDefault();var s=$(this).parents(".pp-form-field-input-textarea-wrap").find(".pp-form-field");"password"===s.attr("type")?(s.attr("type","text"),$(this).text("visibility_off")):(s.attr("type","password"),$(this).text("visibility"))},this.submit_reload_form_on_billing_country_field_change=function(){$(document).on("change",".pp-edit-profile-form-wrap select[name=ppress_billing_country]",(function(e){$(document).on("pp_form_edit_profile_success",(function(){window.location.reload()})),$(this).closest("form").find("input.pp-submit-form").trigger("click")}))},this.ajax_edit_profile=function(s){if(void 0!==window.FormData&&window.FormData){s.preventDefault();var t=$('form[data-pp-form-submit="editprofile"]'),r=e.get_melange_id(t),o=new FormData(this);o.append("action","pp_ajax_editprofile"),o.append("nonce",pp_ajax_form.nonce),o.append("melange_id",r),$(".profilepress-edit-profile-status").remove(),$(".profilepress-edit-profile-success").remove(),""!==window.edit_profile_msg_class&&$("."+window.edit_profile_msg_class).remove(),e._add_processing_label(t),$.post({url:pp_ajax_form.ajaxurl,data:o,cache:!1,contentType:!1,enctype:"multipart/form-data",processData:!1,dataType:"json",success:function(s){t.trigger("pp_form_submitted"),t.trigger("pp_form_edit_profile_success",[t]),"avatar_url"in s&&""!==s.avatar_url&&($("img[data-del='avatar'], img.pp-user-avatar").attr("src",s.avatar_url),$("input[name=eup_avatar]",t).val("")),"cover_image_url"in s&&""!==s.cover_image_url&&($("img[data-del='cover-image'], img.pp-user-cover-image").attr("src",s.cover_image_url),$("input[name=eup_cover_image]",t).val(""),$(".profilepress-myaccount-has-cover-image",t).show(),$(".profilepress-myaccount-cover-image-empty",t).hide()),"message"in s&&(window.edit_profile_msg_class=$(s.message).attr("class"),t.before(s.message),s.message&&s.message.includes("profilepress-edit-profile-status")&&e.scroll_to_notices($(".profilepress-edit-profile-status"))),"redirect"in s&&(t.trigger("pp_edit_profile_success_before_redirect"),window.location.assign(s.redirect)),e._remove_processing_label(t)}},"json")}},this.ajax_password_reset=function(s){s.preventDefault();var t=$(this),r=e.get_melange_id(t),o="true"===t.find('input[name="is-pp-tab-widget"]').val(),a={action:"pp_ajax_passwordreset",data:$(this).serialize()+"&melange_id="+r};e._remove_status_notice(),t.parents(".pp-tab-widget-form").prev(".pp-tab-status").remove(),e._add_processing_label(t),$.post(pp_ajax_form.ajaxurl,a,(function(s){if(t.trigger("pp_form_submitted"),"object"!=typeof s)return e._remove_processing_label(t);if("message"in s){if(t.trigger("pp_password_reset_status"),o){var r=s.message.replace("profilepress-reset-status","pp-tab-status");t.parents(".pp-tab-widget-form").before(r)}else t.parents(".lucidContainer").length>0?t.parents(".lucidContainer").before(s.message):t.before(s.message);"status"in s&&!0===s.status&&t.hide(),$('input[name="user_login"]',t).val("")}e._remove_processing_label(t)}),"json")},this.ajax_registration=function(s){if(void 0!==window.FormData&&window.FormData){s.preventDefault();var t=$(this),r=e.get_melange_id(t),o=new FormData(this),a="true"===t.find('input[name="is-pp-tab-widget"]').val();o.append("action","pp_ajax_signup"),o.append("melange_id",r),e._remove_status_notice(),t.parents(".pp-tab-widget-form").prev(".pp-tab-status").remove(),e._add_processing_label(t),$.post({url:pp_ajax_form.ajaxurl,data:o,cache:!1,contentType:!1,enctype:"multipart/form-data",processData:!1,dataType:"json",success:function(s){if(t.trigger("pp_form_submitted"),"object"!=typeof s)return e._remove_processing_label(t);if("message"in s){if(t.trigger("pp_registration_error",[s]),t.trigger("pp_registration_ajax_response",[s]),a){var r=s.message.replace("profilepress-reg-status","pp-tab-status");t.parents(".pp-tab-widget-form").before(r)}else t.parents(".lucidContainer").length>0?t.parents(".lucidContainer").before(s.message):t.before(s.message);s.message&&s.message.includes("profilepress-reg-status")&&e.scroll_to_notices()}else"redirect"in s&&(t.trigger("pp_registration_success",[s]),window.location.assign(s.redirect));e._remove_processing_label(t)}})}},this.ajax_login=function(s){s.preventDefault();var t=$(this),r={action:"pp_ajax_login",data:$(this).serialize()},o="true"===t.find('input[name="is-pp-tab-widget"]').val();e._remove_status_notice(),e._add_processing_label(t),$.post(pp_ajax_form.ajaxurl,r,(function(s){if(t.trigger("pp_form_submitted"),null===s||"object"!=typeof s)return e._remove_processing_label(t);if("success"in s&&!0===s.success&&"redirect"in s)t.trigger("pp_login_form_success"),window.location.assign(s.redirect);else if(t.trigger("pp_login_form_error"),"code"in s&&"pp2fa_auth_code_invalid"==s.code&&t.find(".pp-2fa").show(),o){var r=s.message.replace("profilepress-login-status","pp-tab-status");t.parents(".pp-tab-widget-form").before(r)}else t.parents(".lucidContainer").length>0?t.parents(".lucidContainer").before(s.message):t.before(s.message);e._remove_processing_label(t)}),"json")},this.delete_avatar=function(e){e.preventDefault();var s=$(this).text(),t=$(this);e.preventDefault(),confirm(pp_ajax_form.confirm_delete)&&(t.is("button")&&t.text(pp_ajax_form.deleting_text),$.post(pp_ajax_form.ajaxurl,{action:"pp_del_avatar",nonce:pp_ajax_form.nonce}).done((function(e){"error"in e&&"nonce_failed"===e.error?(t.text(s),alert(pp_ajax_form.deleting_error)):"success"in e&&($("img[data-del='avatar']").attr("src",e.default),t.remove())})))},this.delete_profile_image_cover=function(e){e.preventDefault();var s=$(this).text(),t=$(this);e.preventDefault(),confirm(pp_ajax_form.confirm_delete)&&(t.is("button")&&t.text(pp_ajax_form.deleting_text),$.post(pp_ajax_form.ajaxurl,{action:"pp_del_cover_image",nonce:pp_ajax_form.nonce}).done((function(e){"error"in e&&"nonce_failed"===e.error&&(t.text(s),alert(pp_ajax_form.deleting_error)),"success"in e&&(""!==e.default?($("img[data-del='cover-image']").attr("src",e.default),t.parent().find(".profilepress-myaccount-has-cover-image").show(),t.parent().find(".profilepress-myaccount-cover-image-empty").hide()):(t.parent().find(".profilepress-myaccount-has-cover-image").hide(),t.parent().find(".profilepress-myaccount-cover-image-empty").show()),t.remove())})))},this.get_melange_id=function(e){var s=$("input.pp_melange_id",e).val();return void 0===s?"":s},this._add_processing_label=function(e){var s=e.find("input[data-pp-submit-label]");s.attr({value:s.data("pp-processing-label"),disabled:"disabled"}).css("opacity",".4")},this._remove_processing_label=function(e){var s=e.find("input[data-pp-submit-label]");s.attr("value",s.data("pp-submit-label")),s.attr({value:s.data("pp-submit-label"),disabled:null}).css("opacity","")},this._remove_status_notice=function(){$(".profilepress-login-status,.pp-tab-status,.profilepress-edit-profile-success,.profilepress-edit-profile-status,.pp-reset-success,.profilepress-reset-status,.profilepress-reg-status").remove()},this.scroll_to_notices=function(e){(e=e||$(".profilepress-reg-status")).length&&$("html, body").animate({scrollTop:e.offset().top-100},1e3)},this.defaultUserProfileResponsive=function(){$(".ppress-default-profile, .pp-member-directory, .ppress-checkout__form").each((function(){var e=$(this),s=e.width();s<=340?(e.removeClass("ppressui340"),e.removeClass("ppressui500"),e.removeClass("ppressui800"),e.removeClass("ppressui768"),e.removeClass("ppressui960"),e.addClass("ppressui340")):s<=500?(e.removeClass("ppressui340"),e.removeClass("ppressui500"),e.removeClass("ppressui768"),e.removeClass("ppressui800"),e.removeClass("ppressui960"),e.addClass("ppressui500")):s<=768?(e.removeClass("ppressui340"),e.removeClass("ppressui500"),e.removeClass("ppressui768"),e.removeClass("ppressui800"),e.removeClass("ppressui960"),e.addClass("ppressui768")):s<=800?(e.removeClass("ppressui340"),e.removeClass("ppressui500"),e.removeClass("ppressui768"),e.removeClass("ppressui800"),e.removeClass("ppressui960"),e.addClass("ppressui800")):s<=960?(e.removeClass("ppressui340"),e.removeClass("ppressui500"),e.removeClass("ppressui768"),e.removeClass("ppressui800"),e.removeClass("ppressui960"),e.addClass("ppressui960")):s>960&&(e.removeClass("ppressui340"),e.removeClass("ppressui500"),e.removeClass("ppressui768"),e.removeClass("ppressui800"),e.removeClass("ppressui960")),e.css("opacity",1)})),$(".ppress-default-profile-cover, .ppress-default-profile-cover-e").each((function(){var e=$(this),s=Math.round(e.width()/e.data("ratio"))+"px";e.height(s),e.find(".ppress-dpf-cover-add").height(s)}))},this.myaccount_password_strength_meter=function(){$((function(){var e=$("input[name=password_new]"),s=$("input[name=password_confirm_new]"),t=$("input[name=submit-form]"),r=$("#pp-pass-strength-result");$("body").on("keyup","input[name=password_new], input[name=password_confirm_new]",(function(o){!function(e,s,t,r,o){var a=e.val(),p=s.val();r.attr("disabled","disabled"),t.removeClass("short bad good strong"),o=o.concat(wp.passwordStrength.userInputDisallowedList());var i=wp.passwordStrength.meter(a,o,p);switch(i){case 2:t.addClass("bad").html(pwsL10n.bad);break;case 3:t.addClass("good").html(pwsL10n.good);break;case 4:t.addClass("strong").html(pwsL10n.strong);break;case 5:t.addClass("short").html(pwsL10n.mismatch);break;default:t.addClass("short").html(pwsL10n.short)}"false"===myacPwsL10n.disable_enforcement&&4===i&&""!==p.trim()&&r.removeAttr("disabled")}(e,s,r,t,[])}))}))}}).init(),(new function(){let e=this;window.ppressCheckoutForm=this,this.init=function(){"0"!==pp_ajax_form.is_checkout&&0!==$("#ppress_checkout_main_form").length&&($(document).on("click",".ppress-checkout-show-login-form",this.toggle_login_form),$(document).on("click",'.ppress-login-submit-btn input[type="submit"]',this.process_login),$(document).on("click",".ppress-coupon-code-link",this.toggle_discount_code_reveal),$(document).on("click",".ppress-apply-discount-btn",this.apply_discount_code),$(document).on("click","#ppress-remove-applied-coupon",this.remove_applied_discount_code),$(document).on("submit","#ppress_mb_checkout_form",this.process_checkout),$(document).on("click",".ppress-terms-and-conditions-link",(function(e){var s=$(".ppress-checkout-form__terms_condition__content");s.length>0&&(e.preventDefault(),s.slideToggle())})),$(document).on("ppress_update_checkout",this.update_checkout),"1"===pp_ajax_form.is_checkout_tax_enabled?$(document).on("change","#ppress_mb_checkout_form .ppress_billing_country, #ppress_mb_checkout_form .ppress_billing_state, #ppress_mb_checkout_form .ppress_vat_number",e.debounce((function(){$(document.body).trigger("ppress_update_checkout")}),200)):$(document).on("change","#ppress_mb_checkout_form .ppress_billing_country",e.contextual_state_field),$(document.body).on("change","#ppress_checkout_payment_methods [name=ppress_payment_method]",(function(){$(document.body).trigger("ppress_update_checkout")})),$(document.body).on("change","#ppress_mb_checkout_form [name=group_selector]",(function(){e.update_checkout()})),$(document.body).trigger("ppress_update_checkout"),$(document).ajaxError((function(){e.remove_spinner()})))},this.debounce=function(e,s){let t;return s=s||600,function(){clearTimeout(t),t=setTimeout((function(){e()}),s)}},this.contextual_state_field=function(){let e=$(".ppress_billing_state"),s={action:"ppress_contextual_state_field",country:$(this).val(),name:e.prop("name"),id:e.prop("id"),class:e.prop("class"),csrf:$("#ppress_checkout_nonce").val()};$.post(pp_ajax_form.ajaxurl,s,(function(s){e.replaceWith(s.data)}))},this.scroll_to_notices=function(e){"true"===pp_ajax_form.is_checkout_autoscroll_enabled&&(e=e||$(".ppress-checkout-alert")).length&&$("html, body").animate({scrollTop:e.offset().top-100},1e3)},this.update_checkout=function(s){s=s||!1;let t=$("#ppress_mb_checkout_form [name=group_selector]").length>0;e.removeAllAlerts(),e.add_spinner();let r={action:"ppress_update_order_review",plan_id:$("#ppress-checkout-plan-id").val(),ppress_payment_method:$("#ppress_checkout_payment_methods [name=ppress_payment_method]:checked").val(),csrf:$("#ppress_checkout_nonce").val(),address:$(".ppress-checkout-form__payment_method.ppress-active .ppress_billing_address").val(),city:$(".ppress-checkout-form__payment_method.ppress-active .ppress_billing_city").val(),country:$(".ppress-checkout-form__payment_method.ppress-active .ppress_billing_country").val(),state:$(".ppress-checkout-form__payment_method.ppress-active .ppress_billing_state").val(),postcode:$(".ppress-checkout-form__payment_method.ppress-active .ppress_billing_postcode").val(),phone:$(".ppress-checkout-form__payment_method.ppress-active .ppress_billing_phone").val(),vat_number:$("#ppress_checkout_main_form .ppress_vat_number").val(),post_data:$("#ppress_mb_checkout_form").serialize()};!0===t&&(r.isChangePlanUpdate="true"),$.post(pp_ajax_form.ajaxurl,r,(function(o){let a={};if($(".ppress-checkout-form__payment_method :input").each((function(){let e=$(this).attr("id");e&&(-1!==$.inArray($(this).attr("type"),["checkbox","radio"])?a[e]=$(this).prop("checked"):a[e]=$(this).val())})),"data"in o&&void 0!==o.data.fragments&&($.each(o.data.fragments,(function(s,t){e.fragments&&e.fragments[s]===t||$(s).replaceWith(t)})),e.fragments=r.fragments),$.isEmptyObject(a)||$(".ppress-checkout-form__payment_method :input").each((function(){let e=$(this).attr("id");e&&(-1!==$.inArray($(this).attr("type"),["checkbox","radio"])?$(this).prop("checked",a[e]):($.inArray($(this).attr("type"),["select"]),$(this).val(a[e])))})),"success"in o&&!1===o.success){let e=$("#ppress_checkout_main_form");o.data&&e.prepend(o.data),e.find(".input-text, select, input:checkbox").trigger("blur")}$(document.body).trigger("ppress_updated_checkout",[o]);let p,i=$(".ppress-checkout_order_summary__bottom_details");(p=$(".ppress-checkout-alert")).length>0&&(i=p),e.scroll_to_notices(i),e.remove_spinner(),!0===t&&!0!==s&&e.update_checkout(!0)}))},this.toggle_login_form=function(e){e.preventDefault(),$("#ppress_checkout_account_info .ppress-main-checkout-form__login_form_wrap").slideToggle()},this.toggle_discount_code_reveal=function(e){e.preventDefault(),$("#ppress-checkout-coupon-code-wrap").slideToggle()},this.apply_discount_code=function(s){s.preventDefault(),e.removeAllAlerts(),e.add_spinner();let t={action:"ppress_checkout_apply_discount",plan_id:$("#ppress-checkout-plan-id").val(),coupon_code:$("#apply-discount").val(),ppress_checkout_nonce:$("#ppress_checkout_nonce").val()};$.post(pp_ajax_form.ajaxurl,t,(function(s){"success"in s&&!0===s.success?$(document.body).trigger("ppress_update_checkout"):($(".ppress-checkout_order_summary-wrap").before(s.data),e.remove_spinner())}))},this.remove_applied_discount_code=function(s){s.preventDefault(),e.removeAllAlerts(),e.add_spinner();let t={action:"ppress_checkout_remove_discount",plan_id:$("#ppress-checkout-plan-id").val(),ppress_checkout_nonce:$("#ppress_checkout_nonce").val()};$.post(pp_ajax_form.ajaxurl,t,(function(s){"success"in s&&!0===s.success?$(document.body).trigger("ppress_update_checkout"):($(".ppress-checkout_order_summary-wrap").before(s.data),e.remove_spinner())}))},this.process_login=function(s){s.preventDefault(),e.removeAllAlerts(),e.add_spinner();let t={action:"ppress_process_checkout_login",ppmb_user_login:$("#ppress_mb_checkout_form #ppmb_user_login").val(),ppmb_user_pass:$("#ppress_mb_checkout_form #ppmb_user_pass").val(),ppress_checkout_nonce:$("#ppress_checkout_nonce").val()};$.post(pp_ajax_form.ajaxurl,t,(function(s){"success"in s&&(!0===s.success?window.location.reload():"data"in s&&$("#ppress_mb_checkout_form .ppress-login-submit-btn").prepend(s.data)),e.remove_spinner()}))},this.process_checkout=function(s){if("function"!=typeof this.checkValidity||!1!==this.checkValidity()){s.preventDefault(),e.removeAllAlerts(),e.add_spinner();var t=$(this),r=e.get_payment_method();if(!1!==t.triggerHandler("ppress_checkout_place_order_"+r)){let s=new FormData(this);s.append("action","ppress_process_checkout"),s.append("ppress_checkout_nonce",$("#ppress_checkout_nonce").val()),$.post({url:pp_ajax_form.ajaxurl,data:s,cache:!1,contentType:!1,enctype:"multipart/form-data",processData:!1,dataType:"json",success:function(s){if($(document.body).trigger("ppress_process_checkout_success_callback",[s]),"success"in s)return!0===s.success?void(!1!==t.triggerHandler("ppress_process_checkout_"+r,[s,r])&&("redirect_url"in s&&void 0!==s.redirect_url&&s.redirect_url.length>0?window.location.assign(s.redirect_url):($(document.body).trigger("ppress_checkout_success",[s,r]),window.location.assign(s.order_success_url)))):"error_message"in s?e.createAlertMessage(s.error_message):"data"in s&&"string"==typeof s.data?e.createAlertMessage(s.data):void 0;e.remove_spinner()},error:function(s,t,r){$(document.body).trigger("ppress_process_checkout_error_callback",[s,t,r]),e.createAlertMessage(r)}},"json")}}},this.get_payment_method=function(){return $("#ppress_mb_checkout_form").find('input[name="ppress_payment_method"]:checked').val()},this.createAlertMessage=function(e,s){s=s||"error";var t=void 0!==e.indexOf&&-1!==e.indexOf("ppress-checkout-alert"),r="";t||(r='
"),$("#ppress_checkout_main_form").prepend(r),ppressCheckoutForm.scroll_to_notices(),ppressCheckoutForm.remove_spinner(),$(document.body).trigger("ppress_checkout_error",[e])},this.removeAllAlerts=function(){$(".ppress-checkout-alert").remove()},this.add_spinner=function(){e.remove_spinner(),$(".ppress-checkout__form").prepend('')},this.remove_spinner=function(){$(".ppress-checkout__form .ppress-checkout__form__preloader").remove()},this.is_var_defined=function(e){return null!=e},this.get_obj_val=function(e,s){return this.is_var_defined(e)&&""!==e?e:s}}).init()}(jQuery);;
/*! This file is auto-generated */
/*!
* imagesLoaded PACKAGED v5.0.0
* JavaScript is all like "You images are done yet or what?"
* MIT License
*/
!function(t,e){"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,(function(){function t(){}let e=t.prototype;return e.on=function(t,e){if(!t||!e)return this;let i=this._events=this._events||{},s=i[t]=i[t]||[];return s.includes(e)||s.push(e),this},e.once=function(t,e){if(!t||!e)return this;this.on(t,e);let i=this._onceEvents=this._onceEvents||{};return(i[t]=i[t]||{})[e]=!0,this},e.off=function(t,e){let i=this._events&&this._events[t];if(!i||!i.length)return this;let s=i.indexOf(e);return-1!=s&&i.splice(s,1),this},e.emitEvent=function(t,e){let i=this._events&&this._events[t];if(!i||!i.length)return this;i=i.slice(0),e=e||[];let s=this._onceEvents&&this._onceEvents[t];for(let n of i){s&&s[n]&&(this.off(t,n),delete s[n]),n.apply(this,e)}return this},e.allOff=function(){return delete this._events,delete this._onceEvents,this},t})),
/*!
* imagesLoaded v5.0.0
* JavaScript is all like "You images are done yet or what?"
* MIT License
*/
function(t,e){"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.imagesLoaded=e(t,t.EvEmitter)}("undefined"!=typeof window?window:this,(function(t,e){let i=t.jQuery,s=t.console;function n(t,e,o){if(!(this instanceof n))return new n(t,e,o);let r=t;var h;("string"==typeof t&&(r=document.querySelectorAll(t)),r)?(this.elements=(h=r,Array.isArray(h)?h:"object"==typeof h&&"number"==typeof h.length?[...h]:[h]),this.options={},"function"==typeof e?o=e:Object.assign(this.options,e),o&&this.on("always",o),this.getImages(),i&&(this.jqDeferred=new i.Deferred),setTimeout(this.check.bind(this))):s.error(`Bad element for imagesLoaded ${r||t}`)}n.prototype=Object.create(e.prototype),n.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)};const o=[1,9,11];n.prototype.addElementImages=function(t){"IMG"===t.nodeName&&this.addImage(t),!0===this.options.background&&this.addElementBackgroundImages(t);let{nodeType:e}=t;if(!e||!o.includes(e))return;let i=t.querySelectorAll("img");for(let t of i)this.addImage(t);if("string"==typeof this.options.background){let e=t.querySelectorAll(this.options.background);for(let t of e)this.addElementBackgroundImages(t)}};const r=/url\((['"])?(.*?)\1\)/gi;function h(t){this.img=t}function d(t,e){this.url=t,this.element=e,this.img=new Image}return n.prototype.addElementBackgroundImages=function(t){let e=getComputedStyle(t);if(!e)return;let i=r.exec(e.backgroundImage);for(;null!==i;){let s=i&&i[2];s&&this.addBackground(s,t),i=r.exec(e.backgroundImage)}},n.prototype.addImage=function(t){let e=new h(t);this.images.push(e)},n.prototype.addBackground=function(t,e){let i=new d(t,e);this.images.push(i)},n.prototype.check=function(){if(this.progressedCount=0,this.hasAnyBroken=!1,!this.images.length)return void this.complete();let t=(t,e,i)=>{setTimeout((()=>{this.progress(t,e,i)}))};this.images.forEach((function(e){e.once("progress",t),e.check()}))},n.prototype.progress=function(t,e,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!t.isLoaded,this.emitEvent("progress",[this,t,e]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,t),this.progressedCount===this.images.length&&this.complete(),this.options.debug&&s&&s.log(`progress: ${i}`,t,e)},n.prototype.complete=function(){let t=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(t,[this]),this.emitEvent("always",[this]),this.jqDeferred){let t=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[t](this)}},h.prototype=Object.create(e.prototype),h.prototype.check=function(){this.getIsImageComplete()?this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.img.crossOrigin&&(this.proxyImage.crossOrigin=this.img.crossOrigin),this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.proxyImage.src=this.img.currentSrc||this.img.src)},h.prototype.getIsImageComplete=function(){return this.img.complete&&this.img.naturalWidth},h.prototype.confirm=function(t,e){this.isLoaded=t;let{parentNode:i}=this.img,s="PICTURE"===i.nodeName?i:this.img;this.emitEvent("progress",[this,s,e])},h.prototype.handleEvent=function(t){let e="on"+t.type;this[e]&&this[e](t)},h.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},h.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},h.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},d.prototype=Object.create(h.prototype),d.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url,this.getIsImageComplete()&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},d.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},d.prototype.confirm=function(t,e){this.isLoaded=t,this.emitEvent("progress",[this,this.element,e])},n.makeJQueryPlugin=function(e){(e=e||t.jQuery)&&(i=e,i.fn.imagesLoaded=function(t,e){return new n(this,t,e).jqDeferred.promise(i(this))})},n.makeJQueryPlugin(),n}));;
/*! This file is auto-generated */
/*!
* Masonry PACKAGED v4.2.2
* Cascading grid layout library
* https://masonry.desandro.com
* MIT License
* by David DeSandro
*/
!function(t,e){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("jquery")):t.jQueryBridget=e(t,t.jQuery)}(window,function(t,e){"use strict";function i(i,r,a){function h(t,e,n){var o,r="$()."+i+'("'+e+'")';return t.each(function(t,h){var u=a.data(h,i);if(!u)return void s(i+" not initialized. Cannot call methods, i.e. "+r);var d=u[e];if(!d||"_"==e.charAt(0))return void s(r+" is not a valid method");var l=d.apply(u,n);o=void 0===o?l:o}),void 0!==o?o:t}function u(t,e){t.each(function(t,n){var o=a.data(n,i);o?(o.option(e),o._init()):(o=new r(n,e),a.data(n,i,o))})}a=a||e||t.jQuery,a&&(r.prototype.option||(r.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),a.fn[i]=function(t){if("string"==typeof t){var e=o.call(arguments,1);return h(this,t,e)}return u(this,t),this},n(a))}function n(t){!t||t&&t.bridget||(t.bridget=i)}var o=Array.prototype.slice,r=t.console,s="undefined"==typeof r?function(){}:function(t){r.error(t)};return n(e||t.jQuery),i}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},n=i[t]=i[t]||{};return n[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){i=i.slice(0),e=e||[];for(var n=this._onceEvents&&this._onceEvents[t],o=0;oe;e++){var i=h[e];t[i]=0}return t}function n(t){var e=getComputedStyle(t);return e||a("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See https://bit.ly/getsizebug1"),e}function o(){if(!d){d=!0;var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style.boxSizing="border-box";var i=document.body||document.documentElement;i.appendChild(e);var o=n(e);s=200==Math.round(t(o.width)),r.isBoxSizeOuter=s,i.removeChild(e)}}function r(e){if(o(),"string"==typeof e&&(e=document.querySelector(e)),e&&"object"==typeof e&&e.nodeType){var r=n(e);if("none"==r.display)return i();var a={};a.width=e.offsetWidth,a.height=e.offsetHeight;for(var d=a.isBorderBox="border-box"==r.boxSizing,l=0;u>l;l++){var c=h[l],f=r[c],m=parseFloat(f);a[c]=isNaN(m)?0:m}var p=a.paddingLeft+a.paddingRight,g=a.paddingTop+a.paddingBottom,y=a.marginLeft+a.marginRight,v=a.marginTop+a.marginBottom,_=a.borderLeftWidth+a.borderRightWidth,z=a.borderTopWidth+a.borderBottomWidth,E=d&&s,b=t(r.width);b!==!1&&(a.width=b+(E?0:p+_));var x=t(r.height);return x!==!1&&(a.height=x+(E?0:g+z)),a.innerWidth=a.width-(p+_),a.innerHeight=a.height-(g+z),a.outerWidth=a.width+y,a.outerHeight=a.height+v,a}}var s,a="undefined"==typeof console?e:function(t){console.error(t)},h=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],u=h.length,d=!1;return r}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("desandro-matches-selector/matches-selector",e):"object"==typeof module&&module.exports?module.exports=e():t.matchesSelector=e()}(window,function(){"use strict";var t=function(){var t=window.Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;is?"round":"floor";r=Math[a](r),this.cols=Math.max(r,1)},n.getContainerWidth=function(){var t=this._getOption("fitWidth"),i=t?this.element.parentNode:this.element,n=e(i);this.containerWidth=n&&n.innerWidth},n._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth%this.columnWidth,i=e&&1>e?"round":"ceil",n=Math[i](t.size.outerWidth/this.columnWidth);n=Math.min(n,this.cols);for(var o=this.options.horizontalOrder?"_getHorizontalColPosition":"_getTopColPosition",r=this[o](n,t),s={x:this.columnWidth*r.col,y:r.y},a=r.y+t.size.outerHeight,h=n+r.col,u=r.col;h>u;u++)this.colYs[u]=a;return s},n._getTopColPosition=function(t){var e=this._getTopColGroup(t),i=Math.min.apply(Math,e);return{col:e.indexOf(i),y:i}},n._getTopColGroup=function(t){if(2>t)return this.colYs;for(var e=[],i=this.cols+1-t,n=0;i>n;n++)e[n]=this._getColGroupY(n,t);return e},n._getColGroupY=function(t,e){if(2>e)return this.colYs[t];var i=this.colYs.slice(t,t+e);return Math.max.apply(Math,i)},n._getHorizontalColPosition=function(t,e){var i=this.horizontalColIndex%this.cols,n=t>1&&i+t>this.cols;i=n?0:i;var o=e.size.outerWidth&&e.size.outerHeight;return this.horizontalColIndex=o?i+t:this.horizontalColIndex,{col:i,y:this._getColGroupY(i,t)}},n._manageStamp=function(t){var i=e(t),n=this._getElementOffset(t),o=this._getOption("originLeft"),r=o?n.left:n.right,s=r+i.outerWidth,a=Math.floor(r/this.columnWidth);a=Math.max(0,a);var h=Math.floor(s/this.columnWidth);h-=s%this.columnWidth?0:1,h=Math.min(this.cols-1,h);for(var u=this._getOption("originTop"),d=(u?n.top:n.bottom)+i.outerHeight,l=a;h>=l;l++)this.colYs[l]=Math.max(d,this.colYs[l])},n._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var t={height:this.maxY};return this._getOption("fitWidth")&&(t.width=this._getContainerFitWidth()),t},n._getContainerFitWidth=function(){for(var t=0,e=this.cols;--e&&0===this.colYs[e];)t++;return(this.cols-t)*this.columnWidth-this.gutter},n.needsResizeLayout=function(){var t=this.containerWidth;return this.getContainerWidth(),t!=this.containerWidth},i});;
/*!
* Masonry v2 shim
* to maintain backwards compatibility
* as of Masonry v3.1.2
*
* Cascading grid layout library
* http://masonry.desandro.com
* MIT License
* by David DeSandro
*/
!function(a){"use strict";var b=a.Masonry;b.prototype._remapV2Options=function(){this._remapOption("gutterWidth","gutter"),this._remapOption("isResizable","isResizeBound"),this._remapOption("isRTL","isOriginLeft",function(a){return!a});var a=this.options.isAnimated;if(void 0!==a&&(this.options.transitionDuration=a?this.options.transitionDuration:0),void 0===a||a){var b=this.options.animationOptions,c=b&&b.duration;c&&(this.options.transitionDuration="string"==typeof c?c:c+"ms")}},b.prototype._remapOption=function(a,b,c){var d=this.options[a];void 0!==d&&(this.options[b]=c?c(d):d)};var c=b.prototype._create;b.prototype._create=function(){var a=this;this._remapV2Options(),c.apply(this,arguments),setTimeout(function(){jQuery(a.element).addClass("masonry")},0)};var d=b.prototype.layout;b.prototype.layout=function(){this._remapV2Options(),d.apply(this,arguments)};var e=b.prototype.option;b.prototype.option=function(){e.apply(this,arguments),this._remapV2Options()};var f=b.prototype._itemize;b.prototype._itemize=function(a){var b=f.apply(this,arguments);return jQuery(a).addClass("masonry-brick"),b};var g=b.prototype.measureColumns;b.prototype.measureColumns=function(){var a=this.options.columnWidth;a&&"function"==typeof a&&(this.getContainerWidth(),this.columnWidth=a(this.containerWidth)),g.apply(this,arguments)},b.prototype.reload=function(){this.reloadItems.apply(this,arguments),this.layout.apply(this)};var h=b.prototype.destroy;b.prototype.destroy=function(){var a=this.getItemElements();jQuery(this.element).removeClass("masonry"),jQuery(a).removeClass("masonry-brick"),h.apply(this,arguments)}}(window);;
!function(s){"use strict";s.fn.fitVids=function(t){var i={customSelector:null,ignore:null};if(!document.getElementById("fit-vids-style")){var e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("div");n.innerHTML='x
',e.appendChild(n.childNodes[1])}return t&&s.extend(i,t),this.each(function(){var t=['iframe[src*="player.vimeo.com"]','iframe[src*="youtube.com"]','iframe[src*="youtube-nocookie.com"]','iframe[src*="kickstarter.com"][src*="video.html"]',"object","embed"];i.customSelector&&t.push(i.customSelector);var n=".fitvidsignore";i.ignore&&(n=n+", "+i.ignore);var e=s(this).find(t.join(","));(e=(e=e.not("object object")).not(n)).each(function(){var t=s(this);if(!(0').parent(".fluid-width-video-wrapper").css("padding-top",100*e+"%"),t.removeAttr("height").removeAttr("width")}})})},s.fn.fitVids._count=0}(window.jQuery||window.Zepto);var objectFitImages=function(){"use strict";var s="bfred-it:object-fit-images",o=/(object-fit|object-position)\s*:\s*([-\w\s%]+)/g,t=new Image,n="object-fit"in t.style,r="object-position"in t.style,a="background-size"in t.style,l="string"==typeof t.currentSrc,c=t.getAttribute,u=t.setAttribute,h=!1;function d(t,e,i){var n=function(t,e){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='"+t+"' height='"+e+"'%3E%3C/svg%3E"}(e||1,i||0);c.call(t,"src")!==n&&u.call(t,"src",n)}function p(t,e){t.naturalWidth?e(t):setTimeout(p,100,t,e)}function m(e){var t=function(t){for(var e,i=getComputedStyle(t).fontFamily,n={};null!==(e=o.exec(i));)n[e[1]]=e[2];return n}(e),i=e[s];if(t["object-fit"]=t["object-fit"]||"fill",!i.img){if("fill"===t["object-fit"])return;if(!i.skipTest&&n&&!t["object-position"])return}if(!i.img){i.img=new Image(e.width,e.height),i.img.srcset=c.call(e,"data-ofi-srcset")||e.srcset,i.img.src=c.call(e,"data-ofi-src")||e.src,u.call(e,"data-ofi-src",e.src),e.srcset&&u.call(e,"data-ofi-srcset",e.srcset),d(e,e.naturalWidth||e.width,e.naturalHeight||e.height),e.srcset&&(e.srcset="");try{!function(i){var e={get:function(t){return i[s].img[t||"src"]},set:function(t,e){return i[s].img[e||"src"]=t,u.call(i,"data-ofi-"+e,t),m(i),t}};Object.defineProperty(i,"src",e),Object.defineProperty(i,"currentSrc",{get:function(){return e.get("currentSrc")}}),Object.defineProperty(i,"srcset",{get:function(){return e.get("srcset")},set:function(t){return e.set(t,"srcset")}})}(e)}catch(t){window.console&&console.log("http://bit.ly/ofi-old-browser")}}!function(t){if(t.srcset&&!l&&window.picturefill){var e=window.picturefill._;t[e.ns]&&t[e.ns].evaled||e.fillImg(t,{reselect:!0}),t[e.ns].curSrc||(t[e.ns].supported=!1,e.fillImg(t,{reselect:!0})),t.currentSrc=t[e.ns].curSrc||t.src}}(i.img),e.style.backgroundImage="url("+(i.img.currentSrc||i.img.src).replace("(","%28").replace(")","%29")+")",e.style.backgroundPosition=t["object-position"]||"center",e.style.backgroundRepeat="no-repeat",/scale-down/.test(t["object-fit"])?p(i.img,function(){i.img.naturalWidth>e.width||i.img.naturalHeight>e.height?e.style.backgroundSize="contain":e.style.backgroundSize="auto"}):e.style.backgroundSize=t["object-fit"].replace("none","auto").replace("fill","100% 100%"),p(i.img,function(t){d(e,t.naturalWidth,t.naturalHeight)})}function f(t,e){var i=!h&&!t;if(e=e||{},t=t||"img",r&&!e.skipTest||!a)return!1;"string"==typeof t?t=document.querySelectorAll(t):"length"in t||(t=[t]);for(var n=0;n",a)||this.op(e,"<",r)&&this.op(e,">",a))&&l.push(i);this.$stage.children(".active").removeClass("active"),this.$stage.children(":eq("+l.join("), :eq(")+")").addClass("active"),this.settings.center&&(this.$stage.children(".center").removeClass("center"),this.$stage.children().eq(this.current()).addClass("center"))}}],c.prototype.initialize=function(){var t,e,i;this.enter("initializing"),this.trigger("initialize"),this.$element.toggleClass(this.settings.rtlClass,this.settings.rtl),this.settings.autoWidth&&!this.is("pre-loading")&&(t=this.$element.find("img"),e=this.settings.nestedItemSelector?"."+this.settings.nestedItemSelector:o,i=this.$element.children(e).width(),t.length&&i<=0&&this.preloadAutoWidthImages(t));this.$element.addClass(this.options.loadingClass),this.$stage=l("<"+this.settings.stageElement+' class="'+this.settings.stageClass+'"/>').wrap('
'),this.$element.append(this.$stage.parent()),this.replace(this.$element.children().not(this.$stage.parent())),this.$element.is(":visible")?this.refresh():this.invalidate("width"),this.$element.removeClass(this.options.loadingClass).addClass(this.options.loadedClass),this.registerEventHandlers(),this.leave("initializing"),this.trigger("initialized")},c.prototype.setup=function(){var e=this.viewport(),t=this.options.responsive,i=-1,n=null;t?(l.each(t,function(t){t<=e&&i ").addClass(this.options.itemClass).append(t)),this.trigger("prepared",{content:e.data}),e.data},c.prototype.update=function(){for(var t=0,e=this._pipe.length,i=l.proxy(function(t){return this[t]},this._invalidated),n={};t",r[t+1]||e-o)&&(s="left"===n?t+1:t),-1===s},this)),this.settings.loop||(this.op(i,">",r[this.minimum()])?s=i=this.minimum():this.op(i,"<",r[this.maximum()])&&(s=i=this.maximum())),s},c.prototype.animate=function(t){var e=0r/2&&(s+=-1*o*r),(n=(((t=i+s)-a)%r+r)%r+a)!==t&&n-s<=l&&0":return n?t=":return n?t<=i:i<=t;case"<=":return n?i<=t:t<=i}},c.prototype.on=function(t,e,i,n){t.addEventListener?t.addEventListener(e,i,n):t.attachEvent&&t.attachEvent("on"+e,i)},c.prototype.off=function(t,e,i,n){t.removeEventListener?t.removeEventListener(e,i,n):t.detachEvent&&t.detachEvent("on"+e,i)},c.prototype.trigger=function(t,e,i,n,s){var o={item:{count:this._items.length,index:this.current()}},r=l.camelCase(l.grep(["on",t,i],function(t){return t}).join("-").toLowerCase()),a=l.Event([t,"owl",i||"carousel"].join(".").toLowerCase(),l.extend({relatedTarget:this},o,e));return this._supress[t]||(l.each(this._plugins,function(t,e){e.onTrigger&&e.onTrigger(a)}),this.register({type:c.Type.Event,name:t}),this.$element.trigger(a),this.settings&&"function"==typeof this.settings[r]&&this.settings[r].call(this,a)),a},c.prototype.enter=function(t){l.each([t].concat(this._states.tags[t]||[]),l.proxy(function(t,e){this._states.current[e]===o&&(this._states.current[e]=0),this._states.current[e]++},this))},c.prototype.leave=function(t){l.each([t].concat(this._states.tags[t]||[]),l.proxy(function(t,e){this._states.current[e]--},this))},c.prototype.register=function(i){if(i.type===c.Type.Event){if(l.event.special[i.name]||(l.event.special[i.name]={}),!l.event.special[i.name].owl){var e=l.event.special[i.name]._default;l.event.special[i.name]._default=function(t){return!e||!e.apply||t.namespace&&-1!==t.namespace.indexOf("owl")?t.namespace&&-1',n=c.lazyLoad?'
':'
',e.after(n),e.after('
')}var n,s,o=t.width&&t.height?'style="width:'+t.width+"px;height:"+t.height+'px;"':"",r=e.find("img"),a="src",l="",c=this._core.settings;if(e.wrap('
"),this._core.settings.lazyLoad&&(a="data-src",l="owl-lazy"),r.length)return i(r.attr(a)),r.remove(),!1;"youtube"===t.type?(s="//img.youtube.com/vi/"+t.id+"/hqdefault.jpg",i(s)):"vimeo"===t.type?u.ajax({type:"GET",url:"//vimeo.com/api/v2/video/"+t.id+".json",jsonp:"callback",dataType:"jsonp",success:function(t){s=t[0].thumbnail_large,i(s)}}):"vzaar"===t.type&&u.ajax({type:"GET",url:"//vzaar.com/api/videos/"+t.id+".json",jsonp:"callback",dataType:"jsonp",success:function(t){s=t.framegrab_url,i(s)}})},i.prototype.stop=function(){this._core.trigger("stop",null,"video"),this._playing.find(".owl-video-frame").remove(),this._playing.removeClass("owl-video-playing"),this._playing=null,this._core.leave("playing"),this._core.trigger("stopped",null,"video")},i.prototype.play=function(t){var e,i=u(t.target).closest("."+this._core.settings.itemClass),n=this._videos[i.attr("data-video")],s=n.width||"100%",o=n.height||this._core.$stage.height();this._playing||(this._core.enter("playing"),this._core.trigger("play",null,"video"),i=this._core.items(this._core.relative(i.index())),this._core.reset(i.index()),"youtube"===n.type?e='':"vimeo"===n.type?e='':"vzaar"===n.type&&(e=''),u(''+e+"
").insertAfter(i.find(".owl-video")),this._playing=i.addClass("owl-video-playing"))},i.prototype.isInFullScreen=function(){var t=e.fullscreenElement||e.mozFullScreenElement||e.webkitFullscreenElement;return t&&u(t).parent().hasClass("owl-video-frame")},i.prototype.destroy=function(){var t,e;for(t in this._core.$element.off("click.owl.video"),this._handlers)this._core.$element.off(t,this._handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&&(this[e]=null)},u.fn.owlCarousel.Constructor.Plugins.Video=i}(window.Zepto||window.jQuery,window,document),function(r){var e=function(t){this.core=t,this.core.options=r.extend({},e.Defaults,this.core.options),this.swapping=!0,this.previous=void 0,this.next=void 0,this.handlers={"change.owl.carousel":r.proxy(function(t){t.namespace&&"position"==t.property.name&&(this.previous=this.core.current(),this.next=t.property.value)},this),"drag.owl.carousel dragged.owl.carousel translated.owl.carousel":r.proxy(function(t){t.namespace&&(this.swapping="translated"==t.type)},this),"translate.owl.carousel":r.proxy(function(t){t.namespace&&this.swapping&&(this.core.options.animateOut||this.core.options.animateIn)&&this.swap()},this)},this.core.$element.on(this.handlers)};e.Defaults={animateOut:!1,animateIn:!1},e.prototype.swap=function(){if(1===this.core.settings.items&&r.support.animation&&r.support.transition){this.core.speed(0);var t,e=r.proxy(this.clear,this),i=this.core.$stage.children().eq(this.previous),n=this.core.$stage.children().eq(this.next),s=this.core.settings.animateIn,o=this.core.settings.animateOut;this.core.current()!==this.previous&&(o&&(t=this.core.coordinates(this.previous)-this.core.coordinates(this.next),i.one(r.support.animation.end,e).css({left:t+"px"}).addClass("animated owl-animated-out").addClass(o)),s&&n.one(r.support.animation.end,e).addClass("animated owl-animated-in").addClass(s))}},e.prototype.clear=function(t){r(t.target).css({left:""}).removeClass("animated owl-animated-out owl-animated-in").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut),this.core.onTransitionEnd()},e.prototype.destroy=function(){var t,e;for(t in this.handlers)this.core.$element.off(t,this.handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&&(this[e]=null)},r.fn.owlCarousel.Constructor.Plugins.Animate=e}(window.Zepto||window.jQuery,window,document),function(i,n,s){var e=function(t){this._core=t,this._timeout=null,this._paused=!1,this._handlers={"changed.owl.carousel":i.proxy(function(t){t.namespace&&"settings"===t.property.name?this._core.settings.autoplay?this.play():this.stop():t.namespace&&"position"===t.property.name&&this._core.settings.autoplay&&this._setAutoPlayInterval()},this),"initialized.owl.carousel":i.proxy(function(t){t.namespace&&this._core.settings.autoplay&&this.play()},this),"play.owl.autoplay":i.proxy(function(t,e,i){t.namespace&&this.play(e,i)},this),"stop.owl.autoplay":i.proxy(function(t){t.namespace&&this.stop()},this),"mouseover.owl.autoplay":i.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"mouseleave.owl.autoplay":i.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.play()},this),"touchstart.owl.core":i.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"touchend.owl.core":i.proxy(function(){this._core.settings.autoplayHoverPause&&this.play()},this)},this._core.$element.on(this._handlers),this._core.options=i.extend({},e.Defaults,this._core.options)};e.Defaults={autoplay:!1,autoplayTimeout:5e3,autoplayHoverPause:!1,autoplaySpeed:!1},e.prototype.play=function(t,e){this._paused=!1,this._core.is("rotating")||(this._core.enter("rotating"),this._setAutoPlayInterval())},e.prototype._getNextTimeout=function(t,e){return this._timeout&&n.clearTimeout(this._timeout),n.setTimeout(i.proxy(function(){this._paused||this._core.is("busy")||this._core.is("interacting")||s.hidden||this._core.next(e||this._core.settings.autoplaySpeed)},this),t||this._core.settings.autoplayTimeout)},e.prototype._setAutoPlayInterval=function(){this._timeout=this._getNextTimeout()},e.prototype.stop=function(){this._core.is("rotating")&&(n.clearTimeout(this._timeout),this._core.leave("rotating"))},e.prototype.pause=function(){this._core.is("rotating")&&(this._paused=!0)},e.prototype.destroy=function(){var t,e;for(t in this.stop(),this._handlers)this._core.$element.off(t,this._handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&&(this[e]=null)},i.fn.owlCarousel.Constructor.Plugins.autoplay=e}(window.Zepto||window.jQuery,window,document),function(o){"use strict";var e=function(t){this._core=t,this._initialized=!1,this._pages=[],this._controls={},this._templates=[],this.$element=this._core.$element,this._overrides={next:this._core.next,prev:this._core.prev,to:this._core.to},this._handlers={"prepared.owl.carousel":o.proxy(function(t){t.namespace&&this._core.settings.dotsData&&this._templates.push(''+o(t.content).find("[data-dot]").addBack("[data-dot]").attr("data-dot")+"
")},this),"added.owl.carousel":o.proxy(function(t){t.namespace&&this._core.settings.dotsData&&this._templates.splice(t.position,0,this._templates.pop())},this),"remove.owl.carousel":o.proxy(function(t){t.namespace&&this._core.settings.dotsData&&this._templates.splice(t.position,1)},this),"changed.owl.carousel":o.proxy(function(t){t.namespace&&"position"==t.property.name&&this.draw()},this),"initialized.owl.carousel":o.proxy(function(t){t.namespace&&!this._initialized&&(this._core.trigger("initialize",null,"navigation"),this.initialize(),this.update(),this.draw(),this._initialized=!0,this._core.trigger("initialized",null,"navigation"))},this),"refreshed.owl.carousel":o.proxy(function(t){t.namespace&&this._initialized&&(this._core.trigger("refresh",null,"navigation"),this.update(),this.draw(),this._core.trigger("refreshed",null,"navigation"))},this)},this._core.options=o.extend({},e.Defaults,this._core.options),this.$element.on(this._handlers)};e.Defaults={nav:!1,navText:["prev","next"],navSpeed:!1,navElement:"div",navContainer:!1,navContainerClass:"owl-nav",navClass:["owl-prev","owl-next"],slideBy:1,dotClass:"owl-dot",dotsClass:"owl-dots",dots:!0,dotsEach:!1,dotsData:!1,dotsSpeed:!1,dotsContainer:!1},e.prototype.initialize=function(){var t,i=this._core.settings;for(t in this._controls.$relative=(i.navContainer?o(i.navContainer):o("").addClass(i.navContainerClass).appendTo(this.$element)).addClass("disabled"),this._controls.$previous=o("<"+i.navElement+">").addClass(i.navClass[0]).html(i.navText[0]).prependTo(this._controls.$relative).on("click",o.proxy(function(){this.prev(i.navSpeed)},this)),this._controls.$next=o("<"+i.navElement+">").addClass(i.navClass[1]).html(i.navText[1]).appendTo(this._controls.$relative).on("click",o.proxy(function(){this.next(i.navSpeed)},this)),i.dotsData||(this._templates=[o("
").addClass(i.dotClass).append(o("
")).prop("outerHTML")]),this._controls.$absolute=(i.dotsContainer?o(i.dotsContainer):o("").addClass(i.dotsClass).appendTo(this.$element)).addClass("disabled"),this._controls.$absolute.on("click","div",o.proxy(function(t){var e=o(t.target).parent().is(this._controls.$absolute)?o(t.target).index():o(t.target).parent().index();t.preventDefault(),this.to(e,i.dotsSpeed)},this)),this._overrides)this._core[t]=o.proxy(this[t],this)},e.prototype.destroy=function(){var t,e,i,n;for(t in this._handlers)this.$element.off(t,this._handlers[t]);for(e in this._controls)this._controls[e].remove();for(n in this.overides)this._core[n]=this._overrides[n];for(i in Object.getOwnPropertyNames(this))"function"!=typeof this[i]&&(this[i]=null)},e.prototype.update=function(){var t,e,i=this._core.clones().length/2,n=i+this._core.items().length,s=this._core.maximum(!0),o=this._core.settings,r=o.center||o.autoWidth||o.dotsData?1:o.dotsEach||o.items;if("page"!==o.slideBy&&(o.slideBy=Math.min(o.slideBy,o.items)),o.dots||"page"==o.slideBy)for(this._pages=[],t=i,e=0;t
=this._core.maximum(!0))),this._controls.$absolute.toggleClass("disabled",!e.dots||i),e.dots&&(t=this._pages.length-this._controls.$absolute.children().length,e.dotsData&&0!=t?this._controls.$absolute.html(this._templates.join("")):0=e},this)).pop()},e.prototype.getPosition=function(t){var e,i,n=this._core.settings;return"page"==n.slideBy?(e=o.inArray(this.current(),this._pages),i=this._pages.length,t?++e:--e,e=this._pages[(e%i+i)%i].start):(e=this._core.relative(this._core.current()),i=this._core.items().length,t?e+=n.slideBy:e-=n.slideBy),e},e.prototype.next=function(t){o.proxy(this._overrides.to,this._core)(this.getPosition(!0),t)},e.prototype.prev=function(t){o.proxy(this._overrides.to,this._core)(this.getPosition(!1),t)},e.prototype.to=function(t,e,i){var n;!i&&this._pages.length?(n=this._pages.length,o.proxy(this._overrides.to,this._core)(this._pages[(t%n+n)%n].start,e)):o.proxy(this._overrides.to,this._core)(t,e)},o.fn.owlCarousel.Constructor.Plugins.Navigation=e}(window.Zepto||window.jQuery,window,document),function(n,s){"use strict";var e=function(t){this._core=t,this._hashes={},this.$element=this._core.$element,this._handlers={"initialized.owl.carousel":n.proxy(function(t){t.namespace&&"URLHash"===this._core.settings.startPosition&&n(s).trigger("hashchange.owl.navigation")},this),"prepared.owl.carousel":n.proxy(function(t){if(t.namespace){var e=n(t.content).find("[data-hash]").addBack("[data-hash]").attr("data-hash");if(!e)return;this._hashes[e]=t.content}},this),"changed.owl.carousel":n.proxy(function(t){if(t.namespace&&"position"===t.property.name){var i=this._core.items(this._core.relative(this._core.current())),e=n.map(this._hashes,function(t,e){return t===i?e:null}).join();if(!e||s.location.hash.slice(1)===e)return;s.location.hash=e}},this)},this._core.options=n.extend({},e.Defaults,this._core.options),this.$element.on(this._handlers),n(s).on("hashchange.owl.navigation",n.proxy(function(){var t=s.location.hash.substring(1),e=this._core.$stage.children(),i=this._hashes[t]&&e.index(this._hashes[t]);void 0!==i&&i!==this._core.current()&&this._core.to(this._core.relative(i),!1,!0)},this))};e.Defaults={URLhashListener:!1},e.prototype.destroy=function(){var t,e;for(t in n(s).off("hashchange.owl.navigation"),this._handlers)this._core.$element.off(t,this._handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&&(this[e]=null)},n.fn.owlCarousel.Constructor.Plugins.Hash=e}(window.Zepto||window.jQuery,window,document),function(s,t,e,o){var r=s("").get(0).style,a="Webkit Moz O ms".split(" "),i={transition:{end:{WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"}},animation:{end:{WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",OAnimation:"oAnimationEnd",animation:"animationend"}}},n=function(){return!!u("transform")},l=function(){return!!u("perspective")},c=function(){return!!u("animation")};function u(t,i){var n=!1,e=t.charAt(0).toUpperCase()+t.slice(1);return s.each((t+" "+a.join(e+" ")+e).split(" "),function(t,e){if(r[e]!==o)return n=!i||e,!1}),n}function h(t){return u(t,!0)}!function(){return!!u("transition")}()||(s.support.transition=new String(h("transition")),s.support.transition.end=i.transition.end[s.support.transition]),c()&&(s.support.animation=new String(h("animation")),s.support.animation.end=i.animation.end[s.support.animation]),n()&&(s.support.transform=new String(h("transform")),s.support.transform3d=l())}(window.Zepto||window.jQuery,window,document),function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():t.PhotoSwipeUI_Default=e()}(this,function(){"use strict";return function(s,a){function t(t){if(k)return!0;t=t||window.event,T.timeToIdle&&T.mouseUsed&&!w&&L();for(var e,i,n=(t.target||t.srcElement).getAttribute("class")||"",s=0;sT.fitControlsWidth){var i=T.barsSize;if(T.captionEl&&"auto"===i.bottom)if(m||((m=a.createEl("pswp__caption pswp__caption--fake")).appendChild(a.createEl("pswp__caption__center")),d.insertBefore(m,p),a.addClass(d,"pswp__ui--fit")),T.addCaptionHTMLFn(t,m,!0)){var n=m.clientHeight;e.bottom=parseInt(n,10)||44}else e.bottom=i.top;else e.bottom="auto"===i.bottom?0:i.bottom;e.top=i.top}else e.top=e.bottom=0}var h,d,p,m,f,g,v,y,w,_,x,b,C,A,T,k,E,I,S=this,z=!1,D=!0,M=!0,P={barsSize:{top:44,bottom:"auto"},closeElClasses:["item","caption","zoom-wrap","ui","top-bar"],timeToIdle:4e3,timeToIdleOutside:1e3,loadingIndicatorDelay:1e3,addCaptionHTMLFn:function(t,e){return t.title?(e.children[0].innerHTML=t.title,!0):(e.children[0].innerHTML="",!1)},closeEl:!0,captionEl:!0,fullscreenEl:!0,zoomEl:!0,shareEl:!0,counterEl:!0,arrowEl:!0,preloaderEl:!0,tapToClose:!1,tapToToggleControls:!0,clickToCloseNonZoomable:!0,shareButtons:[{id:"facebook",label:"Share on Facebook",url:"https://www.facebook.com/sharer/sharer.php?u={{url}}"},{id:"twitter",label:"Tweet",url:"https://twitter.com/intent/tweet?text={{text}}&url={{url}}"},{id:"pinterest",label:"Pin it",url:"http://www.pinterest.com/pin/create/button/?url={{url}}&media={{image_url}}&description={{text}}"},{id:"download",label:"Download image",url:"{{raw_image_url}}",download:!0}],getImageURLForShare:function(){return s.currItem.src||""},getPageURLForShare:function(){return window.location.href},getTextForShare:function(){return s.currItem.title||""},indexIndicatorSep:" / ",fitControlsWidth:1200},O=function(){for(var t,e,i,n,s="",o=0;o"+t.label+"",T.parseShareButtonOut&&(s=T.parseShareButtonOut(t,s));v.children[0].innerHTML=s,v.children[0].onclick=r},$=0,L=function(){clearTimeout(I),$=0,w&&S.setIdle(!1)},R=function(t){b!==t&&(i(x,"preloader--active",!t),b=t)},F=[{name:"caption",option:"captionEl",onInit:function(t){p=t}},{name:"share-modal",option:"shareEl",onInit:function(t){v=t},onTap:function(){o()}},{name:"button--share",option:"shareEl",onInit:function(t){g=t},onTap:function(){o()}},{name:"button--zoom",option:"zoomEl",onTap:s.toggleDesktopZoom},{name:"counter",option:"counterEl",onInit:function(t){f=t}},{name:"button--close",option:"closeEl",onTap:s.close},{name:"button--arrow--left",option:"arrowEl",onTap:s.prev},{name:"button--arrow--right",option:"arrowEl",onTap:s.next},{name:"button--fs",option:"fullscreenEl",onTap:function(){h.isFullscreen()?h.exit():h.enter()}},{name:"preloader",option:"preloaderEl",onInit:function(t){x=t}}];S.init=function(){a.extend(s.options,P,!0),T=s.options,d=a.getChildByClass(s.scrollWrap,"pswp__ui"),_=s.listen,function(){var e;_("onVerticalDrag",function(t){D&&t<.95?S.hideControls():!D&&.95<=t&&S.showControls()}),_("onPinchClose",function(t){D&&t<.9?(S.hideControls(),e=!0):e&&!D&&.9=Ue()-1&&n<0)&&(t=_e.x+n*g.mainScrollEndFriction)}_e.x=t,ie(t,H)}function c(t,e){var i=xe[t]-Kt[t];return Zt[t]+Wt[t]+i-e/V*i}function w(t,e){t.x=e.x,t.y=e.y,e.id&&(t.id=e.id)}function d(t){t.x=Math.round(t.x),t.y=Math.round(t.y)}function _(t,e){var i=Qe(f.currItem,Bt,t);return e&&(Mt=i),i}function x(t){return t||(t=f.currItem),t.initialZoomLevel}function b(t){return t||(t=f.currItem),0e.min[t]?(i[t]=e.min[t],!0):i[t]Mt.min[t]||rMt.min[t]&&(i=g.panEndFriction,Mt.min[t]-r,n=Mt.min[t]-Zt[t]),(n<=0||c<0)&&1me.x&&(o=me.x)):Mt.min.x!==Mt.max.x&&(s=r)):(rf.currItem.fitRatio&&(Ht[t]+=e[t]*i)}function L(t){if(!("mousedown"===t.type&&0f.currItem.fitRatio&&Me(wt):$e())}}var j,N,W,Z,H,B,U,K,q,G,V,Q,Y,X,J,tt,et,it,nt,st,ot,rt,at,lt,ct,ut,ht,dt,pt,mt,ft,gt,vt,yt,wt,_t,xt,bt,Ct,At,Tt,kt,Et,It,St,zt,Dt,Mt,Pt,Ot,$t,Lt,Rt,Ft,jt,Nt,Wt={x:0,y:0},Zt={x:0,y:0},Ht={x:0,y:0},Bt={},Ut=0,Kt={},qt={x:0,y:0},Gt=0,Vt=!0,Qt=[],Yt={},Xt=!1,Jt={},te=function(t){Pt&&(t&&(G>f.currItem.fitRatio?Xt||(Ye(f.currItem,!1,!0),Xt=!0):Xt&&(Ye(f.currItem),Xt=!1)),s(Pt,Ht.x,Ht.y,G))},ee=function(t){t.container&&s(t.container.style,t.initialPosition.x,t.initialPosition.y,t.initialZoomLevel,t)},ie=function(t,e){e[rt]=Q+t+"px, 0px"+Y},ne=null,se=function(){ne&&(m.unbind(document,"mousemove",se),m.addClass(p,"pswp--has_mouse"),g.mouseUsed=!0,v("mouseUsed")),ne=setTimeout(function(){ne=null},100)},oe={},re=0,ae={shout:v,listen:o,viewportSize:Bt,options:g,isMainScrollAnimating:function(){return Ot},getZoomLevel:function(){return G},getCurrentIndex:function(){return Z},isDragging:function(){return Ct},isZooming:function(){return zt},setScrollOffset:function(t,e){Kt.x=t,mt=Kt.y=e,v("updateScrollOffset",Kt)},applyZoomPan:function(t,e,i,n){Ht.x=e,Ht.y=i,G=t,te(n)},init:function(){if(!j&&!N){var t;f.framework=m,f.template=p,f.bg=m.getChildByClass(p,"pswp__bg"),ht=p.className,j=!0,ft=m.detectFeatures(),ct=ft.raf,ut=ft.caf,rt=ft.transform,pt=ft.oldIE,f.scrollWrap=m.getChildByClass(p,"pswp__scroll-wrap"),f.container=m.getChildByClass(f.scrollWrap,"pswp__container"),H=f.container.style,f.itemHolders=tt=[{el:f.container.children[0],wrap:0,index:-1},{el:f.container.children[1],wrap:0,index:-1},{el:f.container.children[2],wrap:0,index:-1}],tt[0].el.style.display=tt[2].el.style.display="none",function(){if(rt){var t=ft.perspective&&!lt;return Q="translate"+(t?"3d(":"("),Y=ft.perspective?", 0px)":")"}rt="left",m.addClass(p,"pswp--ie"),ie=function(t,e){e.left=t+"px"},ee=function(t){var e=1=Ue())&&(Z=0),f.currItem=Be(Z),(ft.isOldIOSPhone||ft.isOldAndroid)&&(Vt=!1),p.setAttribute("aria-hidden","false"),g.modal&&(Vt?p.style.position="fixed":(p.style.position="absolute",p.style.top=m.getScrollY()+"px")),void 0===mt&&(v("initialLayout"),mt=dt=m.getScrollY());var i="pswp--open ";for(g.mainClass&&(i+=g.mainClass+" "),g.showHideOpacity&&(i+="pswp--animate_opacity "),i+=lt?"pswp--touch":"pswp--notouch",i+=ft.animationName?" pswp--css_animation":"",i+=ft.svg?" pswp--svg":"",m.addClass(p,i),f.updateSize(),B=-1,Gt=null,t=0;t<3;t++)ie((t+B)*qt.x,tt[t].el.style);pt||m.bind(f.scrollWrap,K,f),o("initialZoomInEnd",function(){f.setContent(tt[0],Z-1),f.setContent(tt[2],Z+1),tt[0].el.style.display=tt[2].el.style.display="block",g.focus&&p.focus(),m.bind(document,"keydown",f),ft.transform&&m.bind(f.scrollWrap,"click",f),g.mouseUsed||m.bind(document,"mousemove",se),m.bind(window,"resize scroll orientationchange",f),v("bindEvents")}),f.setContent(tt[1],Z),f.updateCurrItem(),v("afterInit"),Vt||(X=setInterval(function(){re||Ct||zt||G!==f.currItem.initialZoomLevel||f.updateSize()},1e3)),m.addClass(p,"pswp--visible")}},close:function(){j&&(N=!(j=!1),v("close"),m.unbind(window,"resize scroll orientationchange",f),m.unbind(window,"scroll",q.scroll),m.unbind(document,"keydown",f),m.unbind(document,"mousemove",se),ft.transform&&m.unbind(f.scrollWrap,"click",f),Ct&&m.unbind(window,U,f),clearTimeout(gt),v("unbindEvents"),Ke(f.currItem,null,!0,f.destroy))},destroy:function(){v("destroy"),Ne&&clearTimeout(Ne),p.setAttribute("aria-hidden","true"),p.className=ht,X&&clearInterval(X),m.unbind(f.scrollWrap,K,f),m.unbind(window,"scroll",f),Ce(),E(),Jt=null},panTo:function(t,e,i){i||(t>Mt.min.x?t=Mt.min.x:tMt.min.y?e=Mt.min.y:ef.currItem.initialZoomLevel+f.currItem.initialZoomLevel/15&&(jt=!0);var n=1,s=x(),o=b();if(iMt.min[e]?n.backAnimDestination[e]=Mt.min[e]:Ht[e]=Ue()&&(Z=g.loop?0:Ue()-1,s=!0),s&&!g.loop||(Gt+=n,Ut-=n,i=!0));var a,l=qt.x*Ut,c=Math.abs(l-_e.x);return a=i||l>_e.x==0The image could not be loaded. ',forceProgressiveLoading:!1,preload:[1,1],getNumItemsFn:function(){return We.length}},Qe=function(t,e,i){if(!t.src||t.loadError)return t.w=t.h=0,t.initialZoomLevel=t.fitRatio=1,t.bounds={center:{x:0,y:0},max:{x:0,y:0},min:{x:0,y:0}},t.initialPosition=t.bounds.center,t.bounds;var n=!i;if(n&&(t.vGap||(t.vGap={top:0,bottom:0}),v("parseVerticalMargin",t)),qe.x=e.x,qe.y=e.y-t.vGap.top-t.vGap.bottom,n){var s=qe.x/t.w,o=qe.y/t.h;t.fitRatio=sqe.x?Math.round(qe.x-e):n.center.x,n.max.y=i>qe.y?Math.round(qe.y-i)+t.vGap.top:n.center.y,n.min.x=e>qe.x?0:n.center.x,n.min.y=i>qe.y?t.vGap.top:n.center.y}(t,t.w*i,t.h*i),n&&i===t.initialZoomLevel&&(t.initialPosition=t.bounds.center),t.bounds):void 0},Ye=function(t,e,i){if(t.src){e||(e=t.container.lastChild);var n=i?t.w:Math.round(t.w*t.fitRatio),s=i?t.h:Math.round(t.h*t.fitRatio);t.placeholder&&!t.loaded&&(t.placeholder.style.width=n+"px",t.placeholder.style.height=s+"px"),e.style.width=n+"px",e.style.height=s+"px"}};i("Controller",{publicMethods:{lazyLoadItem:function(t){t=l(t);var e=Be(t);e&&(!e.loaded&&!e.loading||J)&&(v("gettingData",t,e),e.src&&Re(e))},initController:function(){m.extend(g,Ve,!0),f.items=We=t,Be=f.getItemAt,Ue=g.getNumItemsFn,g.loop,Ue()<3&&(g.loop=!1),o("beforeChange",function(t){var e,i=g.preload,n=null===t||0<=t,s=Math.min(i[0],Ue()),o=Math.min(i[1],Ue());for(e=1;e<=(n?o:s);e++)f.lazyLoadItem(Z+e);for(e=1;e<=(n?s:o);e++)f.lazyLoadItem(Z-e)}),o("initialLayout",function(){f.currItem.initialLayout=g.getThumbBoundsFn&&g.getThumbBoundsFn(Z)}),o("mainScrollAnimComplete",je),o("initialZoomInEnd",je),o("destroy",function(){for(var t,e=0;e=Mt.max.x&&i<=Mt.min.y&&i>=Mt.max.y)&&t.preventDefault(),f.panTo(e,i)},toggleDesktopZoom:function(t){t=t||{x:Bt.x/2+Kt.x,y:Bt.y/2+Kt.y};var e=g.getDoubleTapZoom(!0,f.currItem),i=G===e;f.mouseZoomedIn=!i,f.zoomTo(i?f.currItem.initialZoomLevel:e,t,333),m[(i?"remove":"add")+"Class"](p,"pswp--zoomed-in")}}});function ii(){return fi.hash.substring(1)}function ni(){oi&&clearTimeout(oi),ai&&clearTimeout(ai)}function si(){var t=ii(),e={};if(t.length<5)return e;var i,n=t.split("&");for(i=0;it._pfLastSize)&&(t._pfLastSize=t.offsetWidth,i=t.sizes,t.sizes+=",100vw",setTimeout(function(){t.sizes=i}))}function r(){var t,e=document.querySelectorAll("picture > img, img[srcset][sizes]");for(t=0;t=",/max-([a-z-\s]+):/g,"e.$1<=",/calc([^)]+)/g,"($1)",/(\d+[\.]*[\d]*)([a-z]+)/g,"($1 * e.$2)",/^(?!(e.[a-z]|[0-9\.&=|><\+\-\*\(\)\/])).*/gi,"")+";"}),function(t,e){var i;if(!(t in I))if(I[t]=!1,e&&(i=t.match(Z)))I[t]=i[1]*D[i[2]];else try{I[t]=new Function("e",H(t))(D)}catch(t){}return I[t]}),at=function(t){if(a){var e,i,n,s=t||{};if(s.elements&&1===s.elements.nodeType&&("IMG"===s.elements.nodeName.toUpperCase()?s.elements=[s.elements]:(s.context=s.elements,s.elements=null)),n=(e=s.elements||w.qsa(s.context||o,s.reevaluate||s.reselect?w.sel:w.selShort)).length){for(w.setupRun(s),P=!0,i=0;iimg,img[srcset]",w.sel=w.selShort,w.cfg=_,w.DPR=z||1,w.u=D,w.types=f,w.setSize=e,w.makeUrl=n(function(t){return M.href=t,M.href}),w.qsa=function(t,e){return"querySelector"in t?t.querySelectorAll(e):[]},w.matchesMedia=function(){return t.matchMedia&&(matchMedia("(min-width: 0.1em)")||{}).matches?w.matchesMedia=function(t){return!t||matchMedia(t).matches}:w.matchesMedia=w.mMQ,w.matchesMedia.apply(this,arguments)},w.mMQ=function(t){return!t||rt(t)},w.calcLength=function(t){var e=rt(t,!0)||!1;return e<0&&(e=!1),e},w.supportsType=function(t){return!t||f[t]},w.parseSize=n(function(t){var e=(t||"").match(A);return{media:e&&e[1],length:e&&e[2]}}),w.parseSet=function(t){return t.cands||(t.cands=function(n,h){function t(t){var e,i=t.exec(n.substring(r));if(i)return e=i[0],r+=e.length,e}var d,p,e,i,s,o=n.length,r=0,m=[];function a(){var t,e,i,n,s,o,r,a,l,c=!1,u={};for(n=0;ny)||(l.cached=!0,l.res>=y&&(r=l))),!r)for(t.sort(lt),r=t[(o=t.length)-1],n=0;n=y){r=t[s=n-1]&&(u||a!==w.makeUrl(i.url))&&(h=t[s].res,d=i.res,p=y,m=t[s].cached,g=f=void 0,p<("saveData"===_.algorithm?2.7 "))&&b.css("position",r.css("position")),(_=function(){var t,e,i;if(!p)return v=C.height(),t=parseInt(w.css("border-top-width"),10),e=parseInt(w.css("padding-top"),10),a=parseInt(w.css("padding-bottom"),10),l=w.offset().top+t+e,c=w.height(),f&&(m=f=!1,null==k&&(r.insertAfter(b),b.detach()),r.css({position:"",top:"",width:"",bottom:""}).removeClass(S),i=!0),u=r.offset().top-(parseInt(r.css("margin-top"),10)||0)-E,h=r.outerHeight(!0),d=r.css("float"),b&&b.css({width:s(r),height:h,display:r.css("display"),"vertical-align":r.css("vertical-align"),float:d}),i?n():void 0})(),h!==c)return g=void 0,y=E,x=I,n=function(){var t,e,i,n,s,o;if(!p)return i=!1,null!=x&&(x-=1)<=0&&(x=I,_(),i=!0),i||C.height()===v||(_(),i=!0),n=D.scrollTop(),null!=g&&(e=n-g),g=n,f?(A&&(s=c+l=opinion_js_settings.header_sticky_offset?a("body").hasClass("opinion-header-sticky-active")||a("body").addClass("opinion-header-sticky-active"):a("body").hasClass("opinion-header-sticky-active")&&a("body").removeClass("opinion-header-sticky-active"):e>=opinion_js_settings.header_sticky_offset?a("body").hasClass("opinion-header-sticky-active")||a("body").addClass("opinion-header-sticky-active"):a("body").hasClass("opinion-header-sticky-active")&&a("body").removeClass("opinion-header-sticky-active"),this.settings.window_last_top=e},sticky_bottom:function(){return!!opinion_js_settings.single_sticky_bottom&&(!!a(".opinion-sticky-bottom").length&&void a("body").imagesLoaded(function(){var t=a(".opinion-single").height()<1100?200:300,e=a(".opinion-single").offset().top+a(".opinion-single").height()-a(window).height(),i=a("#opinion-footer").offset().top-a(window).height(),n=a(window).scrollTop();t ')}),a("body").imagesLoaded(function(){var t=a(".opinion-sticky"),s=window.matchMedia("(min-width: "+l.settings.breakpoints.lg_spec+"px)").matches?52:26;t.each(function(){var t=a(this).closest(".section-content").find(".opinion-order-1"),e=a(this).parent(),i=(a(".opinion-header-sticky").length&&!opinion_js_settings.header_sticky_up?a(".opinion-header-sticky").outerHeight():0)+("fixed"==l.settings.admin_bar.position?l.settings.admin_bar.height:0)+s,n=a(this).children().addClass("widget-sticky");window.matchMedia("(min-width: "+l.settings.breakpoints.lg+"px)").matches?(e.height(t.height()),a(this).stick_in_parent({offset_top:i})):(e.css("height","auto"),e.css("min-height","1px"),n.unwrap()),l.masonry_widgets()})})):l.masonry_widgets()},masonry_widgets:function(){if(!a(".opinion-sidebar").not(".opinion-sidebar-hidden").length)return!1;a("body").imagesLoaded(function(){a(".opinion-sidebar").not(".opinion-sidebar-hidden").each(function(){window.matchMedia("(min-width: "+l.settings.breakpoints.lg+"px)").matches?a(this).hasClass("has-masonry")&&a(this).removeClass("has-masonry").masonry("destroy"):a(this).addClass("has-masonry").masonry({columnWidth:".col-md-6",percentPosition:!0})})})},masonry_layouts:function(){a(".opinion-masonry").each(function(){var t=a(this),e=a(this).attr("class").match(/opinion-masonry-base-(\d+)/)[1];t.imagesLoaded(function(){t.find(".opinion-posts").masonry({columnWidth:".col-lg-"+e,percentPosition:!0})})})},overlay_open:function(){a("body").on("click",".opinion-open-popup",function(t){t.preventDefault(),a("body").addClass("overlay-action-open overlay-lock"),a(this).next().clone().appendTo(".opinion-action-overlay")}),a("body").on("click",".opinion-action-close",function(){a("body").removeClass("overlay-action-open overlay-lock overlay-sidebar-open"),a(".opinion-action-overlay").html("")}),a(document).keyup(function(t){27==t.keyCode&&a("body").hasClass("overlay-action-open")&&(a("body").removeClass("overlay-action-open overlay-lock overlay-sidebar-open"),a(".opinion-action-overlay").html(""))})},sidebar_open:function(){a("body").on("click",".opinion-open-sidebar",function(t){t.preventDefault();var e="fixed"==l.settings.admin_bar.position||0==a(window).scrollTop()?l.settings.admin_bar.height:0;a(".opinion-sidebar-hidden").css("top",e),a("body").addClass("overlay-action-open overlay-lock overlay-sidebar-open")}),a("body").on("click",".opinion-action-close",function(){a("body").removeClass("overlay-action-open overlay-lock overlay-sidebar-open")})},overlay_close:function(){a("body").on("mouseup",".opinion-action-overlay",function(t){t.preventDefault(),t.target===this&&(a("body").removeClass("overlay-action-open overlay-lock overlay-sidebar-open"),a(".opinion-action-overlay").html(""))})},gutenberg_gallery:function(){var t=a(".wp-block-gallery");if(t.length){var n=document.querySelectorAll(".wp-block-gallery img");t.find("a").each(function(t){var e=n[t].naturalWidth,i=n[t].naturalHeight;a(this).attr("data-size",JSON.stringify({w:e,h:i}))})}},popup:function(){if(!opinion_js_settings.gallery_popup)return!1;a("body").on("click",".gallery-item a, a.opinion-popup-img, .wp-block-gallery a",function(t){t.preventDefault();var e=document.querySelectorAll(".pswp")[0],n=[],s=0,o=a(this),i=!!o.closest(".gallery, .wp-block-gallery").hasClass("owl-carousel"),r=[];r=!o.hasClass("opinion-popup-img")?i?a(this).closest(".gallery, .wp-block-gallery").find(".owl-item:not(.cloned) .gallery-item a, .owl-item:not(.cloned) .blocks-gallery-item a"):a(this).closest(".gallery, .wp-block-gallery").find(".gallery-item a, .blocks-gallery-item a"):a("a.opinion-popup-img"),a.each(r,function(t){o.attr("href")==a(this).attr("href")&&(s=t);var e=JSON.parse(a(this).attr("data-size")),i={src:a(this).attr("href"),w:e.w,h:e.h,title:a(this).closest("figure").find("figcaption").html()};n.push(i)}),new PhotoSwipe(e,PhotoSwipeUI_Default,n,{history:!1,index:s,preload:[2,2],captionEl:!0,fullscreenEl:!1,zoomEl:!1,shareEl:!1,preloaderEl:!0,closeOnScroll:!1}).init()})},pagination:function(){if(a("body").on("click",".opinion-pagination.load-more > a",function(t){t.preventDefault(),l.load_more_items({opener:a(this),url:a(this).attr("href"),next_url_selector:".opinion-pagination.load-more > a"},function(){})}),!a(".opinion-pagination.opinion-infinite-scroll").length)return!1;a(window).scroll(function(){if(l.settings.infinite_allow&&a(".opinion-pagination").length){var t=a(".opinion-pagination"),e=t.find("a");a(this).scrollTop()>t.offset().top-a(this).height()-200&&(l.settings.infinite_allow=!1,l.load_more_items({opener:e,url:e.attr("href"),next_url_selector:".opinion-pagination.opinion-infinite-scroll a"},function(){l.settings.infinite_allow=!0}))}})},load_more_items:function(t,o){a(".opinion-pagination").toggleClass("opinion-loader-active");var r=a.extend({},{opener:"",url:"",next_url_selector:".load-more > a"},t);a("
").load(r.url,function(){var e=a(this).find(r.next_url_selector).attr("href"),i=a(this).find("title").text(),n=a(this).find(".opinion-items").children(),s=r.opener.closest(".section-content").find(".opinion-items");n.imagesLoaded(function(){n.hide().appendTo(s).fadeIn(),void 0!==e?a(r.next_url_selector).attr("href",e):a(r.next_url_selector).closest(".opinion-pagination").parent().fadeOut("fast").remove();var t={prev:window.location.href,next:r.url,offset:a(window).scrollTop(),prev_title:window.document.title,next_title:i};l.push_state(t),a(".opinion-pagination").toggleClass("opinion-loader-active"),l.sidebar(),o()})})},push_state:function(t){var e={prev:window.location.href,next:"",offset:a(window).scrollTop(),prev_title:window.document.title,next_title:window.document.title,increase_counter:!0},i=a.extend({},e,t);i.increase_counter&&(l.settings.pushes.up++,l.settings.pushes.down++),delete i.increase_counter,l.settings.pushes.url.push(i),window.document.title=i.next_title,window.history.pushState(i,"",i.next)},check_history:function(){if(!a(".opinion-pagination.load-more").length&&!a(".opinion-pagination.opinion-infinite-scroll").length)return!1;l.push_state({increase_counter:!1});var t,e=0;a(window).scroll(function(){l.settings.pushes.url[l.settings.pushes.up].offset!==t&&a(window).scrollTop()
l.settings.pushes.url[l.settings.pushes.down].offset&&(e=l.settings.pushes.url[l.settings.pushes.down].offset,t=0,window.document.title=l.settings.pushes.url[l.settings.pushes.down].next_title,window.history.replaceState(l.settings.pushes.url,"",l.settings.pushes.url[l.settings.pushes.down].next),l.settings.pushes.up=l.settings.pushes.down,l.settings.pushes.down a, .page_item_has_children > a, .cat-parent > a").after(' '),a(".widget").on("click",".opinion-accordion-nav",function(){a(this).closest("li").find("ul.sub-menu:first, ul.children:first").slideToggle("fast").parent().toggleClass("active")})},module_slider:function(){a("body").imagesLoaded(function(){a(".opinion-module-slider").each(function(){var t=a(this).find(".opinion-items").addClass("owl-carousel"),e=a(this).hasClass("slider-has-nav"),i=t.children().first().attr("class"),n=i.match(/col-(\d+)/);n=null===n?1:12/n[1];var s=i.match(/col-md-(\d+)/);s=null===s?n:12/s[1];var o=i.match(/col-lg-(\d+)/);o=null===o?s:12/o[1],t.owlCarousel({rtl:!!opinion_js_settings.rtl_mode,center:!1,loop:!0,items:n,margin:26,stagePadding:0,navContainerClass:"owl-nav container",nav:!e,navText:[' ',' '],onInitialized:function(t){var e=a(t.currentTarget);e.removeClass("row"),e.find(".owl-item").each(function(){a(this).children().removeClass()})},responsive:{570:{items:s},970:{items:o},1100:{items:o,margin:52}}}),e&&a(this).on("click",".opinion-slider-nav a",function(){a(this).hasClass("prev")?t.trigger("prev.owl.carousel"):t.trigger("next.owl.carousel")})})})},gallery_slider:function(){a("body").imagesLoaded(function(){a(".gallery-columns-1, .wp-block-gallery.columns-1").each(function(){a(this).addClass("owl-carousel").owlCarousel({rtl:!!opinion_js_settings.rtl_mode,loop:!0,items:1,autoHeight:!0,navText:[' ',' '],nav:!0})})})},instagram_slider:function(){var t=a(".opinion-section-instagram .meks-instagram-widget");t.length&&(t.hasClass("owl-carousel")||t.addClass("owl-carousel"),t.owlCarousel({rtl:!!opinion_js_settings.rtl_mode,loop:!0,nav:!0,autoWidth:!1,center:!0,fluidSpeed:300,margin:0,items:3,navText:[' ',' '],lazyLoad:!0,responsive:{570:{items:5}}}))},scroll_animate:function(){a("body").on("click",".opinion-scroll-animate",function(t){t.preventDefault();var e=this.hash,i=a(e),n=opinion_js_settings.header_sticky?a(".opinion-header-sticky").height():0;a("html, body").stop().animate({scrollTop:i.offset().top-n},900,"swing",function(){window.location.hash=e})})},reverse_menu:function(){a(".opinion-header").on("mouseenter","ul li",function(){a(this).find("ul").length&&a(window).width()-(a(this).find("ul").offset().left+a(this).find("ul").outerWidth())<0&&a(this).find("ul").addClass("opinion-rev")})},object_fit_cover:function(){a("body").imagesLoaded(function(){objectFitImages(".entry-media img")})},align_full_fix:function(){if(a("body").hasClass("opinion-sidebar-none")){var t=".alignfull { width: "+a(window).width()+"px; margin-left: -"+a(window).width()/2+"px; margin-right: -"+a(window).width()/2+"px; right:50%; left:50%; }";a("#opinion-align-fix").length?a("#opinion-align-fix").html(t):a("head").append('")}}};a(document).ready(function(){l.init()}),a(window).resize(function(){l.resize()}),a(window).scroll(function(){l.scroll()})}(jQuery);;
(function($) {
"use strict";
$(document).ready(function() {
$('body').on('click', '.meks_ess-item:not(".prevent-share-popup")', function(e) {
e.preventDefault();
meks_ess_popup($(this).attr('data-url'));
});
});
function meks_ess_popup(data) {
window.open(data, "Share", 'height=500,width=760,top=' + ($(window).height() / 2 - 250) + ', left=' + ($(window).width() / 2 - 380) + 'resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0');
}
})(jQuery);;
/* global wpcom_reblog */
var jetpackLikesWidgetBatch = [];
var jetpackLikesMasterReady = false;
// Due to performance problems on pages with a large number of widget iframes that need to be loaded,
// we are limiting the processing at any instant to unloaded widgets that are currently in viewport,
// plus this constant that will allow processing of widgets above and bellow the current fold.
// This aim of it is to improve the UX and hide the transition from unloaded to loaded state from users.
var jetpackLikesLookAhead = 2000; // pixels
// Keeps track of loaded comment likes widget so we can unload them when they are scrolled out of view.
var jetpackCommentLikesLoadedWidgets = [];
var jetpackLikesDocReadyPromise = new Promise( resolve => {
if ( document.readyState !== 'loading' ) {
resolve();
} else {
window.addEventListener( 'DOMContentLoaded', () => resolve() );
}
} );
function JetpackLikesPostMessage( message, target ) {
if ( typeof message === 'string' ) {
try {
message = JSON.parse( message );
} catch {
return;
}
}
if ( target && typeof target.postMessage === 'function' ) {
try {
target.postMessage(
JSON.stringify( {
type: 'likesMessage',
data: message,
} ),
'*'
);
} catch {
// Ignore error
}
}
}
function JetpackLikesBatchHandler() {
const requests = [];
document.querySelectorAll( 'div.jetpack-likes-widget-unloaded' ).forEach( widget => {
if ( jetpackLikesWidgetBatch.indexOf( widget.id ) > -1 ) {
return;
}
if ( ! jetpackIsScrolledIntoView( widget ) ) {
return;
}
jetpackLikesWidgetBatch.push( widget.id );
var regex = /like-(post|comment)-wrapper-(\d+)-(\d+)-(\w+)/,
match = regex.exec( widget.id ),
info;
if ( ! match || match.length !== 5 ) {
return;
}
info = {
blog_id: match[ 2 ],
width: widget.width,
};
if ( 'post' === match[ 1 ] ) {
info.post_id = match[ 3 ];
} else if ( 'comment' === match[ 1 ] ) {
info.comment_id = match[ 3 ];
}
info.obj_id = match[ 4 ];
requests.push( info );
} );
if ( requests.length > 0 ) {
JetpackLikesPostMessage(
{ event: 'initialBatch', requests: requests },
window.frames[ 'likes-master' ]
);
}
}
function JetpackLikesMessageListener( event ) {
let message = event && event.data;
if ( typeof message === 'string' ) {
try {
message = JSON.parse( message );
} catch {
return;
}
}
const type = message && message.type;
const data = message && message.data;
if ( type !== 'likesMessage' || typeof data.event === 'undefined' ) {
return;
}
// We only allow messages from one origin
const allowedOrigin = 'https://widgets.wp.com';
if ( allowedOrigin !== event.origin ) {
return;
}
switch ( data.event ) {
case 'masterReady':
jetpackLikesDocReadyPromise.then( () => {
jetpackLikesMasterReady = true;
const stylesData = {
event: 'injectStyles',
};
const sdTextColor = document.querySelector( '.sd-text-color' );
const sdLinkColor = document.querySelector( '.sd-link-color' );
const sdTextColorStyles = ( sdTextColor && getComputedStyle( sdTextColor ) ) || {};
const sdLinkColorStyles = ( sdLinkColor && getComputedStyle( sdLinkColor ) ) || {};
// enable reblogs if we're on a single post page
if ( document.body.classList.contains( 'single' ) ) {
JetpackLikesPostMessage( { event: 'reblogsEnabled' }, window.frames[ 'likes-master' ] );
}
stylesData.textStyles = {
color: sdTextColorStyles.color,
fontFamily: sdTextColorStyles[ 'font-family' ],
fontSize: sdTextColorStyles[ 'font-size' ],
direction: sdTextColorStyles.direction,
fontWeight: sdTextColorStyles[ 'font-weight' ],
fontStyle: sdTextColorStyles[ 'font-style' ],
textDecoration: sdTextColorStyles[ 'text-decoration' ],
};
stylesData.linkStyles = {
color: sdLinkColorStyles.color,
fontFamily: sdLinkColorStyles[ 'font-family' ],
fontSize: sdLinkColorStyles[ 'font-size' ],
textDecoration: sdLinkColorStyles[ 'text-decoration' ],
fontWeight: sdLinkColorStyles[ 'font-weight' ],
fontStyle: sdLinkColorStyles[ 'font-style' ],
};
JetpackLikesPostMessage( stylesData, window.frames[ 'likes-master' ] );
JetpackLikesBatchHandler();
} );
break;
// We're keeping this for planned future follow ups.
// @see: https://github.com/Automattic/jetpack/pull/42361#discussion_r1995338815
case 'showLikeWidget':
break;
// We're keeping this for planned future follow ups.
// @see: https://github.com/Automattic/jetpack/pull/42361#discussion_r1995338815
case 'showCommentLikeWidget':
break;
case 'killCommentLikes':
// If kill switch for comment likes is enabled remove all widgets wrappers and `Loading...` placeholders.
document
.querySelectorAll( '.jetpack-comment-likes-widget-wrapper' )
.forEach( wrapper => wrapper.remove() );
break;
case 'clickReblogFlair':
if ( wpcom_reblog && typeof wpcom_reblog.toggle_reblog_box_flair === 'function' ) {
wpcom_reblog.toggle_reblog_box_flair( data.obj_id );
}
break;
case 'hideOtherGravatars': {
hideLikersPopover();
break;
}
case 'showOtherGravatars': {
const container = document.querySelector( '#likes-other-gravatars' );
if ( ! container ) {
break;
}
const list = container.querySelector( 'ul' );
container.style.display = 'none';
list.innerHTML = '';
container
.querySelectorAll( '.likes-text span' )
.forEach( item => ( item.textContent = data.totalLikesLabel ) );
( data.likers || [] ).forEach( async ( liker, index ) => {
if ( liker.profile_URL.substr( 0, 4 ) !== 'http' ) {
// We only display gravatars with http or https schema
return;
}
const element = document.createElement( 'li' );
list.append( element );
const profileLink = encodeURI( liker.profile_URL );
const avatarLink = encodeURI( liker.avatar_URL );
element.innerHTML = `
`;
// Add some extra attributes through native methods, to ensure strings are sanitized.
element.classList.add( liker.css_class );
element.querySelector( 'img' ).alt = data.avatarAltTitle.replace( '%s', liker.name );
element.querySelector( 'span' ).innerText = liker.name;
if ( index === data.likers.length - 1 ) {
element.addEventListener( 'keydown', e => {
if ( e.key === 'Tab' && ! e.shiftKey ) {
e.preventDefault();
hideLikersPopover();
JetpackLikesPostMessage(
{ event: 'focusLikesCount', parent: data.parent },
window.frames[ 'likes-master' ]
);
}
} );
}
} );
const positionPopup = function () {
const containerStyle = getComputedStyle( container );
const isRtl = containerStyle.direction === 'rtl';
const el = document.querySelector( `*[name='${ data.parent }']` );
const rect = el.getBoundingClientRect();
const win = el.ownerDocument.defaultView;
const offset = {
top: rect.top + win.pageYOffset,
left: rect.left + win.pageXOffset,
};
let containerLeft = 0;
container.style.top = offset.top + data.position.top - 1 + 'px';
if ( isRtl ) {
const visibleAvatarsCount = data && data.likers ? Math.min( data.likers.length, 5 ) : 0;
// 24px is the width of the avatar + 4px is the padding between avatars
containerLeft = offset.left + data.position.left + 24 * visibleAvatarsCount + 4;
container.style.transform = 'translateX(-100%)';
} else {
containerLeft = offset.left + data.position.left;
}
container.style.left = containerLeft + 'px';
// Container width - padding
const initContainerWidth = data.width - 20;
const rowLength = Math.floor( initContainerWidth / 37 );
// # of rows + (avatar + avatar padding) + text above + container padding
let height = Math.ceil( data.likers.length / rowLength ) * 37 + 17 + 22;
if ( height > 204 ) {
height = 204;
}
// If the popup overflows viewport width, we should show it on the next line.
// Push it offscreen to calculated rendered width.
container.style.left = '-9999px';
container.style.display = 'block';
// If the popup exceeds the viewport width,
// flip the position of the popup.
const containerWidth = container.offsetWidth;
const containerRight = containerLeft + containerWidth;
if ( containerRight > win.innerWidth ) {
containerLeft = rect.right - containerWidth;
}
// Set the container left
container.style.left = containerLeft + 'px';
container.setAttribute( 'aria-hidden', 'false' );
};
positionPopup();
container.focus();
const debounce = function ( func, wait ) {
var timeout;
return function () {
var context = this;
var args = arguments;
clearTimeout( timeout );
timeout = setTimeout( function () {
func.apply( context, args );
}, wait );
};
};
const debouncedPositionPopup = debounce( positionPopup, 100 );
// Keep a reference of this function in the element itself
// so that we can destroy it later
container.__resizeHandler = debouncedPositionPopup;
// When window is resized, resize the popup.
window.addEventListener( 'resize', debouncedPositionPopup );
container.focus();
}
}
}
window.addEventListener( 'message', JetpackLikesMessageListener );
function hideLikersPopover() {
const container = document.querySelector( '#likes-other-gravatars' );
if ( container ) {
container.style.display = 'none';
container.setAttribute( 'aria-hidden', 'true' );
// Remove the resize event listener and cleanup.
const resizeHandler = container.__resizeHandler;
if ( resizeHandler ) {
window.removeEventListener( 'resize', resizeHandler );
delete container.__resizeHandler;
}
}
}
document.addEventListener( 'click', hideLikersPopover );
function JetpackLikesWidgetQueueHandler() {
var wrapperID;
if ( ! jetpackLikesMasterReady ) {
setTimeout( JetpackLikesWidgetQueueHandler, 500 );
return;
}
// Restore widgets to initial unloaded state when they are scrolled out of view.
jetpackUnloadScrolledOutWidgets();
var unloadedWidgetsInView = jetpackGetUnloadedWidgetsInView();
if ( unloadedWidgetsInView.length > 0 ) {
// Grab any unloaded widgets for a batch request
JetpackLikesBatchHandler();
}
for ( var i = 0, length = unloadedWidgetsInView.length; i <= length - 1; i++ ) {
wrapperID = unloadedWidgetsInView[ i ].id;
if ( ! wrapperID ) {
continue;
}
jetpackLoadLikeWidgetIframe( wrapperID );
}
}
function jetpackLoadLikeWidgetIframe( wrapperID ) {
if ( typeof wrapperID === 'undefined' ) {
return;
}
const wrapper = document.querySelector( '#' + wrapperID );
wrapper.querySelectorAll( 'iframe' ).forEach( iFrame => iFrame.remove() );
const placeholder = wrapper.querySelector( '.likes-widget-placeholder' );
// Post like iframe
if ( placeholder && placeholder.classList.contains( 'post-likes-widget-placeholder' ) ) {
const postLikesFrame = document.createElement( 'iframe' );
postLikesFrame.classList.add( 'post-likes-widget', 'jetpack-likes-widget' );
postLikesFrame.name = wrapper.dataset.name;
postLikesFrame.src = wrapper.dataset.src;
postLikesFrame.height = '55px';
postLikesFrame.width = '100%';
postLikesFrame.frameBorder = '0';
postLikesFrame.scrolling = 'no';
postLikesFrame.title = wrapper.dataset.title;
placeholder.after( postLikesFrame );
}
// Comment like iframe
if ( placeholder.classList.contains( 'comment-likes-widget-placeholder' ) ) {
const commentLikesFrame = document.createElement( 'iframe' );
commentLikesFrame.class = 'comment-likes-widget-frame jetpack-likes-widget-frame';
commentLikesFrame.name = wrapper.dataset.name;
commentLikesFrame.src = wrapper.dataset.src;
commentLikesFrame.height = '18px';
commentLikesFrame.width = '100%';
commentLikesFrame.frameBorder = '0';
commentLikesFrame.scrolling = 'no';
wrapper.querySelector( '.comment-like-feedback' ).after( commentLikesFrame );
jetpackCommentLikesLoadedWidgets.push( commentLikesFrame );
}
wrapper.classList.remove( 'jetpack-likes-widget-unloaded' );
wrapper.classList.add( 'jetpack-likes-widget-loading' );
wrapper.querySelector( 'iframe' ).addEventListener( 'load', e => {
JetpackLikesPostMessage(
{ event: 'loadLikeWidget', name: e.target.name, width: e.target.width },
window.frames[ 'likes-master' ]
);
wrapper.classList.remove( 'jetpack-likes-widget-loading' );
wrapper.classList.add( 'jetpack-likes-widget-loaded' );
} );
}
function jetpackGetUnloadedWidgetsInView() {
const unloadedWidgets = document.querySelectorAll( 'div.jetpack-likes-widget-unloaded' );
return [ ...unloadedWidgets ].filter( item => jetpackIsScrolledIntoView( item ) );
}
function jetpackIsScrolledIntoView( element ) {
const top = element.getBoundingClientRect().top;
const bottom = element.getBoundingClientRect().bottom;
// Allow some slack above and bellow the fold with jetpackLikesLookAhead,
// with the aim of hiding the transition from unloaded to loaded widget from users.
return top + jetpackLikesLookAhead >= 0 && bottom <= window.innerHeight + jetpackLikesLookAhead;
}
function jetpackUnloadScrolledOutWidgets() {
for ( let i = jetpackCommentLikesLoadedWidgets.length - 1; i >= 0; i-- ) {
const currentWidgetIframe = jetpackCommentLikesLoadedWidgets[ i ];
if ( ! jetpackIsScrolledIntoView( currentWidgetIframe ) ) {
const widgetWrapper =
currentWidgetIframe &&
currentWidgetIframe.parentElement &&
currentWidgetIframe.parentElement.parentElement;
// Restore parent class to 'unloaded' so this widget can be picked up by queue manager again if needed.
widgetWrapper.classList.remove( 'jetpack-likes-widget-loaded' );
widgetWrapper.classList.remove( 'jetpack-likes-widget-loading' );
widgetWrapper.classList.add( 'jetpack-likes-widget-unloaded' );
// Remove it from the list of loaded widgets.
jetpackCommentLikesLoadedWidgets.splice( i, 1 );
// Remove comment like widget iFrame.
currentWidgetIframe.remove();
}
}
}
var jetpackWidgetsDelayedExec = function ( after, fn ) {
var timer;
return function () {
clearTimeout( timer );
timer = setTimeout( fn, after );
};
};
var jetpackOnScrollStopped = jetpackWidgetsDelayedExec( 250, JetpackLikesWidgetQueueHandler );
// Load initial batch of widgets, prior to any scrolling events.
JetpackLikesWidgetQueueHandler();
// Add event listener to execute queue handler after scroll.
window.addEventListener( 'scroll', jetpackOnScrollStopped, true );
;