'use strict';
/*
Tipr 1.0.1
Copyright (c) 2013 Tipue
Tipr is released under the MIT License
http://www.tipue.com/tipr
*/
(function ($, window, undefined) {
'use strict';
$.fn.tipr = function (options) {
var set = $.extend(
{
speed: 200,
mode: 'bottom',
rtl: false,
},
options
);
return this.each(function () {
var tipr_cont = '.tipr_container_' + set.mode;
$(this).hover(
function () {
var out =
'
' +
$(this).attr('data-tip') +
'
';
$(this).append(out);
var w_t = $(tipr_cont).outerWidth();
var w_e = $(this).width();
var m_l = w_e / 2 - w_t / 2;
if (set.rtl) {
$(tipr_cont).css('margin-right', m_l + 'px');
} else {
$(tipr_cont).css('margin-left', m_l + 'px');
}
$(this).removeAttr('title');
$(tipr_cont).fadeIn(set.speed);
},
function () {
$(tipr_cont).remove();
}
);
});
};
})(jQuery);
;
'use strict';
/*
Handles additional functionalities of the theme.
*/
(function () {
var siteHeader = document.getElementById('masthead');
if (!siteHeader) {
return;
}
var fortuneTheme = {
// Run on ready.
onReady: function onReady() {
this.createStickyHeader();
this.setSocialTooltips();
this.skipLinkFocusFix();
},
// Create sticky header.
createStickyHeader: function createStickyHeader() {
var stickyNavigationContainer = document.getElementById('header-inner');
var stickyNavigationTop = siteHeader.offsetHeight;
var makeNavigationSticky = function makeNavigationSticky() {
var scrollTop = window.scrollY || document.documentElement.scrollTop;
if (scrollTop > stickyNavigationTop) {
siteHeader.style.height = stickyNavigationTop + 'px';
stickyNavigationContainer.classList.add('sticky-navigation');
} else {
siteHeader.style.height = 'auto';
stickyNavigationContainer.classList.remove('sticky-navigation');
}
};
makeNavigationSticky();
var stickyNavigationEvent = function stickyNavigationEvent() {
window.requestAnimationFrame(makeNavigationSticky);
};
window.addEventListener('scroll', stickyNavigationEvent, false);
window.addEventListener('resize', stickyNavigationEvent, false);
},
// Set up social icons tooltips
setSocialTooltips: function setSocialTooltips() {
var socialLinks = jQuery(document.getElementById('page')).find(
'.social-list'
);
var headerContainer = jQuery(siteHeader); // Will be removed soon.
var htmlRTL =
'rtl' === document.documentElement.getAttribute('dir') ? true : false;
if (socialLinks.length) {
var currentSocialLink, socialMetaText, i;
socialMetaText = socialLinks.find('.social-meta');
for (i = 0; i < socialMetaText.length; i++) {
currentSocialLink = socialMetaText.eq(i);
currentSocialLink
.parent()
.attr('data-tip', currentSocialLink.text())
.addClass('td-tooltip');
} //Header Tooltips
headerContainer.find('.td-tooltip').tipr({
speed: 100,
mode: 'bottom',
rtl: htmlRTL,
}); //Footer Tooltips
jQuery(document.getElementById('colophon')).find('.td-tooltip').tipr({
speed: 100,
mode: 'top',
rtl: htmlRTL,
});
}
},
// Helps with accessibility for keyboard only users.
skipLinkFocusFix: function skipLinkFocusFix() {
var isIe = /(trident|msie)/i.test(navigator.userAgent);
if (isIe && document.getElementById && window.addEventListener) {
window.addEventListener(
'hashchange',
function () {
var id = location.hash.substring(1),
element;
if (!/^[A-z0-9_-]+$/.test(id)) {
return;
}
element = document.getElementById(id);
if (element) {
if (
!/^(?:a|select|input|button|textarea)$/i.test(element.tagName)
) {
element.tabIndex = -1;
}
element.focus();
}
},
false
);
}
},
}; // Things that need to happen when the document is ready.
jQuery(function () {
fortuneTheme.onReady();
});
})();
('use strict');
(function () {
if ('loading' === document.readyState) {
// The DOM has not yet been loaded.
document.addEventListener('DOMContentLoaded', initGoTopButton);
} else {
// The DOM has already been loaded.
initGoTopButton();
} // Initiate the header search when the DOM loads.
function initGoTopButton() {
var goToTopButton = document.getElementById('gotop-button');
var buttonAction = function buttonAction() {
try {
window.scrollTo({
top: document.getElementById('page').offsetTop,
left: 0,
behavior: 'smooth',
});
} catch (error) {
window.scrollTo(0, document.getElementById('page').offsetTop);
}
};
if (!goToTopButton) {
return;
}
goToTopButton.addEventListener('click', buttonAction, false);
}
})();
('use strict');
(function () {
if ('loading' === document.readyState) {
// The DOM has not yet been loaded.
document.addEventListener('DOMContentLoaded', initSearchForm);
} else {
// The DOM has already been loaded.
initSearchForm();
}
function initSearchForm() {
var searchButton = document.getElementById('header-search-button');
if (!searchButton) {
return;
}
if (!document.documentElement.classList) {
searchButton.style.display = 'none';
}
var headerSearchBox = document.getElementById('header-searchform');
var headerSearchBoxInput = document.querySelector('#header-search-input');
var searchButtonEvent = function searchButtonEvent() {
searchButton.classList.toggle('open');
headerSearchBox.classList.toggle('th-flex');
if (headerSearchBox.classList.contains('th-flex')) {
headerSearchBoxInput.focus();
searchButton.setAttribute('aria-expanded', 'true');
} else {
searchButton.setAttribute('aria-expanded', 'false');
}
};
searchButton.addEventListener('click', searchButtonEvent, false);
var closeSearchWithKey = function closeSearchWithKey(e) {
if (
(e.key == 'Escape' || e.key == 'Esc' || e.keyCode == 27) &&
headerSearchBox.classList.contains('th-flex')
) {
searchButtonEvent();
}
};
headerSearchBox.addEventListener('keydown', closeSearchWithKey, false);
}
})();
('use strict');
(function () {
if ('loading' === document.readyState) {
// The DOM has not yet been loaded.
document.addEventListener('DOMContentLoaded', initNavigation);
} else {
// The DOM has already been loaded.
initNavigation();
}
function initNavigation() {
var siteHeader = document.getElementById('masthead');
if (!siteHeader) {
return;
}
if (!document.documentElement.classList) {
return;
}
var siteHeaderMenus = siteHeader.querySelectorAll('.nav-bar');
if (!siteHeaderMenus.length) {
return;
}
for (var i = 0; i < siteHeaderMenus.length; i++) {
setToggleSubmenuOnFocus(siteHeaderMenus[i]);
setToggleSubmenuOnTouch(siteHeaderMenus[i]);
}
createMobileMenu(siteHeaderMenus);
}
/**
* Toggle `focus` class to allow sub-menu access on focus and blur.
*
* @param {Object} container
*/
function setToggleSubmenuOnFocus(container) {
// Get the first ul element insite the menu container.
var primaryMenu = container.getElementsByTagName('ul')[0]; // Get all the link elements within the menu.
var menuLinks = container.getElementsByTagName('a');
var i, focusFn; // Sets or removes .focus class on an element.
focusFn = function focusFn() {
var self = this; // Move up through the ancestors of the current link until we hit .nav-menu.
while (
!self.classList.contains('menu-navigation') &&
'nav' !== self.tagName.toLowerCase()
) {
// On li elements toggle the class .focus.
if ('li' === self.tagName.toLowerCase()) {
if (self.classList.contains('focus')) {
self.classList.remove('focus');
} else {
self.classList.add('focus');
}
}
self = self.parentElement;
}
}; // Each time a menu link is focused or blurred, toggle focus.
for (i = 0; i < menuLinks.length; i++) {
menuLinks[i].addEventListener('focus', focusFn, false);
menuLinks[i].addEventListener('blur', focusFn, false);
}
}
/**
* Toggle `focus` class to allow sub-menu access on touch screens.
*
* @param {Object} container
*/
function setToggleSubmenuOnTouch(container) {
if ('undefined' === typeof window.ontouchstart) {
return;
}
var touchStartFn,
touchOutsideFn,
removeFocusFn,
i,
parentLink = container.querySelectorAll(
'.menu-item-has-children > a, .page_item_has_children > a'
);
removeFocusFn = function removeFocusFn() {
var focusedElements = container.querySelectorAll('li.focus');
var i;
for (i = 0; i < focusedElements.length; ++i) {
focusedElements[i].classList.remove('focus');
}
};
touchStartFn = function touchStartFn(e) {
var menuItem = this.parentNode,
i;
if (!menuItem.classList.contains('focus')) {
if (e.cancelable) {
e.preventDefault();
}
for (i = 0; i < menuItem.parentNode.children.length; ++i) {
if (menuItem === menuItem.parentNode.children[i]) {
continue;
}
menuItem.parentNode.children[i].classList.remove('focus');
}
if (!container.classList.contains('is-touched')) {
container.classList.add('is-touched');
}
menuItem.classList.add('focus');
} else {
menuItem.classList.remove('focus');
}
};
touchOutsideFn = function touchOutsideFn(e) {
var isTochedMenu = container.classList.contains('is-touched');
if (!isTochedMenu) {
return;
}
var elementParent = e.target.parentNode;
if (
elementParent &&
!elementParent.classList.contains('menu-item') &&
isTochedMenu
) {
removeFocusFn();
}
};
document.addEventListener('touchstart', touchOutsideFn, false);
for (i = 0; i < parentLink.length; ++i) {
parentLink[i].addEventListener('touchstart', touchStartFn, false);
}
} // Create a mobile menu.
function createMobileMenu(menus) {
var siteHeader = document.getElementById('masthead');
var mobileMenu = document.getElementById('mobile-navigation');
var mobileMenuContainer = mobileMenu.querySelector('.container');
var mobileMenuButton = document.getElementById('toggle-mobile-menu');
var mobileMenuContent = document.createDocumentFragment();
for (var _i = 0; _i < menus.length; _i++) {
mobileMenuContent.appendChild(menus[_i].cloneNode(true));
} // Remove ID attributes from the list items to avoid repetition.
var mobileMenuItems = mobileMenuContent.querySelectorAll('li');
var mobileMenuItemsCount = mobileMenuItems.length;
if (mobileMenuItemsCount) {
for (var itemIndex = 0; itemIndex < mobileMenuItemsCount; itemIndex++) {
mobileMenuItems[itemIndex].removeAttribute('id');
}
}
var toggleMobileMenuEvent = function toggleMobileMenuEvent() {
siteHeader.classList.toggle('active-toggle-menu');
if (-1 !== siteHeader.className.indexOf('active-toggle-menu')) {
mobileMenu.setAttribute('aria-hidden', false);
mobileMenuButton.setAttribute('aria-expanded', true);
window.scrollTo(0, document.getElementById('page').offsetTop);
} else {
mobileMenu.setAttribute('aria-hidden', true);
mobileMenuButton.setAttribute('aria-expanded', false);
}
};
mobileMenuButton.addEventListener('click', toggleMobileMenuEvent, false); // Add dropdown toggle that displays child menu items.
var parentMenuItems = mobileMenuContent.querySelectorAll(
'.menu-item-has-children'
);
if (parentMenuItems.length) {
for (var _i2 = 0; _i2 < parentMenuItems.length; _i2++) {
var buttonScreenReaderText = document.createElement('span');
buttonScreenReaderText.className = 'screen-reader-text';
buttonScreenReaderText.appendChild(
document.createTextNode(fortuneScreenReaderText.expand)
);
var dropdownToggle = document.createElement('button');
dropdownToggle.className =
'dropdown-toggle clean-button has-icon has-border-radius';
dropdownToggle.setAttribute('aria-expanded', false);
dropdownToggle.appendChild(buttonScreenReaderText);
var subMenu = parentMenuItems[_i2].querySelector('ul');
parentMenuItems[_i2].insertBefore(dropdownToggle, subMenu);
parentMenuItems[_i2].setAttribute('aria-haspopup', true);
}
}
mobileMenuContainer.appendChild(mobileMenuContent); // Toggle buttons and submenu items with active children menu items.
var activeToggleButtons = mobileMenuContainer.querySelectorAll(
'.current-menu-ancestor > button'
);
var activeToggleSubMenus = mobileMenuContainer.querySelectorAll(
'.current-menu-ancestor > .sub-menu'
);
var activeToggleIndecators = mobileMenuContainer.querySelectorAll(
'.current-menu-ancestor > .arrow-icon'
);
if (activeToggleButtons.length) {
for (var i = 0; i < activeToggleButtons.length; i++) {
activeToggleButtons[i].classList.add('toggled-on');
activeToggleButtons[i].setAttribute('aria-expanded', true);
activeToggleButtons[i].querySelector(
'.screen-reader-text'
).textContent = fortuneScreenReaderText.collapse;
}
}
if (activeToggleSubMenus.length) {
for (var i = 0; i < activeToggleSubMenus.length; i++) {
activeToggleSubMenus[i].classList.add('toggled-on');
}
}
if (activeToggleIndecators.length) {
for (var i = 0; i < activeToggleIndecators.length; i++) {
activeToggleIndecators[i].classList.add('toggled-on');
}
}
var dropdownToggleButtons =
mobileMenuContainer.getElementsByTagName('button');
if (!dropdownToggleButtons.length) {
return;
}
var dropdownToggleEvent = function dropdownToggleEvent(e) {
var screenReader = e.target.querySelector('.screen-reader-text');
var arrowIconElement =
e.target.parentElement.querySelector('.arrow-icon');
arrowIconElement.classList.toggle('toggled-on');
if (-1 !== e.target.className.indexOf('toggled-on')) {
e.target.setAttribute('aria-expanded', false);
if (null !== screenReader) {
screenReader.textContent = fortuneScreenReaderText.expand;
}
} else {
e.target.setAttribute('aria-expanded', true);
if (null !== screenReader) {
screenReader.textContent = fortuneScreenReaderText.collapse;
}
}
e.target.classList.toggle('toggled-on');
var parentItem = e.target.parentNode;
for (var i = 0; i < parentItem.childNodes.length; i++) {
if ('UL' === parentItem.childNodes[i].nodeName) {
parentItem.childNodes[i].classList.toggle('toggled-on');
break;
}
}
};
for (var i = 0; i < dropdownToggleButtons.length; i++) {
dropdownToggleButtons[i].addEventListener(
'click',
dropdownToggleEvent,
false
);
}
}
})();
;
!function(){"use strict";var e,t={noop:function(){},texturize:function(e){return(e=(e=(e=(e+="").replace(/'/g,"’").replace(/'/g,"’")).replace(/"/g,"”").replace(/"/g,"”").replace(/"/g,"”").replace(/[\u201D]/g,"”")).replace(/([\w]+)=[\d]+;(.+?)[\d]+;/g,'$1="$2"')).trim()},applyReplacements:function(e,t){if(e)return t?e.replace(/{(\d+)}/g,function(e,r){return void 0!==t[r]?t[r]:e}):e},getBackgroundImage:function(e){var t=document.createElement("canvas"),r=t.getContext&&t.getContext("2d");if(e){r.filter="blur(20px) ",r.drawImage(e,0,0);var o=t.toDataURL("image/png");return t=null,o}}},r=function(){function e(e,t){return Element.prototype.matches?e.matches(t):Element.prototype.msMatchesSelector?e.msMatchesSelector(t):void 0}function r(e,t,r,o){if(!e)return o();e.style.removeProperty("display"),e.style.opacity=t,e.style.pointerEvents="none";var a=function(i,n){var l=(performance.now()-i)/n;l<1?(e.style.opacity=t+(r-t)*l,requestAnimationFrame(()=>a(i,n))):(e.style.opacity=r,e.style.removeProperty("pointer-events"),o())};requestAnimationFrame(function(){requestAnimationFrame(function(){a(performance.now(),200)})})}return{closest:function(t,r){if(t.closest)return t.closest(r);var o=t;do{if(e(o,r))return o;o=o.parentElement||o.parentNode}while(null!==o&&1===o.nodeType);return null},matches:e,hide:function(e){e&&(e.style.display="none")},show:function(e){e&&(e.style.display="block")},fadeIn:function(e,o){r(e,0,1,o=o||t.noop)},fadeOut:function(e,o){o=o||t.noop,r(e,1,0,function(){e&&(e.style.display="none"),o()})},scrollToElement:function(e,t,r){if(!e||!t)return r?r():void 0;var o=t.querySelector(".jp-carousel-info-extra");o&&(o.style.minHeight=window.innerHeight-64+"px");var a=!0,i=Date.now(),n=t.scrollTop,l=Math.max(0,e.offsetTop-Math.max(0,window.innerHeight-function(e){var t=e.querySelector(".jp-carousel-info-footer"),r=e.querySelector(".jp-carousel-info-extra"),o=e.querySelector(".jp-carousel-info-content-wrapper");if(t&&r&&o){var a=window.getComputedStyle(r),i=parseInt(a.paddingTop,10)+parseInt(a.paddingBottom,10);return i=isNaN(i)?0:i,o.offsetHeight+t.offsetHeight+i}return 0}(t)))-t.scrollTop;function s(){a=!1}l=Math.min(l,t.scrollHeight-window.innerHeight),t.addEventListener("wheel",s),function e(){var c,u=Date.now(),d=(c=(u-i)/300)<.5?2*c*c:1-Math.pow(-2*c+2,2)/2,p=(d=d>1?1:d)*l;if(t.scrollTop=n+p,u<=i+300&&a)return requestAnimationFrame(e);r&&r(),o&&(o.style.minHeight=""),a=!1,t.removeEventListener("wheel",s)}()},getJSONAttribute:function(e,t){if(e&&e.hasAttribute(t))try{return JSON.parse(e.getAttribute(t))}catch{return}},convertToPlainText:function(e){var t=document.createElement("div");return t.textContent=e,t.innerHTML},stripHTML:function(e){return e.replace(/<[^>]*>?/gm,"")},emitEvent:function(e,t,r){var o;try{o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r||null})}catch{(o=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,r||null)}e.dispatchEvent(o)},isTouch:function(){return"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch}}}();function o(){var o,a,i,n,l="",s=!1,c="div.gallery, div.tiled-gallery, ul.wp-block-gallery, ul.blocks-gallery-grid, figure.wp-block-gallery.has-nested-images, div.wp-block-jetpack-tiled-gallery, a.single-image-gallery",u=".gallery-item, .tiled-gallery-item, .blocks-gallery-item, .tiled-gallery__item",d=u+", .wp-block-image",p={},m="undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.stat?wpcom.carousel.stat:t.noop,g="undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.pageview?wpcom.carousel.pageview:t.noop;function h(t){if(!s)switch(t.which){case 38:t.preventDefault(),p.overlay.scrollTop-=100;break;case 40:t.preventDefault(),p.overlay.scrollTop+=100;break;case 39:t.preventDefault(),e.slideNext();break;case 37:case 8:t.preventDefault(),e.slidePrev();break;case 27:t.preventDefault(),k()}}function f(){s=!0}function v(){s=!1}function y(e){e.role="button",e.tabIndex=0,e.ariaLabel=jetpackCarouselStrings.image_label}function w(){p.overlay||(p.overlay=document.querySelector(".jp-carousel-overlay"),p.container=p.overlay.querySelector(".jp-carousel-wrap"),p.gallery=p.container.querySelector(".jp-carousel"),p.info=p.overlay.querySelector(".jp-carousel-info"),p.caption=p.info.querySelector(".jp-carousel-caption"),p.commentField=p.overlay.querySelector("#jp-carousel-comment-form-comment-field"),p.emailField=p.overlay.querySelector("#jp-carousel-comment-form-email-field"),p.authorField=p.overlay.querySelector("#jp-carousel-comment-form-author-field"),p.urlField=p.overlay.querySelector("#jp-carousel-comment-form-url-field"),window.innerWidth<=760&&Math.round(window.innerWidth/760*110)<40&&r.isTouch(),[p.commentField,p.emailField,p.authorField,p.urlField].forEach(function(e){e&&(e.addEventListener("focus",f),e.addEventListener("blur",v))}),p.overlay.addEventListener("click",function(e){var t,o,a=e.target,i=!!r.closest(a,".jp-carousel-close-hint"),n=!!window.matchMedia("(max-device-width: 760px)").matches;a===p.overlay?n||k():i?k():a.classList.contains("jp-carousel-image-download")?m("download_original_click"):a.classList.contains("jp-carousel-comment-login")?(t=p.currentSlide,o=t?t.attrs.attachmentId:"0",window.location.href=jetpackCarouselStrings.login_url+"%23jp-carousel-"+o):r.closest(a,"#jp-carousel-comment-form-container")?function(e){var t=e.target,o=r.getJSONAttribute(p.container,"data-carousel-extra")||{},a=p.currentSlide.attrs.attachmentId,i=document.querySelector("#jp-carousel-comment-form-submit-and-info-wrapper"),n=document.querySelector("#jp-carousel-comment-form-spinner"),l=document.querySelector("#jp-carousel-comment-form-button-submit"),s=document.querySelector("#jp-carousel-comment-form");if(p.commentField&&p.commentField.getAttribute("id")===t.getAttribute("id"))f(),r.show(i);else if(r.matches(t,'input[type="submit"]')){e.preventDefault(),e.stopPropagation(),r.show(n),s.classList.add("jp-carousel-is-disabled");var c={action:"post_attachment_comment",nonce:jetpackCarouselStrings.nonce,blog_id:o.blog_id,id:a,comment:p.commentField.value};if(!c.comment.length)return void j(jetpackCarouselStrings.no_comment_text,!1);if(1!==Number(jetpackCarouselStrings.is_logged_in)&&(c.email=p.emailField.value,c.author=p.authorField.value,c.url=p.urlField.value,1===Number(jetpackCarouselStrings.require_name_email))){if(!c.email.length||!c.email.match("@"))return void j(jetpackCarouselStrings.no_comment_email,!1);if(!c.author.length)return void j(jetpackCarouselStrings.no_comment_author,!1)}var u=new XMLHttpRequest;u.open("POST",jetpackCarouselStrings.ajaxurl,!0),u.setRequestHeader("X-Requested-With","XMLHttpRequest"),u.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),u.onreadystatechange=function(){if(this.readyState===XMLHttpRequest.DONE&&this.status>=200&&this.status<300){var e;try{e=JSON.parse(this.response)}catch{return void j(jetpackCarouselStrings.comment_post_error,!1)}"approved"===e.comment_status?j(jetpackCarouselStrings.comment_approved,!0):"unapproved"===e.comment_status?j(jetpackCarouselStrings.comment_unapproved,!0):j(jetpackCarouselStrings.comment_post_error,!1),I(),_(a),l.value=jetpackCarouselStrings.post_comment,r.hide(n),s.classList.remove("jp-carousel-is-disabled")}else j(jetpackCarouselStrings.comment_post_error,!1)};var d=[];for(var m in c)if(m){var g=encodeURIComponent(m)+"="+encodeURIComponent(c[m]);d.push(g.replace(/%20/g,"+"))}var h=d.join("&");u.send(h)}}(e):(r.closest(a,".jp-carousel-photo-icons-container")||a.classList.contains("jp-carousel-photo-title"))&&function(e){e.preventDefault();var t=e.target,o=p.info.querySelector(".jp-carousel-info-extra"),a=p.info.querySelector(".jp-carousel-image-meta"),i=p.info.querySelector(".jp-carousel-comments-wrapper"),n=p.info.querySelector(".jp-carousel-icon-info"),l=p.info.querySelector(".jp-carousel-icon-comments");function s(){l&&l.classList.remove("jp-carousel-selected"),n.classList.toggle("jp-carousel-selected"),i&&i.classList.remove("jp-carousel-show"),a&&(a.classList.toggle("jp-carousel-show"),a.classList.contains("jp-carousel-show")?o.classList.add("jp-carousel-show"):o.classList.remove("jp-carousel-show"))}function c(){n&&n.classList.remove("jp-carousel-selected"),l.classList.toggle("jp-carousel-selected"),a&&a.classList.remove("jp-carousel-show"),i&&(i.classList.toggle("jp-carousel-show"),i.classList.contains("jp-carousel-show")?o.classList.add("jp-carousel-show"):o.classList.remove("jp-carousel-show"))}(r.closest(t,".jp-carousel-icon-info")||t.classList.contains("jp-carousel-photo-title"))&&(a&&a.classList.contains("jp-carousel-show")?r.scrollToElement(p.overlay,p.overlay,s):(s(),r.scrollToElement(p.info,p.overlay))),r.closest(t,".jp-carousel-icon-comments")&&(i&&i.classList.contains("jp-carousel-show")?r.scrollToElement(p.overlay,p.overlay,c):(c(),r.scrollToElement(p.info,p.overlay)))}(e)}),window.addEventListener("keydown",h),p.overlay.addEventListener("jp_carousel.afterOpen",function(){v(),p.slides.length<=1||(p.slides.length<=5?r.show(p.info.querySelector(".jp-swiper-pagination")):r.show(p.info.querySelector(".jp-carousel-pagination")))}),p.overlay.addEventListener("jp_carousel.beforeClose",function(){f(),document.documentElement.style.removeProperty("height"),e&&e.enable(),r.hide(p.info.querySelector(".jp-swiper-pagination")),r.hide(p.info.querySelector(".jp-carousel-pagination"))}),p.overlay.addEventListener("jp_carousel.afterClose",function(){window.history.pushState?history.pushState("",document.title,window.location.pathname+window.location.search):window.location.href="",l="",p.isOpen=!1}),p.overlay.addEventListener("touchstart",function(e){e.touches.length>1&&e.preventDefault()}))}function j(e,t){var o=p.overlay.querySelector("#jp-carousel-comment-post-results"),a="jp-carousel-comment-post-"+(t?"success":"error");o.innerHTML=''+e+"",r.hide(p.overlay.querySelector("#jp-carousel-comment-form-spinner")),p.overlay.querySelector("#jp-carousel-comment-form").classList.remove("jp-carousel-is-disabled"),r.show(o)}function b(){var e=document.querySelectorAll("a img[data-attachment-id]");Array.prototype.forEach.call(e,function(e){var t=e.parentElement,o=t.parentElement;if(!o.classList.contains("gallery-icon")&&!r.closest(o,u)&&t.hasAttribute("href")){var a=!1;t.getAttribute("href").split("?")[0]===e.getAttribute("data-orig-file").split("?")[0]&&1===Number(jetpackCarouselStrings.single_image_gallery_media_file)&&(a=!0),t.getAttribute("href")===e.getAttribute("data-permalink")&&(a=!0),a&&(y(e),t.classList.add("single-image-gallery"),t.setAttribute("data-carousel-extra",JSON.stringify({blog_id:Number(jetpackCarouselStrings.blog_id)})))}})}function S(t,r){p.isOpen?(L(r),e.slideTo(r+1)):F(t,{startIndex:r})}function L(e){(!e||e<0||e>p.slides.length)&&(e=0),p.currentSlide=p.slides[e];var o,a,i=p.currentSlide,n=i.attrs.attachmentId;H(p.slides[e]),function(e){var t=[],r=p.slides.length;if(r>1){var o=e>0?e-1:r-1;t.push(o);var a=e"+jetpackCarouselStrings[o]+"
"+a+""}}t.innerHTML=r,t.style.removeProperty("display")}(p.slides[e].attrs.imageMeta),function(e){if(!e)return!1;var r,o=[e.attrs.origWidth,e.attrs.origHeight],a=document.createElement("a");a.href=e.attrs.src.replace(/\?.+$/,""),r=null!==a.hostname.match(/^i[\d]{1}\.wp\.com$/i)?a.href:e.attrs.origFile.replace(/\?.+$/,"");var i=p.info.querySelector(".jp-carousel-download-text"),n=p.info.querySelector(".jp-carousel-image-download");i.innerHTML=t.applyReplacements(jetpackCarouselStrings.download_original,o),n.setAttribute("href",r),n.style.removeProperty("display")}(i),1===Number(jetpackCarouselStrings.display_comments)&&(o=p.slides[e].attrs.commentsOpened,a=p.info.querySelector("#jp-carousel-comment-form-container"),1===parseInt(o,10)?r.fadeIn(a):r.fadeOut(a),_(n),r.hide(p.info.querySelector("#jp-carousel-comment-post-results")));var s=p.info.querySelector(".jp-carousel-pagination");if(s&&p.slides.length>5){var c=e+1;s.innerHTML=""+c+" / "+p.slides.length+""}jetpackCarouselStrings.stats&&p.isOpen&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?"+jetpackCarouselStrings.stats+"&post="+encodeURIComponent(n)+"&rand="+Math.random()),p.isOpen&&g(n),l="#jp-carousel-"+n,window.location.hash=l}function k(){document.body.style.overflow=a,document.documentElement.style.overflow=i,I(),f(),r.emitEvent(p.overlay,"jp_carousel.beforeClose"),window.scrollTo(window.scrollX||window.pageXOffset||0,n||0),p.isOpen=!1,e.destroy(),p.slides=[],p.currentSlide=void 0,p.gallery.innerHTML="",r.fadeOut(p.overlay,function(){r.emitEvent(p.overlay,"jp_carousel.afterClose")})}function x(e){if("object"!=typeof e&&(e={}),void 0===e.origFile)return"";if(void 0===e.origWidth||void 0===e.maxWidth)return e.origFile;if(void 0===e.mediumFile||void 0===e.largeFile)return e.origFile;var t=document.createElement("a");t.href=e.largeFile;var r=/^i[0-2]\.wp\.com$/i.test(t.hostname),o=q(e.largeFile,e.origWidth,r),a=parseInt(o[0],10),i=parseInt(o[1],10);if(e.origMaxWidth=e.maxWidth,e.origMaxHeight=e.maxHeight,void 0!==window.devicePixelRatio&&window.devicePixelRatio>1&&(e.maxWidth=e.maxWidth*window.devicePixelRatio,e.maxHeight=e.maxHeight*window.devicePixelRatio),a>=e.maxWidth||i>=e.maxHeight)return e.largeFile;var n=q(e.mediumFile,e.origWidth,r),l=parseInt(n[0],10),s=parseInt(n[1],10);if(l>=e.maxWidth||s>=e.maxHeight)return e.mediumFile;if(r){if(-1===e.largeFile.lastIndexOf("?"))return e.largeFile;var c=function(e){var t;try{t=new URL(e)}catch(t){return e}var r=["quality","ssl","filter","brightness","contrast","colorize","smooth"],o=Array.from(t.searchParams.entries());return t.search="",o.forEach(([e,o])=>{r.includes(e)&&t.searchParams.append(e,o)}),t}(e.largeFile);return(e.origWidth>e.maxWidth||e.origHeight>e.maxHeight)&&(e.origMaxWidth=2*e.maxWidth,e.origMaxHeight=2*e.maxHeight,c.searchParams.set("fit",e.origMaxWidth+","+e.origMaxHeight)),c.toString()}return e.origFile}function q(e,t,r){var o,a=r?e.replace(/.*=([\d]+%2C[\d]+).*$/,"$1"):e.replace(/.*-([\d]+x[\d]+)\..+$/,"$1");return"9999"===(o=a!==e?r?a.split("%2C"):a.split("x"):[t,0])[0]&&(o[0]="0"),"9999"===o[1]&&(o[1]="0"),o}function A(e){return e>=1?Math.round(10*e)/10+"s":"1/"+Math.round(1/e)+"s"}function E(e){return!e.match(" ")&&e.match("_")?"":e}function _(e,t){var a=void 0===t,i=p.info.querySelector(".jp-carousel-icon-comments .jp-carousel-has-comments-indicator");if(i.classList.remove("jp-carousel-show"),clearInterval(o),e){(!t||t<1)&&(t=0);var n=p.info.querySelector(".jp-carousel-comments"),l=p.info.querySelector("#jp-carousel-comments-loading");r.show(l),a&&(r.hide(n),n.innerHTML="");var s=new XMLHttpRequest,c=jetpackCarouselStrings.ajaxurl+"?action=get_attachment_comments&nonce="+jetpackCarouselStrings.nonce+"&id="+e+"&offset="+t;s.open("GET",c),s.setRequestHeader("X-Requested-With","XMLHttpRequest");var u=function(){r.fadeIn(n),r.fadeOut(l)};s.onload=function(){if(p.currentSlide&&p.currentSlide.attrs.attachmentId===e){var c,d=s.status>=200&&s.status<300;try{c=JSON.parse(s.responseText)}catch{}if(!d||!c||!Array.isArray(c))return u();a&&(n.innerHTML="");for(var m=0;m