PageSourceSearch

https://valentinboyadzhiev.com/_static/??-eJydkttSwyAQhl9ISrSd6Xjh…/v9Y9Psm+1uN7wD8f01XQ==

js valentinboyadzhiev.com collected 2026-09-25 12:10:07 UTC 206,537 bytes, 3,330 lines download raw bytes

vendor: 4,215 bytes, line 1
1(()=>{var t={14:(t,e,i)=>{"use strict";i.d(e,{Z:()=>u});var n=i(191),o=i.n(n),s=i(261),d=i.n(s),r=i(160),a=i.n(r),l=new URL(i(240),i.b),c=d()(o()),h=a()(l);c.push([t.id,`.wordads-ad-wrapper {\n    position: static;\n    font: 11px Arial, sans-serif;\n    letter-spacing: 1px;\n    text-decoration: none;\n    max-width: 100%;\n    margin: 25px auto;\n    padding: 0;\n    display: flex;\n    justify-content: center;\n}\n\n.wordads-ad-wrapper--sidebar,\n.wordads-ad-wrapper--gutenberg_skyscraper,\n.wordads-ad-wrapper--gutenberg_mobile_leaderboard {\n    font-size: 8px;\n}\n\n.wordads-ad-title {\n    margin: 0 auto 5px\n}\n\n.wordads-ad-controls {\n    margin: 5px auto 0;\n    text-align: right\n}\n\n/* Hide title and controls initially */\n.wordads-ad-title,\n.wordads-ad-controls {\n    visibility: hidden;\n}\n\n.wordads-ad-controls span {\n    cursor: pointer\n}\n\n.wordads-ad {\n    margin: 0 auto;\n    width: fit-content;\n    max-width: 100%;\n    overflow: hidden;\n}\n\n.wordads-ad iframe {\n    margin: 0;\n    padding: 0\n}\n\n.wordads-ad.wordads-ad-responsive {\n    width: 100%;\n    max-width: unset\n}\n\n.wordads-ad-sticky-wrapper {\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    margin: auto;\n    position: fixed;\n    transition: transform .2s ease-in-out;\n    user-select: none;\n    padding: 5px 0;\n    z-index: 49999\n}\n.wordads-ad-wrapper--bottom_sticky.wordads-ad-sticky-wrapper {\n    right: 0;\n    left: 0;\n    bottom: 0;\n    background: transparent;\n    transform: translate(0, 0);\n}\n\n.wordads-ad-wrapper--bottom_sticky.wordads-ad-sticky-wrapper.ad-slot-filled {\n    background: #f1f1f1;\n}\n\n.wordads-ad-wrapper--sidebar_sticky_right.wordads-ad-sticky-wrapper {\n    width: fit-content;\n    min-width: 120px;\n    top: max(calc(var(--wp-admin--admin-bar--height, 0px) + 24px), 10%);\n    right: 20px;\n}\n\n.wordads-ad-wrapper--sidebar_sticky_right .wordads-ad-content {\n    border: 1px solid #f1f1f1;\n    margin-left: -1px;\n}\n\n.wordads-ad-sticky-close-btn {\n    width: 28px;\n    height: 28px;\n    position: absolute;\n    box-sizing: content-box;\n    cursor: pointer;\n    overflow: hidden;\n    background-size: 28px;\n    background-repeat: no-repeat;\n    background-position: center;\n    background-image: url(${h})\n}\n\n.wordads-ad-wrapper--bottom_sticky .wordads-ad-sticky-close-btn {\n    top: -14px;\n    left: .75rem;\n}\n\n.wordads-ad-wrapper--sidebar_sticky_right .wordads-ad-sticky-close-btn {\n    top: -14px;\n    right: 0;\n}\n\n.wordads-ad-sticky {\n    width: auto;\n    max-width: initial;\n    max-height: inherit;\n}\n\n.wordads-ad-sticky .wordads-ad-title,\n.wordads-ad-sticky .wordads-ad-controls {\n    color: #333\n}\n\n.wordads-ad-hidden {\n\tvisibility: hidden !important;\n\tposition: absolute !important;\n\tpointer-events: none !important;\n\twidth: 0 !important;\n\theight: 0 !important;\n\toverflow: hidden !important;\n\tclip: rect(0 0 0 0) !important;\n}\n\n.wordads-ad-wrapper--bottom_sticky.wordads-ad-hidden {\n    transform: translate(0, 1000px);\n}\n\n.google-auto-placed {\n    height: 0px !important;\n}\n\nins.adsbygoogle::before,\nins.adsbygoogle::after {\n    visibility: hidden !important;\n}\n\nins.adsbygoogle {\n    background: transparent;\n    padding: 0 !important;\n}`,""]);const u=c},261:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var i="",n=void 0!==e[5];return e[4]&&(i+="@supports (".concat(e[4],") {")),e[2]&&(i+="@media ".concat(e[2]," {")),n&&(i+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),i+=t(e),n&&(i+="}"),e[2]&&(i+="}"),e[4]&&(i+="}"),i})).join("")},e.i=function(t,i,n,o,s){"string"==typeof t&&(t=[[null,t,void 0]]);var d={};if(n)for(var r=0;r<this.length;r++){var a=this[r][0];null!=a&&(d[a]=!0)}for(var l=0;l<t.length;l++){var c=[].concat(t[l]);n&&d[c[0]]||(void 0!==s&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=s),i&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=i):c[2]=i),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),e.push(c))}},e}},160:t=>{"use strict";
1t.exports=function(t,e){return e||(e={}),t?(t=String(t.__esModule?t.default:t),/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),e.hash&&(t+=e.hash),/["'() \t\n]|(%20)/.test(t)||e.needQuotes?'"'.concat(t.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):t):t}},191:t=>{"use strict";t.exports=function(t){return t[1]}},546:function(t){t.exports=function(){"use strict";function t(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)t[n]=i[n]}return t}return function e(i,n){function o(e,o,s){if("undefined"!=typeof document){"number"==typeof(s=t({},n,s)).expires&&(s.expires=new Date(Date.now()+864e5*s.expires)),s.expires&&(s.expires=s.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var d="";for(var r in s)s[r]&&(d+="; "+r,!0!==s[r]&&(d+="="+s[r].split(";")[0]));return document.cookie=e+"="+i.write(o,e)+d}}return Object.create({set:o,get:function(t){if("undefined"!=typeof document&&(!arguments.length||t)){for(var e=document.cookie?document.cookie.split("; "):[],n={},o=0;o<e.length;o++){var s=e[o].split("="),d=s.slice(1).join("=");try{var r=decodeURIComponent(s[0]);if(n[r]=i.read(d,r),t===r)break}catch(t){}}return t?n[t]:n}},remove:function(e,i){o(e,"",t({},i,{expires:-1}))},withAttributes:function(i){return e(this.converter,t({},this.attributes,i))},withConverter:function(i){return e(t({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(i)}})}({read:function(t){return'"'===t[0]&&(t=t.slice(1,-1)),t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"})}()},462:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>w});var n=i(157),o=i.n(n),s=i(869),d=i.n(s),r=i(318),a=i.n(r),l=i(825),c=i.n(l),h=i(597),u=i.n(h),g=i(770),p=i.n(g),m=i(14),f={};f.styleTagTransform=p(),f.setAttributes=c(),f.insert=a().bind(null,"head"),f.domAPI=d(),f.insertStyleElement=u(),o()(m.Z,f);const w=m.Z&&m.Z.locals?m.Z.locals:void 0},157:t=>{"use strict";var e=[];function i(t){for(var i=-1,n=0;n<e.length;n++)if(e[n].identifier===t){i=n;break}return i}function n(t,n){for(var s={},d=[],r=0;r<t.length;r++){var a=t[r],l=n.base?a[0]+n.base:a[0],c=s[l]||0,h="".concat(l," ").concat(c);s[l]=c+1;var u=i(h),g={css:a[1],media:a[2],sourceMap:a[3],supports:a[4],layer:a[5]};if(-1!==u)e[u].references++,e[u].updater(g);else{var p=o(g,n);n.byIndex=r,e.splice(r,0,{identifier:h,updater:p,references:1})}d.push(h)}return d}function o(t,e){var i=e.domAPI(e);return i.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;i.update(t=e)}else i.remove()}}t.exports=function(t,o){var s=n(t=t||[],o=o||{});return function(t){t=t||[];for(var d=0;d<s.length;d++){var r=i(s[d]);e[r].references--}for(var a=n(t,o),l=0;l<s.length;l++){var c=i(s[l]);0===e[c].references&&(e[c].updater(),e.splice(c,1))}s=a}}},318:t=>{"use strict";var e={};t.exports=function(t,i){var n=function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}e[t]=i}return e[t]}(t);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(i)}},597:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},825:(t,e,i)=>{"use strict";t.exports=function(t){var e=i.nc;e&&t.setAttribute("nonce",e)}},869:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(i){!function(t,e,i){var n="";i.supports&&(n+="@supports (".concat(i.supports,") {")),i.media&&(n+="@media ".concat(i.media," {"));var o=void 0!==i.layer;o&&(n+="@layer".concat(i.layer.length>0?" ".concat(i.layer):""," {")),n+=i.css,o&&(n+="}"),i.media&&(n+="}"),i.supports&&(n+="}");var s=i.sourceMap;s&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleTagTransform(n,t,e.options)}(e,t,i)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},770:t=>{"use strict";
1t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},858:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(639),s=n(i(539)),d=i(444),r=i(501);class a extends s.default{constructor(t,e){super(t,e),this.config={},this.adSenseLibraryLoaded=!1,this.adFlowUrl="https://af.pubmine.com?api_version=2"}insertAdBefore(t,e,i){if(!this.shouldShowInlineAds())return;this.log(`Inserting ad before element: ${t.id} of type: ${e}`);const n=this.getRandomTagId(),o=this.createAdSnippet(n,i),s=this.wrapSnippet(o,e);t.insertAdjacentElement("beforebegin",s),this.slots.push({tagId:n,type:e,sizes:i,element:s,isLazy:!0}),this.trackStat("render_inline")}getAdFlowRequestBody(t){const{maxHeight:e,maxWidth:i}=(0,d.getMaxSlotDimension)(t.sizes),n={site:{id:String(this.config.blog_id),is_wordads:this.config.is_wordads,page:window.location.href,language:this.config.blog_language},ad:{tag:t.tagId,format:t.type,max_width:i,max_height:e},user:{uid:this.consent.getOrCreateUID(),gdpr:!1}};return this.consent.usPrivacy&&(n.user.us_privacy=this.consent.usPrivacy),this.consent.tcData&&(n.user.gdpr=!0,n.user.gdpr_consent=this.consent.tcData.tcString),n}shouldShowInlineAds(){var t,e;if(!(null===(t=this.config.enabled_formats)||void 0===t?void 0:t.inline)){const t=document.getElementsByTagName("body")[0];(t.classList.contains("single-post")||t.classList.contains("wp-singular"))&&(this.config.enabled_formats||(this.config.enabled_formats={}),this.config.enabled_formats.inline=!0)}return!!(null===(e=this.config.enabled_formats)||void 0===e?void 0:e.inline)}getMaxSlots(){return r.MAX_INLINE_SLOTS}getMaxBlazeSlots(){return r.MAX_INLINE_BLAZE_SLOTS}shouldShowBottomStickyAds(){var t;return!!(null===(t=this.config.enabled_formats)||void 0===t?void 0:t.bottom_sticky)}shouldShowSidebarStickyRightAds(){var t;return!!(null===(t=this.config.enabled_formats)||void 0===t?void 0:t.sidebar_sticky_right)}shouldShowTopAds(){var t;return!!(null===(t=this.config.enabled_formats)||void 0===t?void 0:t.top)}isSlotTypeEnabled(t){var e;return!!(null===(e=this.config)||void 0===e?void 0:e.formats.includes(t))}getSlotFormatId(t){}getBottomStickySlots(){return(0,r.getSortedSlotSizes)(o.SlotType.BOTTOM_STICKY)}convertFormatsToObject(t){return t.reduce(((t,e)=>(t[e]=!0,t)),{})}initAdNetwork(){this.initDynamicAdSlots(),this.initAditude()}mergeConfig(){var t;window.isWatlV1=!1;const e=this.getServerConfig();e&&(this.config=this.deepMerge(e,this.config)),this.config.enabled_formats=this.convertFormatsToObject(this.config.formats),this.log("Merged config:"),this.log(null!==(t=this.config)&&void 0!==t?t:{})}handleAdResponse(t,e){const i=!!this.config.afp_account_id,n=t.content.indexOf("window.tude")>-1;if(!(t.content.indexOf("var sas = sas")>-1)&&n&&this.forceAfpAds&&i)return void this.renderGoogleAfpAd(e.tagId);const o=!!(null==t?void 0:t.content),s=!!(null==t?void 0:t.pixel);if(o){const e=document.createElement("script");e.type="application/javascript",e.innerHTML=t.content,document.body.appendChild(e)}if(s){const e=new XMLHttpRequest;e.open("GET",t.pixel),e.send()}this.trackAdFlowRequestLatency(o,e.tagId,e.type)}tryUsingIponwebSlots(){var t;window.__ATA=window.__ATA||{cmd:[]},window.__ATA.cmd=window.__ATA.cmd||[];const e=this;window.__ATA.initSlot=function(t,i){var n;const s=document.getElementById(t);if(s&&(0===s.children.length||"SCRIPT"===(null===(n=s.children[0])||void 0===n?void 0:n.tagName))){const n=(0,r.getFormatBySizes)(i.width,i.height);if(!n)return;const d=s.getBoundingClientRect();d.width<i.width&&(s.style.width=`${i.width}px !important`),d.height<i.height&&(s.style.height=`${i.height}px !important`);const a=e.createAdSnippet(t,[[i.width,i.height]]),l=e.wrapSnippet(a,o.SlotType.GUTENBERG_RECTANGLE);s.insertAdjacentElement("beforebegin",l),s.remove(),window.iponwebTags=window.iponwebTags||[],window.iponwebTags.push(t),window.tudeMappings.push({divId:t,format:n,width:i.width,height:i.height}),e.log(`Use IPONWEB's container for ${t} (${i.width}x${i.height}px), format: ${n}`)}},window.__ATA.initDynamicSlot=function(t){var e,i;const n=document.getElementById(t.id);if(n){const o=Math.round(null!==(i=null===(e=n.getBoundingClientRect())||void 0===e?void 0:e.width)&&void 0!==i?i:0);o>=300&&o<970&&window.__ATA.initSlot(t.id,{width:300,height:250})}},window.__ATA.initVideoSlot=function(t){window.__ATA.initDynamicSlot({id:t})};const i=null!==(t=window.__ATA.cmd.push)&&void 0!==t?t:()=>{};for(const t of window.__ATA.cmd)"function"==typeof t&&t!==i&&t()}initDynamicAdSlots(){var t,e,i,n,s,d;this.log("Initializing Gutenberg ad slots"),window.tudeMappings=window.tudeMappings||[],this.tryUsingIponwebSlots();for(const a of window.tudeMappings){(null==a?void 0:a.width)&&(null==a?void 0:a.height)||([a.width,a.height]=null!==(t=(0,r.getFilteredSlotSizesByWidthAndHeight)(a.format,728,250)[0])&&void 0!==t?t:[300,250]);const{divId:l,format:c,width:h,height:u}=a,g=document.getElementById(l);if(g){if((null===(i=null===(e=null==g?void 0:g.parentElement)||void 0===e?void 0:e.parentElement)||void 0===i?void 0:i.classList.contains("inline"))&&(null===(s=null===(n=g.parentElement.parentElement)||void 0===n?void 0:n.parentElement)||void 0===s?void 0:s.classList.contains("wpa"))&&(null===(d=g.parentElement.parentElement.parentElement.parentElement)||void 0===d?void 0:d.classList.contains("wpcnt"))){const t=g.getBoundingClientRect();t.width<a.width&&(g.style.width=`${a.width}px !important`),t.height<a.height&&(g.style.height=`${a.height}px !important`);const e=this.createAdSnippet(l,[[a.width,a.height]]),i=this.wrapSnippet(e,o.SlotType.GUTENBERG_RECTANGLE),n=g.parentElement.parentElement.parentElement.parentElement;n.insertAdjacentElement("beforebegin",i),n.remove(),g.remove()}this.slots.push({tagId:l,type:c,sizes:[[h,u]],element:g,isLazy:!0}),this.log(`Gutenberg ad slot ${l} initialized`)}else this.log(`Gutenberg ad slot ${l} not found`)}}initAditude(){this.log("Initializing Aditude"),window.tude=window.tude||{cmd:[]},window.Raven=window.Raven||{cmd:[]},window.tude.cmd.push((()=>
1{if(window.tude&&"function"==typeof window.tude.setPageTargeting){const t={param1:String(this.config.blog_id),param2:String(this.config.is_wordads),param3:String(this.config.hosting_type),param4:this.config.theme};window.tude.setPageTargeting(t),this.log("Aditude debug: custom dimensions set "+JSON.stringify(t))}})),window.tude.cmd.push((()=>{window.tude.events.addEventListener("tude_ad_filled",(t=>{this.log("aditude debug event: tude_ad_filled "+JSON.stringify(t)),this.handleAd({tagId:t.detail.id,adNetwork:"Aditude"})})),window.tude.events.addEventListener("tude_ad_unfilled",(t=>{this.log(`Aditude debug event: tude_ad_unfilled (${t.detail.id})`),this.handleNoAd({tagId:t.detail.id,adNetwork:"Aditude"})})),window.tude.events.addEventListener("tude_no_ad_sizes",(t=>{this.log(`Aditude debug event: tude_no_ad_sizes ${t.detail.id}`),this.handleNoAd({tagId:t.detail.id,adNetwork:"Aditude"})}))}))}getLibrariesToFetch(){return{prebid:{loaded:!1,url:"https://dn0qt3r0xannq.cloudfront.net/wordpress-2Pvwql52OT/wordpress-longform/prebid-load.js",isInitialized:()=>void 0!==window.tude,init:()=>{window.tude=window.tude||{cmd:[]}}}}}getServerConfig(){const t=super.getServerConfig();if(void 0!==window.wa_smart&&!0===window.isWatlV1){let[,e]=window.wa_smart.target.split(";");e=e.replace("language=","").split("_")[0];const i=[];for(const t of Object.values(o.SlotType)){const e=window.wa_smart[t];(null==e?void 0:e.enabled)&&i.push(t)}return Object.assign(Object.assign({},t),{blog_language:e,hosting_type:2,theme:window.wa_smart.theme,formats:i})}return t}setAdContainerVisibility(t,e){var i,n,s,d,r,a,l,c,h,u,g;const p=this.slots.find((e=>e.tagId===t));if(!p)return void this.log(`Ad container not found: ${t}`);const m=[o.SlotType.GUTENBERG_LEADERBOARD,o.SlotType.GUTENBERG_RECTANGLE,o.SlotType.GUTENBERG_MOBILE_LEADERBOARD,o.SlotType.GUTENBERG_SKYSCRAPER].includes(p.type);let f=null;if(m&&!(null===(i=window.iponwebTags)||void 0===i?void 0:i.includes(t))){const e=(null===(r=null===(d=null===(s=null===(n=p.element)||void 0===n?void 0:n.parentElement)||void 0===s?void 0:s.parentElement)||void 0===d?void 0:d.parentElement)||void 0===r?void 0:r.parentElement)||null;f=null!==e&&e.classList.contains("wpcnt")?e:null===(l=null===(a=document.getElementById(t))||void 0===a?void 0:a.parentElement)||void 0===l?void 0:l.parentElement}else f=m&&(null===(c=window.iponwebTags)||void 0===c?void 0:c.includes(t))?null===(h=p.element.parentElement)||void 0===h?void 0:h.parentElement:p.element;if(null===(u=p.element.parentElement)||void 0===u||u.querySelectorAll(".wordads-ad-title, .wordads-ad-controls").forEach((t=>{t instanceof HTMLElement&&(t.style.visibility=e?"visible":"hidden")})),f){if(f.classList.toggle("wordads-ad-hidden",!e),!e){const e=document.getElementById(t),i=null===(g=null==e?void 0:e.parentElement)||void 0===g?void 0:g.parentElement;i&&(null==i?void 0:i.classList.contains("ad-slot-filled"))&&i.classList.remove("ad-slot-filled")}}else this.log(`Ad container element not found: ${t}`)}showAdContainer(t){this.setAdContainerVisibility(t,!0)}hideAdContainer(t){this.setAdContainerVisibility(t,!1)}handleAd(t){super.handleAd(t),this.showAdContainer(t.tagId)}handleNoAd(t){this.config.afp_account_id?this.renderGoogleAfpAd(t.tagId):(this.log("Google AFP account is missing"),super.handleNoAd(t),this.hideAdContainer(t.tagId))}renderGoogleAfpAd(t){this.slots.filter((t=>t.type===o.SlotType.TOP)).length>1&&t.indexOf("atatags-dynamic-top-")>-1||this.tryLoadAdsenseLib(t,(()=>{var e;const i=this.config.afp_host_id,n=this.config.afp_account_id;if(!i||!n)return void this.log("Ad host or client ID is missing.");const o=document.getElementById(t);if(!o)return void this.log(`AFP Ad container not found: ${t}`);this.configureGoogleAdContainer(o,t);let s=this.getSlotDimensions(o,t);const d=o.getBoundingClientRect();d.width<s.minWidth&&(o.style.width=`${s.minWidth}px !important`),d.height<s.minHeight&&(o.style.height=`${s.minHeight}px !important`),o.innerHTML=this.createGoogleAdElement(String(n),String(i),s.minWidth,s.minHeight,t),this.log(`Adding observer to adDiv: ${o.id} with slotElementId: ${t}`),this.setupGoogleAdStatusObserver(o,null===(e=o.parentElement)||void 0===e?void 0:e.parentElement)}))}getSlotDimensions(t,e){const i=this.slots.find((t=>t.tagId===e));if(!i){const e=parseInt(t.getAttribute("data-ad-width")||"0",10),i=parseInt(t.getAttribute("data-ad-height")||"0",10);return{minWidth:Math.min(e,300),minHeight:Math.min(i,250)}}const n=i.sizes[i.sizes.length-1],o=(0,d.getCompatibleGoogleAdSizes)(n[0],n[1]),[s,r]=[300,250];
1return o?{minWidth:o[0],minHeight:o[1]}:{minWidth:s,minHeight:r}}getSlot(t){return this.slots.find((e=>e.tagId===t.id))}configureGoogleAdContainer(t,e){var i;const{minWidth:n,minHeight:s}=this.getSlotDimensions(t,e),d=null===(i=t.parentElement)||void 0===i?void 0:i.parentElement;if(!d)return;const r=this.getSlot(t);if((null==r?void 0:r.type)===o.SlotType.BOTTOM_STICKY){let t=s+20;for(const e of[".wordads-ad-title",".wordads-ad-controls"]){const i=d.querySelector(e);i&&(t+=i.offsetHeight||0)}d.style.maxHeight=`${String(t)}px`}else d.style.margin="40px auto","absolute"===window.getComputedStyle(d).position&&(d.style.position="static"),t.style.width=`${n}px`,t.style.height=`${s}px`}createGoogleAdElement(t,e,i,n,s){const d=this.slots.find((t=>t.tagId===s));let r=!1,a=null;(null==d?void 0:d.type)===o.SlotType.BOTTOM_STICKY||[728,970].includes(i)&&90===n?a=7415555587:(null==d?void 0:d.type)===o.SlotType.INLINE||300===i&&250===n?(a=2877544770,r=!0):(null==d?void 0:d.type)===o.SlotType.SIDEBAR_STICKY_RIGHT||120===i&&600===n?a=9195541113:(null==d?void 0:d.type)===o.SlotType.GUTENBERG_MOBILE_LEADERBOARD||320===i&&50===n?a=4785522812:(null==d?void 0:d.type)===o.SlotType.GUTENBERG_SKYSCRAPER||160===i&&600===n?a=5523889413:300===i&&250===n&&(a=6074553751),this.log(`Creating Google AFP ad element for #${s} (${i}x${n}px)`+(null!==a?`, slotId: ${a}`:""));let l=r?'data-ad-format="auto" data-full-width-responsive="true"':`data-ad-width="${i}" data-ad-height="${n}"`;return null!==a&&(l+=` data-ad-slot="${a}"`),`\n\t\t\t<ins class="adsbygoogle"\n\t\t\t\tstyle="${r?"display:block":`display:block;width:${i}px !important;height:${n}px !important;`}"\n\t\t\t\tdata-ad-client="ca-${t}"\n\t\t\t\tdata-ad-host="ca-host-pub-${e}"\n\t\t\t\tdata-ad-host-channel="${this.config.is_wordads?5598771027:3624119425}"\n\t\t\t\t\n\t\t\t\t${l}>\n\t\t\t</ins>\n\t\t`}setupGoogleAdStatusObserver(t,e){if(!e)return;let i=null;const n=t.id,o=this.slots.findIndex((t=>t.tagId===n));-1!==o&&void 0!==this.slots[o]&&(this.slots[o].isProcessed=!1);const s=new MutationObserver((e=>{var n;for(const d of e)if("attributes"===d.type&&"data-ad-status"===d.attributeName){const e=d.target.getAttribute("data-ad-status");let r=null!==(n=d.target.parentElement)&&void 0!==n?n:t;if("filled"===e){this.showAdContainer(r.id),this.log(`Google AFP rendered. Div: ${r.id} Status: ${e}`);const t=this.getSlot(r);(null==t?void 0:t.onAd)&&t.onAd()}else this.hideAdContainer(r.id),this.log(`Google AFP rendered. Div: ${r.id}. Status: ${e}`);null!==i&&clearTimeout(i),-1!==o&&void 0!==this.slots[o]&&(this.slots[o].isProcessed=!0),s.disconnect()}})),d=t.querySelector(".adsbygoogle");d&&(s.observe(d,{attributes:!0,attributeFilter:["data-ad-status"]}),i=setTimeout((()=>{var t;-1!==o&&this.slots[o]&&!1===(null!==(t=this.slots[o].isProcessed)&&void 0!==t&&t)&&(this.hideAdContainer(n),this.slots[o].isProcessed=!0,s.disconnect(),this.log("Time limit for processing Google AFP is exceeded for #"+n))}),5e3)),this.initializeAdsbyGoogle()}initializeAdsbyGoogle(){if(void 0===window.adsbygoogle){const t=setInterval((()=>{void 0!==window.adsbygoogle&&(clearInterval(t),this.initAdsByGoogle(),this.log("Google AFP initialized"))}),100);setTimeout((()=>clearInterval(t)),1e3)}else this.initAdsByGoogle()}initAdsByGoogle(){try{(window.adsbygoogle||[]).push({})}catch(t){let e="Failed to render Google AFP";t instanceof Error&&(e+=": "+t.message),this.log(e)}}tryLoadAdsenseLib(t,e){if(this.adSenseLibraryLoaded)return this.log("Adsense library already loaded"),void e();let i=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-${String(this.config.afp_account_id)}`;if(document.querySelector(`script[src="${i}"]`)){let i=0;const n=setInterval((()=>{if(++i,100*i/1e3>=5)return clearInterval(n),void this.hideAdContainer(t);this.adSenseLibraryLoaded&&(e(),clearInterval(n))}),100)}else{const n=document.createElement("script");n.src=i,n.async=!0;const o=setTimeout((()=>{this.log("Adsense library load timeout exceeded"),this.hideAdContainer(t)}),5e3);n.onload=()=>{clearTimeout(o),this.log("Adsense library loaded"),this.adSenseLibraryLoaded=!0,e()},n.onerror=()=>{this.log("Failed to load Adsense library"),this.hideAdContainer(t)},document.head.appendChild(n)}}}e.default=a}
1,12:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=n(i(202));i(462),e.default=class{constructor(){this.listenersController=new AbortController,this.signal=this.listenersController.signal,this.consent=new o.default}getConsent(){return this.consent}getListenersController(){return this.listenersController}init(t){t.preInit(),this.signal.onabort=()=>t.log("Event listeners removed"),document.addEventListener("scroll",t.throttle((()=>{t.processAds()}),250),{signal:this.signal}),document.addEventListener("resize",t.throttle((()=>{t.processAds()}),250),{signal:this.signal}),window.addEventListener("message",(e=>{t.handlePostMessage(e)}),{signal:this.signal})}}},501:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getSortedSlotSizes=e.getFormatBySizes=e.getFilteredSlotSizesByWidthAndHeight=e.getFilteredSlotSizesByWidth=e.MAX_INLINE_BLAZE_SLOTS=e.MAX_INLINE_SLOTS=void 0;const n=i(639);e.MAX_INLINE_SLOTS=40,e.MAX_INLINE_BLAZE_SLOTS=20,e.getFilteredSlotSizesByWidth=(t,e)=>(s[t]||[]).filter((([t])=>t<=e)),e.getFilteredSlotSizesByWidthAndHeight=(t,e,i)=>(s[t]||[]).filter((([t,n])=>t<=e&&n<=i));const o=document.documentElement.clientWidth<800,s=Object.freeze({[n.SlotType.TOP]:o?[[320,50]]:[[970,250],[970,90],[728,90]],[n.SlotType.INLINE]:o?[[300,250],[320,50]]:[[970,250],[728,90],[300,250]],[n.SlotType.BELOW_POST]:o?[[300,250]]:[[300,250],[728,90]],[n.SlotType.BOTTOM_STICKY]:o?[[320,50],[468,60]]:[[728,90],[970,90]],[n.SlotType.SIDEBAR]:o?[[120,600],[160,600],[300,250],[300,400],[300,600]]:[[120,600],[160,600],[300,600]],[n.SlotType.SIDEBAR_STICKY_RIGHT]:o?[]:[[120,600],[160,600],[300,250],[300,600],[400,600]],[n.SlotType.GUTENBERG_RECTANGLE]:[[300,250]],[n.SlotType.GUTENBERG_LEADERBOARD]:[[728,90]],[n.SlotType.GUTENBERG_MOBILE_LEADERBOARD]:[[320,50]],[n.SlotType.GUTENBERG_SKYSCRAPER]:[[160,600]],[n.SlotType.SIDEBAR_WIDGET_MEDIUMRECTANGLE]:[[300,250]],[n.SlotType.SIDEBAR_WIDGET_LEADERBOARD]:[[728,90]],[n.SlotType.SIDEBAR_WIDGET_WIDESKYSCRAPER]:[[160,600]],[n.SlotType.SHORTCODE]:[[300,250]]});e.getFormatBySizes=(t,e)=>{for(const[i,o]of Object.entries(s))if(![n.SlotType.TOP,n.SlotType.BOTTOM_STICKY,n.SlotType.SIDEBAR,n.SlotType.SIDEBAR_STICKY_RIGHT,n.SlotType.SIDEBAR_WIDGET_MEDIUMRECTANGLE,n.SlotType.SIDEBAR_WIDGET_LEADERBOARD,n.SlotType.SIDEBAR_WIDGET_WIDESKYSCRAPER,n.SlotType.SIDEBAR_WIDGET_WIDESKYSCRAPER,n.SlotType.INLINE,n.SlotType.SHORTCODE,n.SlotType.BELOW_POST].includes(i)&&o.some((([i,n])=>i===t&&n===e)))return i;return null},e.getSortedSlotSizes=t=>s[t].sort(((t,e)=>{const i=e[0]-t[0];return 0!==i?i:e[1]-t[1]}))},586:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SMART_NETWORK_ID=void 0,e.SMART_NETWORK_ID=3905},506:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=n(i(12)),s=n(i(858)),d=new o.default,r=new s.default(d.getConsent(),d.getListenersController());d.init(r)},313:(t,e)=>{"use strict";var i;Object.defineProperty(e,"__esModule",{value:!0}),e.ScrollDirection=void 0,function(t){t.UP="up",t.DOWN="down"}(i||(e.ScrollDirection=i={}))},639:(t,e)=>{"use strict";var i;Object.defineProperty(e,"__esModule",{value:!0}),e.StickySlotTypes=e.SlotType=void 0,function(t){t.TOP="top",t.INLINE="inline",t.BELOW_POST="belowpost",t.BOTTOM_STICKY="bottom_sticky",t.SIDEBAR="sidebar",t.SIDEBAR_STICKY_RIGHT="sidebar_sticky_right",t.GUTENBERG_RECTANGLE="gutenberg_rectangle",t.GUTENBERG_LEADERBOARD="gutenberg_leaderboard",t.GUTENBERG_MOBILE_LEADERBOARD="gutenberg_mobile_leaderboard",t.GUTENBERG_SKYSCRAPER="gutenberg_skyscraper",t.SIDEBAR_WIDGET_MEDIUMRECTANGLE="sidebar_widget_mediumrectangle",t.SIDEBAR_WIDGET_LEADERBOARD="sidebar_widget_leaderboard",t.SIDEBAR_WIDGET_WIDESKYSCRAPER="sidebar_widget_wideskyscraper",t.SHORTCODE="shortcode"}(i||(e.SlotType=i={})),e.StickySlotTypes=[i.BOTTOM_STICKY,i.SIDEBAR_STICKY_RIGHT]},202:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};
1Object.defineProperty(e,"__esModule",{value:!0});const o=n(i(546)),s=i(586);e.default=class{constructor(){this.logging=!1,this.tcData=null,this.usPrivacy=null,this.uid=null}setLogging(t){this.logging=t}log(t){this.logging&&console.log(t)}init(){this.log("Initializing consent..."),window.__uspapi?(this.log("Querying USP API..."),window.__uspapi("getUSPData",1,((t,e)=>{e&&t.uspString&&(this.usPrivacy=t.uspString,this.log("USP API data found. Setting consent: "+this.usPrivacy))}))):this.log("USP API not found"),window.__tcfapi?(this.log("Querying TCF API..."),window.__tcfapi("addEventListener",2,((t,e)=>{var i;e&&t.gdprApplies?(this.tcData=t,this.log("TCF API data found. Setting consent: "+(null===(i=this.tcData)||void 0===i?void 0:i.tcString)),this.initCookieSync()):this.log("TCF API data found. GDPR does not apply")}))):this.log("TCF API not found")}createUIDFromCookies(t,e,i){const n={expires:e,domain:i||window.location.hostname};this.log(`Created UID from Cookies on ${n.domain}`);const s=o.default.withAttributes(n),d=this.generateUIDValue();return s.set(t,d),d}generateUIDValue(){return Math.random().toString(36).substring(2,10)+(new Date).getTime().toString()}getOrCreateUIDFromLocalStorage(t,e){this.log("UID from localStorage");const i=(localStorage.getItem(t)||"").split(":");let n=i[0];const o=(new Date).getTime();let s=parseInt(i[1]);return(!n||o>s)&&(n=this.generateUIDValue(),s=o+24*e*60*60*1e3,localStorage.setItem(t,n+":"+s)),n}getOrCreateUID(){if(null!==this.uid)return this.uid;if(!this.hasUserConsent())return this.uid="",this.uid;const t="wordads_uid",e=o.default.get(t);if(e)return this.log(`Reused UID value ${e}`),this.uid=e,this.uid;const i=this.getCookiesSharedDomain(t,window.location.hostname);return window.localStorage&&!i||(this.uid=this.createUIDFromCookies(t,30,i)),this.uid=this.uid||this.getOrCreateUIDFromLocalStorage(t,30),this.log(`UID value: ${this.uid}`),this.uid}getCookiesSharedDomain(t,e){const i=e.split(".");if(i.length<=2)return null;let n=null,s=0;for(const d of i){if(s+=d.length,n=e.substring(s),s>=e.length)return null;const i=o.default.withAttributes({domain:n});if(i.set(t,"1")&&i.get(t))return i.remove(t),n;s++}return null}hasUserConsent(){return!this.tcData||!0===this.tcData.vendor.consents[496]&&!0===this.tcData.purpose.consents[1]}initCookieSync(){this.log("Initializing Cookie Sync");let t=`https://sync.smartadserver.com/getuid?nwid=${s.SMART_NETWORK_ID}&url=https://af.pubmine.com/user-sync?pid=[sas_uid]`;this.tcData&&(t+=`&gdpr=1&gdpr_consent=${this.tcData.tcString}`),document.createElement("img").src=t}}},444:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getCompatibleGoogleAdSizes=e.convertFormatsToObject=e.getMaxSlotDimension=void 0;const i=[[970,250],[970,90],[728,90],[336,280],[320,100],[300,600],[300,250],[250,250],[200,200],[320,50],[300,50],[468,60],[160,600],[120,600]];e.getMaxSlotDimension=t=>{let e=0,i=0;return t.forEach((([t,n])=>{t>e&&(e=t),n>i&&(i=n)})),{maxWidth:e,maxHeight:i}},e.convertFormatsToObject=t=>t.reduce(((t,e)=>(t[e]=!0,t)),{}),e.getCompatibleGoogleAdSizes=(t,e)=>{const n=i.find((([i,n])=>i<=t&&n<=e));return null!=n?n:null}},539:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=i(501),o=i(639),s=i(313),d=i(444),r=["BLOCKQUOTE","DIV","FIGURE","FORM","H1","H2","H3","H4","H5","H6","P","UL"];e.default=class{constructor(t,e){this.logging="function"==typeof URLSearchParams&&"true"===new URLSearchParams(window.location.search).get("wordads-logging"),this.consent=t,this.consent.setLogging(this.logging),this.adFlowUrl="https://af.pubmine.com",this.slots=[],this.initialized=!1,this.config={},this.scroll={lastDirection:s.ScrollDirection.DOWN,lastY:window.scrollY},this.listenersController=e,this.forceAfpAds="function"==typeof URLSearchParams&&"1"===new URLSearchParams(window.location.search).get("afp_test")}log(t){this.logging&&console.log(t)}logSlot(t,e){if(!this.logging)return;const i=t.sizes.map((([t,e])=>t+"x"+e)).join(","),n=[t.type,t.tagId,i].join("|");this.log(`[${n}] ${e}`)}trackStat(t){window._stq=window._stq||[],window._stq.push(["extra",{x_wordads_smart:t}])}recordTracksEvent(t,e){e=e||{},window._tkq=window._tkq||[],window._tkq.push(["recordEvent",t,e])}getServerConfig(){var t,e;const i=document.getElementById("adflow-configuration"),n=i?JSON.parse(i.innerText):{},o=null!==(e=null===(t=null===window||void 0===window?void 0:window.wa_client)||void 0===t?void 0:t.config)&&void 0!==e?e:null===window||void 0===window?void 0:window.wa_smart;return this.deepMerge(n,o)}createAdSnippet(t,e){let i=document.createElement("div"),n=document.createElement("div"),o=document.createElement("div"),s=document.createElement("div");if(i.classList.add("wordads-ad"),n.classList.add("wordads-ad-title"),o.classList.add("wordads-ad-content"),s.classList.add("wordads-ad-controls"),n.innerText=this.config._.title,o.id=t,e){const{maxHeight:t,maxWidth:i}=(0,d.getMaxSlotDimension)(e);o.setAttribute("data-ad-height",t.toString()),o.setAttribute("data-ad-width",i.toString())}return s.innerHTML=this.consent.tcData?`<span onclick="__tcfapi( 'showUi' )">${this.config._.privacy_settings}</span>`:"",i.appendChild(n),i.appendChild(o),i.appendChild(s),i}getBottomStickySlots(){}createBottomStickyAdSnippet(t){const e=this.getBottomStickySlots(),i=this.createAdSnippet(t,e);i.classList.add("wordads-ad-sticky");const n=this.wrapSnippet(i,o.SlotType.BOTTOM_STICKY);n.classList.add("wordads-ad-sticky-wrapper");const d=()=>{this.toggleVisibility(n,s.ScrollDirection.DOWN)},r=document.createElement("div");
1return r.classList.add("wordads-ad-sticky-close-btn"),r.onclick=function(){n.remove(),document.removeEventListener("scroll",d)},n.insertBefore(r,i),{event:d,snippet:n}}createSidebarStickyAdSnippet(t,e){const i=this.createAdSnippet(t);i.classList.add("wordads-ad-sticky");const n=this.wrapSnippet(i,e);n.classList.add("wordads-ad-sticky-wrapper");const o=this.throttle((()=>{this.updateSidebarStickyVisibility(n)}),150),s=document.createElement("div");return s.classList.add("wordads-ad-sticky-close-btn"),s.onclick=function(){n.remove(),window.removeEventListener("resize",o),document.removeEventListener("scroll",o)},n.insertBefore(s,i),{event:o,snippet:n,adContent:i.querySelector(".wordads-ad-content")}}toggleVisibility(t,e){const i=window.scrollY>this.scroll.lastY?s.ScrollDirection.DOWN:s.ScrollDirection.UP,n=this.scroll.lastDirection===i;if(this.scroll.lastDirection=i,this.scroll.lastY=window.scrollY,n)return;const o="wordads-ad-hidden";e===i?t.classList.remove(o):t.classList.add(o)}wrapSnippet(t,e){const i=document.createElement("div");return i.classList.add("wordads-ad-wrapper"),i.classList.add(`wordads-ad-wrapper--${e}`),i.appendChild(t),i}checkBrandSafety(t,e){}handleNotOkayResponse(t,e){var i;if(this.log(`Site unable to show ads: ${e.tagId}`),204===t){const t=document.getElementById(e.tagId),n=null===(i=null==t?void 0:t.parentElement)||void 0===i?void 0:i.parentElement;t&&(null==n?void 0:n.classList.contains("wordads-ad-wrapper"))&&n.classList.add("wordads-ad-hidden"),this.listenersController.abort()}}callAdFlow(t){this.logSlot(t,"calling AdFlow");const e=new XMLHttpRequest;e.onreadystatechange=()=>{if(XMLHttpRequest.DONE===e.readyState){if(performance.mark(`${t.tagId}-end`),200!==e.status)return void this.handleNotOkayResponse(e.status,t);const i=JSON.parse(e.response);this.handleAdResponse(i,t)}},e.open("POST",this.adFlowUrl),e.setRequestHeader("Accept","application/json"),e.withCredentials=!0,performance.mark(`${t.tagId}-start`);const i=this.getAdFlowRequestBody(t);e.send(JSON.stringify(i))}trackAdFlowRequestLatency(t,e,i){let n=performance.measure(`${e}-duration`,`${e}-start`,`${e}-end`),o={has_ad:t,ad_type:i,request_time:Math.round(n.duration),theme:this.config.theme};navigator.connection&&(o.connection_effective_type=navigator.connection.effectiveType,o.connection_downlink=navigator.connection.downlink),this.recordTracksEvent("wpcom_wordads_adflow",o)}insertFallbackAd(t,e){let i=(window.sas_fallback||[]).filter((function(t){return t.type===e}));if(0===i.length)return t.remove(),void this.log(`No fallback found for ${e}, snippet removed`);let n=i[0].tag.replaceAll("{{unique_id}}",Math.trunc(1e6*Math.random())),o=document.createElement("div");o.innerHTML=n,n=o.childNodes[0].nodeValue;let s=document.createElement("div");s.innerHTML=n,t.style.position="relative",t.style.visibility="visible",t.innerHTML=s.innerHTML,s.querySelectorAll("script").forEach((function(t){t.parentNode&&t.parentNode.removeChild(t);let e=document.createElement("script");t.src?e.src=t.src:t.textContent?e.textContent=t.textContent:t.innerText&&(e.innerText=t.innerText),document.body.appendChild(e)})),this.trackStat("fallback_"+e)}getPostItems(t){let e=[];for(let i=0;i<t.children.length;i++){let n=t.children[i];this.isPostItemValid(n)&&e.push(n)}return e}getFontSize(t){const e=t.parentElement;if(e)for(let t=0;t<e.children.length;t++){const i=e.children[t];if("P"===i.nodeName)return parseFloat(window.getComputedStyle(i).fontSize)}return 16}isPostItemVisible(t){const e=window.getComputedStyle(t);return!!t.offsetParent&&"hidden"!==e.visibility&&"none"!==e.display&&t.offsetHeight>=this.getFontSize(t)}isPostItemValid(t,e=!1){if(!t||!r.includes(t.nodeName))return!1;if(e&&"DIV"===t.nodeName){let e=!1;const i=4,n=t=>{var e;return!(null===(e=document.evaluate('//div[contains(@class, "wpcnt")]/div[contains(@class, "wpa")]/div/div/div[starts-with(@id, "atatags-")]',t,null,XPathResult.ANY_UNORDERED_NODE_TYPE,null).singleNodeValue)||void 0===e||!e)},o=t=>{var e;return!(null===(e=document.evaluate('//div[contains(@class, "wordads-ad-wrapper")]',t,null,XPathResult.ANY_UNORDERED_NODE_TYPE,null).singleNodeValue)||void 0===e||!e)},s=(t,e)=>{if(e>i)return!1;for(let i=0;i<t.children.length;i++){const d=t.children[i];if(o(d))return!0;
1if(n(d))return!0;if(s(d,e+1))return!0}return!1};if(e=s(t,1),e)return!1}return this.isPostItemVisible(t)}getFloatingElements(t){let e=[],i=t.getElementsByTagName("*");for(let t=0;t<i.length;t++){let n=i[t],o=getComputedStyle(n),s=o.getPropertyValue("position"),d=o.getPropertyValue("float");"relative"!==s&&"absolute"!==s&&"none"===d||e.push(n)}return e}getElementGlobalPosition(t){let e=t.getBoundingClientRect();return{top:e.top+window.scrollY,left:e.left+window.scrollX,bottom:e.top+window.scrollY+e.height,right:e.left+window.scrollX+e.width}}collidesWithElements(t,e){let i=this.getElementGlobalPosition(t),n=!1;return e.forEach((t=>{let e=this.getElementGlobalPosition(t);i.bottom<e.top||i.top>e.bottom||i.right<e.left||i.left>e.left||(n=!0)})),n}getInlineFormatId(){}initInlineAds(){if(!this.shouldShowInlineAds())return;this.log(`Initializing ${o.SlotType.INLINE}`);let t=document.getElementById("wordads-inline-marker");if(!t)return void this.trackStat("inline_no_marker");let e=t.parentElement;if(!e)return;const i=this.getAvailableWidth(e),s=(0,n.getFilteredSlotSizesByWidth)(o.SlotType.INLINE,i);t.remove();let d=this.getMaxSlots(),r=0;const a=window.innerHeight,l=Math.ceil(1.1*a),c=Math.ceil(1.2*a);let h=e.getBoundingClientRect().top+window.scrollY+l;const u=this.getPostItems(e),g=this.getFloatingElements(e);if(u.length>0)for(let t=0;t<u.length;t++){const e=t>0?u[t-1]:null,i=t<u.length-1?u[t+1]:null,n=u[t],a=n.getBoundingClientRect().top+window.scrollY,l=a>h,p=e&&this.isPostItemValid(e,!0),m=this.isPostItemValid(n,!0),f=null===i||i&&this.isPostItemValid(i,!0),w=this.collidesWithElements(n,g);l&&r<d&&p&&m&&f&&!w&&(this.insertAdBefore(n,o.SlotType.INLINE,s,r,this.getInlineFormatId()),h=a+c,r++)}0===r&&this.trackStat("inline_no_insert")}getBottomStickyFormatId(){}initBottomSticky(){if(!this.shouldShowBottomStickyAds())return;this.log(`Initializing ${o.SlotType.BOTTOM_STICKY}`);const t=this.getRandomTagId(),{event:e,snippet:i}=this.createBottomStickyAdSnippet(t);document.body.append(i);const s=document.documentElement.clientWidth,d=(0,n.getFilteredSlotSizesByWidth)(o.SlotType.BOTTOM_STICKY,s),r=this.getBottomStickyFormatId();this.slots.push(Object.assign({tagId:t,type:o.SlotType.BOTTOM_STICKY,sizes:d,element:i,isLazy:!1,onAd:function(){var i;document.addEventListener("scroll",e,{passive:!0});const n=document.getElementById(t),o=null===(i=null==n?void 0:n.parentElement)||void 0===i?void 0:i.parentElement;o&&o.classList.add("ad-slot-filled")}},r?{formatId:r}:{}))}getSidebarStickyRightFormatId(){}initSidebarStickyRight(){var t,e;if(!this.shouldShowSidebarStickyRightAds())return;this.log(`Initializing ${o.SlotType.SIDEBAR_STICKY_RIGHT}`);const i=this.getRandomTagId(),{event:s,snippet:d,adContent:r}=this.createSidebarStickyAdSnippet(i,o.SlotType.SIDEBAR_STICKY_RIGHT),a=null!==(t=document.querySelectorAll(".wp-site-blocks"))&&void 0!==t?t:[];if(1===a.length)a[0].append(d);else{const t=null!==(e=document.querySelectorAll("div#page"))&&void 0!==e?e:[];1===t.length?t[0].append(d):document.body.append(d)}const{maxWidth:l,maxHeight:c}=this.getMaxAvailableSidebarStickySize(d);null==r||r.setAttribute("data-ad-height",c.toString()),null==r||r.setAttribute("data-ad-width",l.toString());const h=(0,n.getFilteredSlotSizesByWidthAndHeight)(o.SlotType.SIDEBAR_STICKY_RIGHT,l,c);if(!h.length)return this.log(`No size available for ${o.SlotType.SIDEBAR_STICKY_RIGHT}`),void d.remove();const u=this.getSidebarStickyRightFormatId();this.slots.push(Object.assign({tagId:i,type:o.SlotType.SIDEBAR_STICKY_RIGHT,sizes:h,element:d,isLazy:!1,onAd:()=>{this.updateSidebarStickyVisibility(d),window.addEventListener("resize",s,{passive:!0}),document.addEventListener("scroll",s,{passive:!0})}},u?{formatId:u}:{}))}appendTopTag(){const t=this.getRandomTagId(),e=document.createElement("div");e.id=t;const i=document.documentElement.clientWidth,s=(0,n.getFilteredSlotSizesByWidth)(o.SlotType.TOP,i),d=this.createAdSnippet(t,s),r=this.wrapSnippet(d,o.SlotType.TOP);return document.body.insertBefore(e,document.body.firstChild),e.insertAdjacentElement("beforebegin",r),e.remove(),this.slots.push({tagId:t,type:o.SlotType.TOP,sizes:s,element:r,isLazy:!0}),e}initTop(){if(!this.shouldShowTopAds())return;this.log(`Initializing ${o.SlotType.TOP}`);const t=Array.from(document.getElementsByClassName("wordads-tag"));let[e]=t.filter((t=>t.dataset.slotType===o.SlotType.TOP));e&&e.remove(),e=this.appendTopTag()}updateSidebarStickyVisibility(t){const e=t.offsetHeight;
1this.isWithinViewportHeight(e)&&!this.checkIfAdIsOverlappingContent(t)?(this.log("sidebar_sticky_right: ad slot can fit"),t.classList.remove("wordads-ad-hidden")):(this.log("sidebar_sticky_right: ad slot CANNOT fit"),t.classList.add("wordads-ad-hidden"))}isWithinViewportHeight(t){return t<=.8*window.innerHeight}getOverlappingElements(t,e,i){return t=Math.round(t),e=Math.round(e),document.elementsFromPoint(t,e).filter((t=>{return!((e=t)===i||i.contains(e)||e.contains(i));var e}))}isElementAboveSnippet(t,e){const i=e.getBoundingClientRect(),n=[[i.left+1,i.top+1],[i.right-1,i.top+1],[i.left+1,i.bottom-1],[i.right-1,i.bottom-1],[i.left+i.width/2,i.top+i.height/2]];for(const[i,o]of n){const n=document.elementsFromPoint(i,o);if(n.indexOf(t)<n.indexOf(e))return!0}return!1}checkIfAdIsOverlappingContent(t){const e=t.getBoundingClientRect(),i=[...this.getOverlappingElements(e.left,e.top,t),...this.getOverlappingElements(e.right,e.top,t),...this.getOverlappingElements(e.right,e.bottom,t),...this.getOverlappingElements(e.left,e.bottom,t)].map((t=>t.classList.contains("wordads-ad-wrapper")&&t.querySelector(".wordads-ad-content")||t)),n=[];for(const t of i){const i=t.getBoundingClientRect();if(!(Math.round(e.right)<=Math.round(i.left)||Math.round(e.left)>=Math.round(i.right)||Math.round(e.bottom)<=Math.round(i.top)||Math.round(e.top)>=Math.round(i.bottom))){const e=window.getComputedStyle(t);"none"!==e.display&&"hidden"!==e.visibility&&"0"!==e.opacity&&n.push(t)}}return n.some((e=>this.isElementAboveSnippet(e,t)))}getMaxAvailableSidebarStickySize(t){const e=(0,n.getSortedSlotSizes)(o.SlotType.SIDEBAR_STICKY_RIGHT);for(const[i,n]of e){t.style.width=`${i}px`,t.style.height=`${n}px`;const e=this.checkIfAdIsOverlappingContent(t);if(t.style.width="",t.style.height="",!e&&this.isWithinViewportHeight(n))return this.log(`sidebar_sticky_right: max available size without overlap, [${i}, ${n}]`),{maxWidth:i,maxHeight:n}}return this.log("sidebar_sticky_right: no slot size fits available space"),{maxWidth:0,maxHeight:0}}initAdTags(){var t;this.log("Initializing ad tags");const e=Array.from(document.getElementsByClassName("wordads-tag"));for(let i=0;i<e.length;i++){const o=e[i],s=null!==(t=o.dataset.slotType)&&void 0!==t?t:"",d=this.getSlotFormatId(s),r=this.getAvailableWidth(o.parentElement),a=(0,n.getFilteredSlotSizesByWidth)(s,r);this.log(`Initializing ad tag ${i+1}: ${s}, format id: ${d}`),s?this.isSlotTypeEnabled(s)?null!==d?a.length?(this.insertAdBefore(o,s,a,i,d),o.remove()):(this.log(`No available sizes for slot type: ${s}`),o.remove()):(this.log(`Invalid slot type: ${s}`),o.remove()):(this.log(`Disabled slot type: ${s}`),o.remove()):(this.log(`Slot type not provided: ${s}`),o.remove())}}getAvailableWidth(t){if(!t)return 0;const e=window.getComputedStyle(t),i=parseFloat(e.paddingLeft),n=parseFloat(e.paddingRight);return t.getBoundingClientRect().width-(i+n)}getFormat(t){}handleNoAdWithSmart(){}handleNoAd(t){let e=this.getSlotByTagId(t.tagId);e?((null==t?void 0:t.adNetwork)?this.logSlot(e,`Got NoAd from ${null==t?void 0:t.adNetwork}, requesting a fallback`):this.logSlot(e,"Got NoAd, requesting a fallback"),window.iponwebTags=window.iponwebTags||[],window.iponwebTags.includes(e.tagId)||this.insertFallbackAd(e.element,e.type),this.checkBrandSafety(t,e),this.trackStat("noad_"+e.type)):this.log(`NoAd: no slot found for tag id: ${t.tagId}, format: ${this.getFormat(t)}`)}handleAd(t){let e=this.getSlotByTagId(t.tagId);e?((null==t?void 0:t.adNetwork)?this.logSlot(e,`Got an Ad from ${null==t?void 0:t.adNetwork}`):this.logSlot(e,"Got an Ad"),o.StickySlotTypes.indexOf(e.type)>-1?e.element.style.position="fixed":e.element.style.position="relative",e.element.style.visibility="visible",e.onAd&&e.onAd(),this.trackStat("ad_"+e.type)):this.log(`Ad: no slot found for tag id: ${t.tagId}, format: ${this.getFormat(t)}`)}handlePostMessage(t){if("object"!=typeof t.data)return;if("wa-inline-frame"!==t.data.type)return;const e=t;let i=document.getElementsByTagName("iframe");for(let t=0;t<i.length;t++)if(i[t].contentWindow===e.source){i[t].style.height=Math.ceil(e.data.height)+"px";let n=i[t].closest(".wordads-ad");n&&(n.classList.contains("wordads-ad-responsive")||n.classList.add("wordads-ad-responsive"),e.data.maxWidth&&n.querySelectorAll(".wordads-ad-title, .wordads-ad-controls").forEach((t=>{t.style.maxWidth=e.data.maxWidth})));break}}getSlotByTagId(t){return this.slots.find((e=>e.tagId===t))}getRandomTagId(){return"wordads-ad-"+Math.trunc(1e6*Math.random())}throttle(t,e){let i=!1;return(...n)=>{i||(t(...n),i=!0,setTimeout((()=>{i=!1}),e))}}isElementInLazyViewport(t){let e=window.innerHeight,i=window.scrollY,n=i-e,o=i+2*e,s=this.getElementGlobalPosition(t);return!(s.bottom<=n||s.top>=o)}processAds(){this.log("processAds: "+this.slots.length),0!==this.slots.length&&this.slots.forEac
1h((t=>{if(t.isLoaded)return;const e=!t.isLazy||this.isElementInLazyViewport(t.element),i=this.checkIfAdIsOverlappingContent(t.element);i&&t.type===o.SlotType.TOP&&(this.logSlot(t,"Top overlaps with other elements, we have to remove it from slots"),this.slots=this.slots.filter((e=>e!==t)),t.element.remove()),!e||i&&t.type!==o.SlotType.BOTTOM_STICKY||(this.logSlot(t,"in view"),t.isLoaded=!0,this.callAdFlow(t))}))}tryInit(t){const e=Object.values(t).map((t=>t.loaded&&t.isInitialized())).filter(Boolean);Object.keys(t).length===e.length&&(this.log("All scripts loaded, initializing..."),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>{this.init()})):this.init())}preInit(){this.log("Running Pre Init");const t=this.getLibrariesToFetch();for(const[e,i]of Object.entries(t)){if(i.isInitialized())continue;this.log(`Fetching ${e} script`),i.init();const n=document.createElement("script");n.src=i.url,n.async=!0,n.addEventListener("load",(()=>{this.log(`${e} is loaded`),t[e]=Object.assign(Object.assign({},i),{loaded:!0}),this.tryInit(t)})),document.head.appendChild(n)}}init(){this.log("Init..."),this.mergeConfig(),this.consent.init(),this.initAdNetwork(),this.consent.initCookieSync(),this.initAds()}initAds(){this.initialized||(this.initialized=!0,this.initInlineAds(),this.initTop(),this.initBottomSticky(),this.initSidebarStickyRight(),this.initAdTags(),this.processAds())}deepMerge(t,e){for(let i in e)e.hasOwnProperty(i)&&(e[i]instanceof Object&&t[i]instanceof Object?t[i]=this.deepMerge(t[i],e[i]):t[i]=e[i]);return t}}},240:t=>{"use strict";t.exports="data:image/svg+xml,%3Csvg width=%2730%27 height=%2730%27 viewBox=%270 0 30 30%27 fill=%27none%27 xmlns=%27http://www.w3.org/2000/svg%27%3E%3Crect x=%270.5%27 y=%270.5%27 width=%2729%27 height=%2729%27 rx=%2714.5%27 fill=%27white%27/%3E%3Crect x=%270.5%27 y=%270.5%27 width=%2729%27 height=%2729%27 rx=%2714.5%27 stroke=%27%23DDDDDF%27/%3E%3Cpath d=%27M19 11L15 15L19 19%27 stroke=%27%237C7F83%27 stroke-width=%271.5%27/%3E%3Cpath d=%27M11 19L15 15L11 11%27 stroke=%27%237C7F83%27 stroke-width=%271.5%27/%3E%3C/svg%3E"}},e={};function i(n){var o=e[n];if(void 0!==o)return o.exports;var s=e[n]={id:n,exports:{}};return t[n].call(s.exports,s,s.exports,i),s.exports}i.m=t,i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.b=document.baseURI||self.location.href,i.nc=void 0,i(506)})();;
2( function() {
3	var cookieValue = document.cookie.replace( /(?:(?:^|.*;\s*)eucookielaw\s*\=\s*([^;]*).*$)|^.*$/, '$1' );
4	var overlay = document.querySelector( '#eu-cookie-law' );
5	var container = document.querySelector( '.widget_eu_cookie_law_widget' );
6	var initialScrollPosition, scrollFunction;
7
8	function remove( el ) {
9		return el && el.parentElement && el.parentElement.removeChild( el );
10	}
11
12	function triggerDismissEvent() {
13		try {
14			const dismissEvent = new Event( 'eucookielaw-dismissed' );
15			document.dispatchEvent( dismissEvent );
16		} catch ( err ) { }
17	}
18
19	function removeOverlay() {
20		remove( overlay );
21		triggerDismissEvent();
22	}
23
24	function fade( el, type, fn ) {
25		var duration = 400;
26
27		el.style.display = 'block';
28		el.style.transitionProperty = 'opacity';
29		el.style.transitionDuration = duration + 'ms';
30		el.style.opacity = type === 'in' ? 0 : 1;
31
32		// Double rAF to ensure styles are applied cross-browser.
33		requestAnimationFrame( function () {
34			requestAnimationFrame( function() {
35				el.style.opacity = type === 'in' ? 1 : 0;
36				// Wait for animation.
37				setTimeout( function () {
38					// Clean up.
39					el.style.removeProperty( 'opacity' );
40					el.style.removeProperty( 'transition-property' );
41					el.style.removeProperty( 'transition-duration' );
42
43					if ( type === 'out' ) {
44						el.style.display = 'none';
45					}
46
47					if ( typeof fn === 'function' ) {
48						fn();
49					}
50				}, duration + 50 );
51			} );
52		} );
53	}
54
55	function appendWidget() {
56		document.body.appendChild( container );
57		overlay.style.display = 'block';
58		fade( container, 'in' );
59	}
60
61	if ( typeof wp !== 'undefined' && !! wp.customize ) {
62		appendWidget();
63		return;
64	}
65
66	if ( ! overlay || ! container ) {
67		return;
68	}
69
70	if ( overlay.classList.contains( 'ads-active' ) ) {
71		var adsCookieValue = document.cookie.replace( /(?:(?:^|.*;\s*)personalized-ads-consent\s*\=\s*([^;]*).*$)|^.*$/, '$1' );
72		if ( cookieValue !== '' && adsCookieValue !== '' ) {
73			removeOverlay();
74		}
75	} else if ( cookieValue !== '' ) {
76		removeOverlay();
77	}
78
79	appendWidget();
80
81	overlay.querySelector( 'form' ).addEventListener( 'submit', accept );
82
83	if ( overlay.classList.contains( 'hide-on-scroll' ) ) {
84		initialScrollPosition = window.pageYOffset;
85
86		scrollFunction = function() {
87			if ( Math.abs( window.pageYOffset - initialScrollPosition ) > 50 ) {
88				accept();
89			}
90		};
91
92		window.addEventListener( 'scroll', scrollFunction );
93	} else if ( overlay.classList.contains( 'hide-on-time' ) ) {
94		var timeout = parseInt( overlay.getAttribute( 'data-hide-timeout' ), 10 ) || 0;
95		setTimeout( accept, timeout * 1000 );
96	}
97
98	var accepted = false;
99	function accept( event ) {
100		if ( accepted ) {
101			return;
102		}
103		accepted = true;
104
105		if ( event && event.preventDefault ) {
106			event.preventDefault();
107		}
108
109		if ( overlay.classList.contains( 'hide-on-scroll' ) ) {
110			window.removeEventListener( 'scroll', scrollFunction );
111		}
112
113		var expireTime = new Date();
114		var consentExpiration = parseInt( overlay.getAttribute( 'data-consent-expiration' ), 10 ) || 0;
115		expireTime.setTime( expireTime.getTime() + ( consentExpiration * 24 * 60 * 60 * 1000 ) );
116
117		document.cookie = 'eucookielaw=' + expireTime.getTime() + ';path=/;expires=' + expireTime.toGMTString();
118		if ( overlay.classList.contains( 'ads-active' ) && overlay.classList.contains( 'hide-on-button' ) ) {
119			document.cookie = 'personalized-ads-consent=' + expireTime.getTime() + ';path=/;expires=' + expireTime.toGMTString();
120		}
121
122		fade( overlay, 'out', function() {
123			removeOverlay();
124			remove( container );
125		} );
126	}
127} )();
128;
129/* global wpcom_reblog */
130
131var jetpackLikesWidgetBatch = [];
132var jetpackLikesMasterReady = false;
133
134// Due to performance problems on pages with a large number of widget iframes that need to be loaded,
135// we are limiting the processing at any instant to unloaded widgets that are currently in viewport,
136// plus this constant that will allow processing of widgets above and bellow the current fold.
137// This aim of it is to improve the UX and hide the transition from unloaded to loaded state from users.
138var jetpackLikesLookAhead = 2000; // pixels
139
140// Keeps track of loaded comment likes widget so we can unload them when they are scrolled out of view.
141var jetpackCommentLikesLoadedWidgets = [];
142
143var jetpackLikesDocReadyPromise = new Promise( resolve => {
144	if ( document.readyState !== 'loading' ) {
145		resolve();
146	} else {
147		window.addEventListener( 'DOMContentLoaded', () => resolve() );
148	}
149} );
150
151function JetpackLikesPostMessage( message, target ) {
152	if ( typeof message === 'string' ) {
153		try {
154			message = JSON.parse( message );
155		} catch ( e ) {
156			return;
157		}
158	}
159
160	if ( target && typeof target.postMessage === 'function' ) {
161		try {
162			target.postMessage(
163				JSON.stringify( {
164					type: 'likesMessage',
165					data: message,
166				} ),
167				'*'
168			);
169		} catch ( e ) {
170			return;
171		}
172	}
173}
174
175function JetpackLikesBatchHandler() {
176	const requests = [];
177	document.querySelectorAll( 'div.jetpack-likes-widget-unloaded' ).forEach( widget => {
178		if ( jetpackLikesWidgetBatch.indexOf( widget.id ) > -1 ) {
179			return;
180		}
181
182		if ( ! jetpackIsScrolledIntoView( widget ) ) {
183			return;
184		}
185
186		jetpackLikesWidgetBatch.push( widget.id );
187
188		var regex = /like-(post|comment)-wrapper-(\d+)-(\d+)-(\w+)/,
189			match = regex.exec( widget.id ),
190			info;
191
192		if ( ! match || match.length !== 5 ) {
193			return;
194		}
195
196		info = {
197			blog_id: match[ 2 ],
198			width: widget.width,
199		};
200
201		if ( 'post' === match[ 1 ] ) {
202			info.post_id = match[ 3 ];
203		} else if ( 'comment' === match[ 1 ] ) {
204			info.comment_id = match[ 3 ];
205		}
206
207		info.obj_id = match[ 4 ];
208
209		requests.push( info );
210	} );
211
212	if ( requests.length > 0 ) {
213		JetpackLikesPostMessage(
214			{ event: 'initialBatch', requests: requests },
215			window.frames[ 'likes-master' ]
216		);
217	}
218}
219
220function JetpackLikesMessageListener( event ) {
221	let message = event && event.data;
222	if ( typeof message === 'string' ) {
223		try {
224			message = JSON.parse( message );
225		} catch ( err ) {
226			return;
227		}
228	}
229
230	const type = message && message.type;
231	const data = message && message.data;
232
233	if ( type !== 'likesMessage' || typeof data.event === 'undefined' ) {
234		return;
235	}
236
237	// We only allow messages from one origin
238	const allowedOrigin = 'https://widgets.wp.com';
239	if ( allowedOrigin !== event.origin ) {
240		return;
241	}
242
243	switch ( data.event ) {
244		case 'masterReady':
245			jetpackLikesDocReadyPromise.then( () => {
246				jetpackLikesMasterReady = true;
247
248				const stylesData = {
249					event: 'injectStyles',
250				};
251				const sdTextColor = document.querySelector( '.sd-text-color' );
252				const sdLinkColor = document.querySelector( '.sd-link-color' );
253				const sdTextColorStyles = ( sdTextColor && getComputedStyle( sdTextColor ) ) || {};
254				const sdLinkColorStyles = ( sdLinkColor && getComputedStyle( sdLinkColor ) ) || {};
255
256				// enable reblogs if they are enabled for the page
257				if ( document.body.classList.contains( 'jetpack-reblog-enabled' ) ) {
258					JetpackLikesPostMessage( { event: 'reblogsEnabled' }, window.frames[ 'likes-master' ] );
259				}
260
261				stylesData.textStyles = {
262					color: sdTextColorStyles[ 'color' ],
263					fontFamily: sdTextColorStyles[ 'font-family' ],
264					fontSize: sdTextColorStyles[ 'font-size' ],
265					direction: sdTextColorStyles[ 'direction' ],
266					fontWeight: sdTextColorStyles[ 'font-weight' ],
267					fontStyle: sdTextColorStyles[ 'font-style' ],
268					textDecoration: sdTextColorStyles[ 'text-decoration' ],
269				};
270
271				stylesData.linkStyles = {
272					color: sdLinkColorStyles[ 'color' ],
273					fontFamily: sdLinkColorStyles[ 'font-family' ],
274					fontSize: sdLinkColorStyles[ 'font-size' ],
275					textDecoration: sdLinkColorStyles[ 'text-decoration' ],
276					fontWeight: sdLinkColorStyles[ 'font-weight' ],
277					fontStyle: sdLinkColorStyles[ 'font-style' ],
278				};
279
280				JetpackLikesPostMessage( stylesData, window.frames[ 'likes-master' ] );
281
282				JetpackLikesBatchHandler();
283			} );
284
285			break;
286
287		// We're keeping this for planned future follow ups.
288		// @see: https://github.com/Automattic/jetpack/pull/42361#discussion_r1995338815
289		case 'showLikeWidget':
290			break;
291
292		// We're keeping this for planned future follow ups.
293		// @see: https://github.com/Automattic/jetpack/pull/42361#discussion_r1995338815
294		case 'showCommentLikeWidget':
295			break;
296
297		case 'killCommentLikes':
298			// If kill switch for comment likes is enabled remove all widgets wrappers and `Loading...` placeholders.
299			document
300				.querySelectorAll( '.jetpack-comment-likes-widget-wrapper' )
301				.forEach( wrapper => wrapper.remove() );
302			break;
303
304		case 'clickReblogFlair':
305			if ( wpcom_reblog && typeof wpcom_reblog.toggle_reblog_box_flair === 'function' ) {
306				wpcom_reblog.toggle_reblog_box_flair( data.obj_id, data.post_id );
307			}
308			break;
309
310		case 'hideOtherGravatars': {
311			hideLikersPopover();
312			break;
313		}
314
315		case 'showOtherGravatars': {
316			const container = document.querySelector( '#likes-other-gravatars' );
317
318			if ( ! container ) {
319				break;
320			}
321
322			const list = container.querySelector( 'ul' );
323
324			container.style.display = 'none';
325			list.innerHTML = '';
326
327			container
328				.querySelectorAll( '.likes-text span' )
329				.forEach( item => ( item.textContent = data.totalLikesLabel ) );
330
331			( data.likers || [] ).forEach( async ( liker, index ) => {
332				if ( liker.profile_URL.substr( 0, 4 ) !== 'http' ) {
333					// We only display gravatars with http or https schema
334					return;
335				}
336
337				const element = document.createElement( 'li' );
338				list.append( element );
339
340				element.innerHTML = `
341				<a href="${ encodeURI( liker.profile_URL ) }" rel="nofollow" target="_parent" class="wpl-liker">
342					<img src="${ encodeURI( liker.avatar_URL ) }"
343						alt=""
344						style="width: 28px; height: 28px;" />
345					<span></span>
346				</a>
347				`;
348
349
350				// Add some extra attributes through native methods, to ensure strings are sanitized.
351				element.classList.add( liker.css_class );
352				element.querySelector( 'img' ).alt = data.avatarAltTitle.replace( '%s', liker.name );
353				element.querySelector( 'span' ).innerText = liker.name;
354
355				if ( index === data.likers.length - 1 ) {
356					element.addEventListener( 'keydown', ( e ) => {
357						if ( e.key === 'Tab' && ! e.shiftKey ) {
358							e.preventDefault();
359							hideLikersPopover();
360
361							JetpackLikesPostMessage(
362								{ event: 'focusLikesCount', parent: data.parent },
363								window.frames[ 'likes-master' ]
364							);
365						}
366					} );
367				}
368			} );
369
370			const positionPopup = function() {
371				const containerStyle = getComputedStyle(container);
372				const isRtl = containerStyle.direction === 'rtl';
373
374				const el = document.querySelector( `*[name='${ data.parent }']` );
375				const rect = el.getBoundingClientRect();
376				const win = el.ownerDocument.defaultView;
377
378				const offset = {
379					top: rect.top + win.pageYOffset,
380					left: rect.left + win.pageXOffset,
381				};
382
383				// don't display yet or we get skewed window.innerWidth later
384				container.style.display = 'none';
385
386				let containerLeft = 0;
387				container.style.top = offset.top + data.position.top - 1 + 'px';
388
389				if ( isRtl ) {
390					const visibleAvatarsCount = data && data.likers ? Math.min( data.likers.length, 5 ) : 0;
391					// 24px is the width of the avatar + 4px is the padding between avatars
392					containerLeft = offset.left + data.position.left + 24 * visibleAvatarsCount + 4;
393					container.style.transform = 'translateX(-100%)';
394				} else {
395					containerLeft = offset.left + data.position.left;
396				}
397				container.style.left = containerLeft + 'px';
398
399				// Container width - padding
400				const initContainerWidth = data.width - 20;
401				const rowLength = Math.floor( initContainerWidth / 37 );
402				// # of rows + (avatar + avatar padding) + text above + container padding
403				let height = Math.ceil( data.likers.length / rowLength ) * 37 + 17 + 22;
404				if ( height > 204 ) {
405					height = 204;
406				}
407
408				// If the popup is overflows viewport width, we should show it on the next line
409				// Push it offscreen to calculated rendered width
410				const windowWidth = win.innerWidth;
411				container.style.left = '-9999px';
412				container.style.display = 'block';
413
414				// If the popup exceeds the viewport width,
415				// flip the position of the popup.
416				const containerWidth = container.offsetWidth;
417				const containerRight = containerLeft + containerWidth;
418
419				if ( containerRight > windowWidth && ! isRtl) {
420					containerLeft = rect.left + rect.width - containerWidth;
421				} else if ( containerLeft - containerWidth < 0 && isRtl ) {
422					container.style.transform = 'none';
423					containerLeft = rect.left;
424				}
425				// Set the container left
426				container.style.left = containerLeft + 'px';
427
428				container.setAttribute( 'aria-hidden', 'false' );
429			}
430
431			positionPopup();
432			container.focus();
433
434			const debounce = function( func, wait ) {
435				var timeout;
436				return function() {
437					var context = this;
438					var args = arguments;
439					clearTimeout( timeout );
440					timeout = setTimeout( function() {
441						func.apply( context, args );
442					}, wait );
443				};
444			};
445
446			const debouncedPositionPopup = debounce( positionPopup, 100 );
447
448			// Keep a reference of this function in the element itself
449			// so that we can destroy it later
450			container.__resizeHandler = debouncedPositionPopup;
451
452			// When window is resized, resize the popup.
453			window.addEventListener( "resize", debouncedPositionPopup );
454		}
455	}
456}
457
458window.addEventListener( 'message', JetpackLikesMessageListener );
459
460function hideLikersPopover() {
461	const container = document.querySelector( '#likes-other-gravatars' );
462
463	if ( container ) {
464		container.style.display = 'none';
465		container.setAttribute( 'aria-hidden', 'true' );
466
467		// Remove the resize event listener and cleanup.
468		const resizeHandler = container.__resizeHandler;
469		if ( resizeHandler ) {
470			window.removeEventListener( "resize", resizeHandler );
471			delete container.__resizeHandler;
472		}
473	}
474}
475
476document.addEventListener( 'click', hideLikersPopover );
477
478function JetpackLikesWidgetQueueHandler() {
479	var wrapperID;
480
481	if ( ! jetpackLikesMasterReady ) {
482		setTimeout( JetpackLikesWidgetQueueHandler, 500 );
483		return;
484	}
485
486	// Restore widgets to initial unloaded state when they are scrolled out of view.
487	jetpackUnloadScrolledOutWidgets();
488
489	var unloadedWidgetsInView = jetpackGetUnloadedWidgetsInView();
490
491	if ( unloadedWidgetsInView.length > 0 ) {
492		// Grab any unloaded widgets for a batch request
493		JetpackLikesBatchHandler();
494	}
495
496	for ( var i = 0, length = unloadedWidgetsInView.length; i <= length - 1; i++ ) {
497		wrapperID = unloadedWidgetsInView[ i ].id;
498
499		if ( ! wrapperID ) {
500			continue;
501		}
502
503		jetpackLoadLikeWidgetIframe( wrapperID );
504	}
505}
506
507function jetpackLoadLikeWidgetIframe( wrapperID ) {
508	if ( typeof wrapperID === 'undefined' ) {
509		return;
510	}
511
512	const wrapper = document.querySelector( '#' + wrapperID );
513	wrapper.querySelectorAll( 'iframe' ).forEach( iFrame => iFrame.remove() );
514
515	const placeholder = wrapper.querySelector( '.likes-widget-placeholder' );
516
517	// Post like iframe
518	if ( placeholder && placeholder.classList.contains( 'post-likes-widget-placeholder' ) ) {
519		const postLikesFrame = document.createElement( 'iframe' );
520
521		postLikesFrame.classList.add( 'post-likes-widget', 'jetpack-likes-widget' );
522		postLikesFrame.name = wrapper.dataset.name;
523		postLikesFrame.src = wrapper.dataset.src;
524		postLikesFrame.height = '55px';
525		postLikesFrame.width = '100%';
526		postLikesFrame.frameBorder = '0';
527		postLikesFrame.scrolling = 'no';
528		postLikesFrame.title = wrapper.dataset.title;
529
530		placeholder.after( postLikesFrame );
531	}
532
533	// Comment like iframe
534	if ( placeholder.classList.contains( 'comment-likes-widget-placeholder' ) ) {
535		const commentLikesFrame = document.createElement( 'iframe' );
536
537		commentLikesFrame.class = 'comment-likes-widget-frame jetpack-likes-widget-frame';
538		commentLikesFrame.name = wrapper.dataset.name;
539		commentLikesFrame.src = wrapper.dataset.src;
540		commentLikesFrame.height = '18px';
541		commentLikesFrame.width = '100%';
542		commentLikesFrame.frameBorder = '0';
543		commentLikesFrame.scrolling = 'no';
544
545		wrapper.querySelector( '.comment-like-feedback' ).after( commentLikesFrame );
546
547		jetpackCommentLikesLoadedWidgets.push( commentLikesFrame );
548	}
549
550	wrapper.classList.remove( 'jetpack-likes-widget-unloaded' );
551	wrapper.classList.add( 'jetpack-likes-widget-loading' );
552
553	wrapper.querySelector( 'iframe' ).addEventListener( 'load', e => {
554		JetpackLikesPostMessage(
555			{ event: 'loadLikeWidget', name: e.target.name, width: e.target.width },
556			window.frames[ 'likes-master' ]
557		);
558
559		wrapper.classList.remove( 'jetpack-likes-widget-loading' );
560		wrapper.classList.add( 'jetpack-likes-widget-loaded' );
561	} );
562}
563
564function jetpackGetUnloadedWidgetsInView() {
565	const unloadedWidgets = document.querySelectorAll( 'div.jetpack-likes-widget-unloaded' );
566
567	return [ ...unloadedWidgets ].filter( item => jetpackIsScrolledIntoView( item ) );
568}
569
570function jetpackIsScrolledIntoView( element ) {
571	const top = element.getBoundingClientRect().top;
572	const bottom = element.getBoundingClientRect().bottom;
573
574	// Allow some slack above and bellow the fold with jetpackLikesLookAhead,
575	// with the aim of hiding the transition from unloaded to loaded widget from users.
576	return top + jetpackLikesLookAhead >= 0 && bottom <= window.innerHeight + jetpackLikesLookAhead;
577}
578
579function jetpackUnloadScrolledOutWidgets() {
580	for ( let i = jetpackCommentLikesLoadedWidgets.length - 1; i >= 0; i-- ) {
581		const currentWidgetIframe = jetpackCommentLikesLoadedWidgets[ i ];
582
583		if ( ! jetpackIsScrolledIntoView( currentWidgetIframe ) ) {
584			const widgetWrapper =
585				currentWidgetIframe &&
586				currentWidgetIframe.parentElement &&
587				currentWidgetIframe.parentElement.parentElement;
588
589			// Restore parent class to 'unloaded' so this widget can be picked up by queue manager again if needed.
590			widgetWrapper.classList.remove( 'jetpack-likes-widget-loaded' );
591			widgetWrapper.classList.remove( 'jetpack-likes-widget-loading' );
592			widgetWrapper.classList.add( 'jetpack-likes-widget-unloaded' );
593
594			// Bring back the loading placeholder into view.
595			widgetWrapper
596				.querySelectorAll( '.comment-likes-widget-placeholder' )
597				.forEach( item => ( item.style.display = 'block' ) );
598
599			// Remove it from the list of loaded widgets.
600			jetpackCommentLikesLoadedWidgets.splice( i, 1 );
601
602			// Remove comment like widget iFrame.
603			currentWidgetIframe.remove();
604		}
605	}
606}
607
608var jetpackWidgetsDelayedExec = function ( after, fn ) {
609	var timer;
610	return function () {
611		clearTimeout( timer );
612		timer = setTimeout( fn, after );
613	};
614};
615
616var jetpackOnScrollStopped = jetpackWidgetsDelayedExec( 250, JetpackLikesWidgetQueueHandler );
617
618// Load initial batch of widgets, prior to any scrolling events.
619JetpackLikesWidgetQueueHandler();
620
621// Add event listener to execute queue handler after scroll.
622window.addEventListener( 'scroll', jetpackOnScrollStopped, true );
623;
624/**
625 * Comment Likes - JavaScript
626 *
627 * This handles liking and unliking comments, as well as viewing who has
628 * liked a particular comment.
629 *
630 * @dependency  Swipe (dynamically loaded when needed)
631 *
632 * @package     Comment_Likes
633 * @subpackage  JavaScript
634 */
635(function () {
636	function init() {
637		let extWin;
638		let extWinCheck;
639		let commentLikeEvent;
640
641		// Only run once.
642		if (window.comment_likes_loaded) {
643			return;
644		}
645		window.comment_likes_loaded = true;
646
647		// Client-side cache of who liked a particular comment to avoid
648		// having to hit the server multiple times for the same data.
649		const commentLikeCache = {};
650
651		let swipeLibPromise;
652
653		// Load the Swipe library, if it's not already loaded.
654		function swipeLibLoader() {
655			if (!swipeLibPromise) {
656				swipeLibPromise = new Promise((resolve, reject) => {
657					if (window.Swipe) {
658						resolve(window.Swipe);
659					} else {
660						const swipeScript = document.createElement('script');
661						swipeScript.src = comment_like_text.swipeUrl;
662						swipeScript.async = true;
663						document.body.appendChild(swipeScript);
664						swipeScript.addEventListener('load', () => resolve(window.Swipe));
665						swipeScript.addEventListener('error', error => reject(error));
666					}
667				});
668			}
669			return swipeLibPromise;
670		}
671
672		/**
673		 * Parse the comment ID from a comment like link.
674		 */
675		function getCommentId(link) {
676			const commentId =
677				link && link.getAttribute('href') && link.getAttribute('href').split('like_comment=');
678			return commentId[1].split('&_wpnonce=')[0];
679		}
680
681		/**
682		 * Handle an ajax action on the comment like link.
683		 */
684		function handleLinkAction(link, action, commentId, callback) {
685			const nonce =
686				link && link.getAttribute('href') && link.getAttribute('href').split('_wpnonce=')[1];
687
688			fetch('/wp-admin/admin-ajax.php', {
689				method: 'POST',
690				body: new URLSearchParams({
691					action: action,
692					_wpnonce: nonce,
693					like_comment: commentId,
694					blog_id: Number(link.dataset.blog),
695				}),
696				headers: {
697					'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
698					'X-Requested-With': 'XMLHttpRequest',
699					Accept: 'application/json',
700					'cache-control': 'no-cache',
701					pragma: 'no-cache',
702				},
703			})
704				.then(response => response.json())
705				.then(callback);
706		}
707
708		function startPolling() {
709			// Append cookie polling login iframe to this window to wait for user to finish logging in (or cancel)
710			const loginIframe = document.createElement('iframe');
711			loginIframe.id = 'wp-login-polling-iframe';
712			loginIframe.src = 'https://wordpress.com/public.api/connect/?iframe=true';
713			document.body.appendChild(loginIframe);
714			loginIframe.style.display = 'none';
715		}
716
717		function stopPolling() {
718			const iframe = document.querySelector('#wp-login-polling-iframe');
719			if (iframe) {
720				iframe.remove();
721			}
722		}
723
724		function hide(el) {
725			if (el && el.style) {
726				el.style.display = 'none';
727			}
728		}
729
730		function show(el) {
731			if (el && el.style) {
732				el.style.removeProperty('display');
733			}
734		}
735
736		// Overlay used for displaying comment like info.
737		class Overlay {
738			constructor() {
739				// Overlay element.
740				this.el = document.createElement('div');
741				this.el.classList.add('comment-likes-overlay');
742				document.body.appendChild(this.el);
743				hide(this.el);
744
745				this.el.addEventListener('mouseenter', () => {
746					// Don't hide the overlay if the user is mousing over it.
747					overlay.cancelHide();
748				});
749
750				this.el.addEventListener('mouseleave', () => overlay.requestHide());
751
752				// Inner contents of overlay.
753				this.innerEl = null;
754
755				// Instance of the Swipe library.
756				this.swipe = null;
757
758				// Timeout used for hiding the overlay.
759				this.hideTimeout = null;
760			}
761
762			// Initialise the overlay for use, removing any old content.
763			clear() {
764				// Unload any previous instance of Swipe (to avoid leaking a global
765				// event handler). This is done before clearing the contents of the
766				// overlay because Swipe expects the slides to still be present.
767				if (this.swipe) {
768					this.swipe.kill();
769					this.swipe = null;
770				}
771				this.el.innerHTML = '';
772				this.innerEl = document.createElement('div');
773				this.innerEl.classList.add('inner');
774				this.el.appendChild(this.innerEl);
775			}
776
777			/**
778			 * Construct a list (<ul>) of user (gravatar, name) details.
779			 *
780			 * @param  data     liker data returned from the server
781			 * @param  klass    CSS class to apply to the <ul> element
782			 * @param  start    index of user to start at
783			 * @param  length   number of users to include in the list
784			 *
785			 * @return          A container element with the list
786			 */
787			getUserBits(data, klass, start, length) {
788				start = start || 0;
789				let last = start + (length || data.length);
790				last = last > data.length ? data.length : last;
791				const container = document.createElement('div');
792				container.classList.add('liker-list');
793				let html = `<ul class="${klass || ''}">`;
794				for (let i = start; i < last; ++i) {
795					const user = data[i];
796					html += `
797						<li>
798							<a rel="nofollow" title="${user.display_name_esc}" href="${user.profile_url_esc}">
799								<img src="${user.avatar_url_esc}" alt="${user.display_name_esc}" />
800								<span class="user-name">${user.display_name_esc}</span>
801							</a>
802						</li>
803					`;
804				}
805				html += '</ul>';
806				container.innerHTML = html;
807				return container;
808			}
809
810			/**
811			 * Render the display of who has liked this comment. The type of
812			 * display depends on how many people have liked the comment.
813			 * If more than 10 people have liked the comment, this function
814			 * renders navigation controls and sets up the Swipe library for
815			 * changing between pages.
816			 *
817			 * @param link  the element over which the user is hovering
818			 * @param data  the results retrieved from the server
819			 */
820			showLikes(link, data) {
821				this.clear();
822
823				link.dataset.likeCount = data.length;
824				if (data.length === 0) {
825					// No likers after all.
826					hide(this.el);
827					return;
828				}
829
830				this.innerEl.style.padding = '12px';
831
832				if (data.length < 6) {
833					// Only one column needed.
834					this.innerEl.style.maxWidth = '200px';
835					this.innerEl.innerHTML = '';
836					this.innerEl.appendChild(this.getUserBits(data, 'single'));
837					this.setPosition(link);
838				} else if (data.length < 11) {
839					// Two columns, but only one page.
840					this.innerEl.innerHTML = '';
841					this.innerEl.appendChild(this.getUserBits(data, 'double'));
842					this.setPosition(link);
843				} else {
844					// Multiple pages.
845					this.renderLikesWithPagination(data, link);
846				}
847			}
848
849			/**
850			 * Render multiple pages of likes with pagination controls.
851			 * This function is intended to be called by `showLikes` above.
852			 *
853			 * @param data  the results retrieved from the server
854			 */
855			renderLikesWithPagination(data, link) {
856				swipeLibLoader().then(() => {
857					const page_count = Math.ceil(data.length / 10);
858					// Swipe requires two nested containers.
859					const swipe = document.createElement('div');
860					swipe.classList.add('swipe');
861					this.innerEl.appendChild(swipe);
862
863					const wrap = document.createElement('div');
864					wrap.classList.add('swipe-wrap');
865					swipe.appendChild(wrap);
866
867					for (let i = 0; i < page_count; ++i) {
868						wrap.appendChild(this.getUserBits(data, 'double', i * 10, 10));
869					}
870
871					/**
872					 * Navigation controls.
873					 * This is based on the Newdash controls found in
874					 *    reader/recommendations-templates.php
875					 */
876					const nav = document.createElement('nav');
877					nav.classList.add('slider-nav');
878
879					let navContents = `
880						<a href="#" class="prev">
881							<span class="noticon noticon-previous" title="Previous" alt="<"></span>
882						</a>
883						<span class="position">
884					`;
885					for (let i = 0; i < page_count; ++i) {
886						navContents += `<em data-page="${i}" class="${i === 0 ? 'on' : ''}">&bull;</em>`;
887					}
888					navContents += `
889						</span>
890						<a href="#" class="next">
891							<span class="noticon noticon-next" title="Next" alt=">"></span>
892						</a>
893					`;
894					this.innerEl.appendChild(nav);
895					nav.innerHTML = navContents;
896
897					/** Set up Swipe. **/
898					// Swipe cannot be set up successfully unless its container
899					// is visible, so we show it now.
900					show(this.el);
901					this.setPosition(link);
902
903					this.swipe = new Swipe(swipe, {
904						callback: function (pos) {
905							// Update the pagination indicators.
906							//
907							// If there are exactly two pages, Swipe has a weird
908							// special case where it duplicates both pages and
909							// can return index 2 and 3 even though those aren't
910							// real pages (see swipe.js, line 47). To deal with
911							// this, we use the expression `pos % page_count`.
912							pos = pos % page_count;
913							nav.querySelectorAll('em').forEach(em => {
914								const page = Number(em.dataset.page);
915								em.setAttribute('class', pos === page ? 'on' : '');
916							});
917						},
918					});
919
920					nav.querySelectorAll('em').forEach(em => {
921						em.addEventListener('click', e => {
922							// Go to the page corresponding to the indicator clicked.
923							this.swipe.slide(Number(em.dataset.page));
924							e.preventDefault();
925						});
926					});
927					// Previous and next buttons.
928					nav.querySelector('.prev').addEventListener('click', e => {
929						this.swipe.prev();
930						e.preventDefault();
931					});
932					nav.querySelector('.next').addEventListener('click', e => {
933						this.swipe.next();
934						e.preventDefault();
935					});
936				});
937			}
938
939			/**
940			 * Open the overlay and show a loading message.
941			 */
942			showLoadingMessage(link) {
943				this.clear();
944				this.innerEl.textContent = comment_like_text.loading;
945				this.setPosition(link);
946			}
947
948			/**
949			 * Position the overlay near the current comment.
950			 *
951			 * @param link  element near which to position the overlay
952			 */
953			setPosition(link) {
954				// Prepare a down arrow icon for the bottom of the overlay.
955				const icon = document.createElement('span');
956				this.el.appendChild(icon);
957				icon.classList.add('icon', 'noticon', 'noticon-downarrow');
958				icon.style.textShadow = '0px 1px 1px rgb(223, 223, 223)';
959
960				const rect = link.getBoundingClientRect();
961				const win = document.defaultView;
962				const offset = {
963					top: rect.top + win.scrollY,
964					left: rect.left + win.scrollX,
965				};
966
967				// Take measurements with the element fully visible.
968				show(this.el);
969				let left = offset.left - (this.el.offsetWidth - link.offsetWidth) / 2;
970				left = left < 5 ? 5 : left;
971				let top = offset.top - this.el.offsetHeight + 5;
972				hide(this.el);
973
974				const adminBar = document.querySelector('#wpadminbar');
975
976				// Check if the overlay would appear off the screen.
977				if (top < win.scrollY + ((adminBar && adminBar.offsetHeight) || 0)) {
978					// We'll display the overlay beneath the link instead.
979					top = offset.top + link.offsetHeight;
980					// Instead of using the down arrow icon, use an up arrow.
981					icon.remove();
982					this.el.prepend(icon);
983					icon.classList.remove('noticon-downarrow');
984					icon.classList.add('noticon-uparrow');
985					icon.style.textShadow = '0px -1px 1px rgb(223, 223, 223)';
986					icon.style.verticalAlign = 'bottom';
987				}
988
989				this.el.style.left = `${left}px`;
990				this.el.style.top = `${top}px`;
991				show(this.el);
992
993				// The height of the arrow icon differs slightly between browsers,
994				// so we compute the margin here to make sure it isn't disjointed
995				// from the overlay.
996				icon.style.marginTop = `${icon.scrollHeight - 26}px`;
997				icon.style.marginBottom = `${20 - icon.scrollHeight}px`;
998
999				// Position the arrow to be horizontally centred on the link.
1000				icon.style.paddingLeft = `${
1001					offset.left - left + (link.offsetWidth - icon.scrollWidth) / 2
1002				}px`;
1003			}
1004
1005			/**
1006			 * Return whether the overlay is visible.
1007			 */
1008			isVisible() {
1009				return this.el.style.getPropertyValue('display') !== 'none';
1010			}
1011
1012			/**
1013			 * Request that the overlay be hidden after a short delay.
1014			 */
1015			requestHide() {
1016				if (this.hideTimeout !== null) {
1017					return;
1018				}
1019				this.hideTimeout = setTimeout(() => {
1020					hide(this.el);
1021					this.clear();
1022				}, 300);
1023			}
1024
1025			/**
1026			 * Cancel a request to hide the overlay.
1027			 */
1028			cancelHide() {
1029				if (this.hideTimeout !== null) {
1030					clearTimeout(this.hideTimeout);
1031					this.hideTimeout = null;
1032				}
1033			}
1034		}
1035
1036		// Overlay used for displaying comment like info.
1037		const overlay = new Overlay();
1038
1039		// The most recent comment for which the user has requested to see
1040		// who liked it.
1041		var relevantComment;
1042
1043		// Precache after this timeout.
1044		var precacheTimeout = null;
1045
1046		/**
1047		 * Fetch the like data for a particular comment.
1048		 */
1049		function fetchLikeData(link, commentId) {
1050			commentLikeCache[commentId] = null;
1051
1052			const container = link && link.parentElement && link.parentElement.parentElement;
1053			const star = container.querySelector('a.comment-like-link');
1054			star &&
1055				handleLinkAction(star, 'view_comment_likes', commentId, data => {
1056					// Populate the cache.
1057					commentLikeCache[commentId] = data;
1058
1059					// Only show the overlay if the user is interested.
1060					if (overlay.isVisible() && relevantComment === commentId) {
1061						overlay.showLikes(link, data);
1062					}
1063				});
1064		}
1065
1066		function readCookie(c) {
1067			const nameEQ = c + '=';
1068			const cookieStrings = document.cookie.split(';');
1069
1070			for (let i = 0; i < cookieStrings.length; i++) {
1071				let cookieString = cookieStrings[i];
1072				while (cookieString.charAt(0) === ' ') {
1073					cookieString = cookieString.substring(1, cookieString.length);
1074				}
1075				if (cookieString.indexOf(nameEQ) === 0) {
1076					const chunk = cookieString.substring(nameEQ.length, cookieString.length);
1077					const pairs = chunk.split('&');
1078					const cookieData = {};
1079					for (let num = pairs.length - 1; num >= 0; num--) {
1080						const pair = pairs[num].split('=');
1081						cookieData[pair[0]] = decodeURIComponent(pair[1]);
1082					}
1083					return cookieData;
1084				}
1085			}
1086			return null;
1087		}
1088
1089		function getServiceData() {
1090			const data = readCookie('wpc_wpc');
1091			if (data === null || typeof data.access_token === 'undefined' || !data.access_token) {
1092				return false;
1093			}
1094			return data;
1095		}
1096
1097		function readMessage(msg) {
1098			const event = msg.data;
1099
1100			if (typeof event.event === 'undefined') {
1101				return;
1102			}
1103
1104			if (event.event === 'login' && event.success) {
1105				extWinCheck = setInterval(function () {
1106					if (!extWin || extWin.closed) {
1107						clearInterval(extWinCheck);
1108						if (getServiceData()) {
1109							// Load page in an iframe to get the current comment nonce
1110							const nonceIframe = document.createElement('iframe');
1111							nonceIframe.id = 'wp-login-comment-nonce-iframe';
1112							nonceIframe.style.display = 'none';
1113							nonceIframe.src = commentLikeEvent + '';
1114							document.body.appendChild(nonceIframe);
1115
1116							const commentLikeId = (commentLikeEvent + '')
1117								.split('like_comment=')[1]
1118								.split('&_wpnonce=')[0];
1119							let c;
1120
1121							// Set a 5 second timeout to redirect to the comment page without doing the Like as a fallback
1122							const commentLikeTimeout = setTimeout(() => {
1123								window.location = commentLikeEvent;
1124							}, 5000);
1125
1126							// Check for a new nonced redirect and use that if available before timing out
1127							const commentLikeCheck = setInterval(() => {
1128								const iframe = document.querySelector('#wp-login-comment-nonce-iframe');
1129								if (iframe) {
1130									c = iframe.querySelector(`#comment-like-${commentLikeId} .comment-like-link`);
1131								}
1132								if (c && typeof c.href !== 'undefined') {
1133									clearTimeout(commentLikeTimeout);
1134									clearInterval(commentLikeCheck);
1135									window.location = c.href;
1136								}
1137							}, 100);
1138						}
1139					}
1140				}, 100);
1141
1142				if (extWin) {
1143					if (!extWin.closed) {
1144						extWin.close();
1145					}
1146					extWin = false;
1147				}
1148
1149				stopPolling();
1150			}
1151		}
1152
1153		if (typeof window.postMessage !== 'undefined') {
1154			window.addEventListener('message', e => {
1155				let message = e && e.data;
1156				if (typeof message === 'string') {
1157					try {
1158						message = JSON.parse(message);
1159					} catch (err) {
1160						return;
1161					}
1162				}
1163
1164				const type = message && message.type;
1165				if (type === 'loginMessage') {
1166					readMessage(message);
1167				}
1168			});
1169		}
1170
1171		document.body.addEventListener('click', e => {
1172			let target = e.target;
1173
1174			// Don't do anything when clicking on the "X people" link.
1175			if (target.matches('p.comment-likes a.view-likers')) {
1176				e.preventDefault();
1177				return;
1178			}
1179
1180			// Retrieve the surrounding paragraph to the star, if it hasn't been liked.
1181			const notLikedPar = target.closest('p.comment-not-liked');
1182
1183			// Return if not clicking on star or surrounding paragraph.
1184			if (!target.matches('a.comment-like-link') && !notLikedPar) {
1185				return;
1186			}
1187
1188			// When a comment hasn't been liked, make the text clickable, too.
1189			if (notLikedPar) {
1190				target = notLikedPar.querySelector('a.comment-like-link');
1191				if (!target) {
1192					return;
1193				}
1194			}
1195
1196			if (target.classList.contains('needs-login')) {
1197				e.preventDefault();
1198				commentLikeEvent = target;
1199				if (extWin) {
1200					if (!extWin.closed) {
1201						extWin.close();
1202					}
1203					extWin = false;
1204				}
1205
1206				stopPolling();
1207
1208				const url = 'https://wordpress.com/public.api/connect/?action=request&service=wordpress';
1209				extWin = window.open(
1210					url,
1211					'likeconn',
1212					'status=0,toolbar=0,location=1,menubar=0,directories=0,resizable=1,scrollbars=1,height=560,width=500'
1213				);
1214
1215				startPolling();
1216
1217				return false;
1218			}
1219
1220			// Record that the user likes or does not like this comment.
1221			const commentId = getCommentId(target);
1222			target.classList.add('loading');
1223
1224			let commentEl = document.querySelector(`p#comment-like-${commentId}`);
1225			// Determine whether to like or unlike based on whether the comment is
1226			// currently liked.
1227			const action =
1228				commentEl && commentEl.dataset.liked === 'comment-liked'
1229					? 'unlike_comment'
1230					: 'like_comment';
1231			handleLinkAction(target, action, commentId, data => {
1232				// Invalidate the like cache for this comment.
1233				delete commentLikeCache[commentId];
1234
1235				const countEl = document.querySelector(`#comment-like-count-${data.context}`);
1236				if (countEl) {
1237					countEl.innerHTML = data.display;
1238				}
1239
1240				commentEl = document.querySelector(`p#comment-like-${data.context}`);
1241				if (action === 'like_comment') {
1242					commentEl.classList.remove('comment-not-liked');
1243					commentEl.classList.add('comment-liked');
1244					commentEl.dataset.liked = 'comment-liked';
1245				} else {
1246					commentEl.classList.remove('comment-liked');
1247					commentEl.classList.add('comment-not-liked');
1248					commentEl.dataset.liked = 'comment-not-liked';
1249				}
1250
1251				// Prefetch new data for this comment (if there are likers left).
1252				const parent = target.closest('.comment-likes');
1253				const link = parent && parent.querySelector('a.view-likers');
1254				if (link) {
1255					fetchLikeData(link, commentId);
1256				}
1257
1258				target.classList.remove('loading');
1259			});
1260			e.preventDefault();
1261			e.stopPropagation();
1262		});
1263
1264		document.body.addEventListener(
1265			'mouseenter',
1266			function (e) {
1267				if (!e.target.matches('p.comment-likes a.view-likers')) {
1268					return;
1269				}
1270				// Show the user a list of who has liked this comment.
1271
1272				const link = e.target;
1273				if (Number(link.dataset.likeCount || 0) === 0) {
1274					// No one has liked this comment.
1275					return;
1276				}
1277
1278				// Don't hide the overlay.
1279				overlay.cancelHide();
1280
1281				// Get the comment ID.
1282				const container = link.parentElement && link.parentElement.parentElement;
1283				const star = container && container.querySelector('a.comment-like-link');
1284				const commentId = star && getCommentId(star);
1285				relevantComment = commentId;
1286
1287				// Check if the list of likes for this comment is already in
1288				// the cache.
1289				if (commentId in commentLikeCache) {
1290					const entry = commentLikeCache[commentId];
1291					// Only display the likes if the ajax request is
1292					// actually done.
1293					if (entry !== null) {
1294						overlay.showLikes(link, entry);
1295					} else {
1296						// Make sure the overlay is visible (in case
1297						// the user moved the mouse away while loading
1298						// but then came back before it finished
1299						// loading).
1300						overlay.showLoadingMessage(link);
1301					}
1302					return;
1303				}
1304
1305				// Position the "Loading..." overlay.
1306				overlay.showLoadingMessage(link);
1307
1308				// Fetch the data.
1309				fetchLikeData(link, commentId);
1310			},
1311			true
1312		);
1313
1314		document.body.addEventListener(
1315			'mouseleave',
1316			e => {
1317				if (!e.target.matches('p.comment-likes a.view-likers')) {
1318					return;
1319				}
1320				// User has moved cursor away - hide the overlay.
1321				overlay.requestHide();
1322			},
1323			true
1324		);
1325
1326		document.body.addEventListener(
1327			'mouseenter',
1328			e => {
1329				if (!e.target.matches('.comment') || !e.target.querySelector('a.comment-like-link')) {
1330					return;
1331				}
1332				// User is moving over a comment - precache the comment like data.
1333				if (precacheTimeout !== null) {
1334					clearTimeout(precacheTimeout);
1335					precacheTimeout = null;
1336				}
1337
1338				const star = e.target.querySelector('a.comment-like-link');
1339				const parent = star.closest('.comment-likes');
1340				const link = parent && parent.querySelector('a.view-likers');
1341				if (!link || Number(link.dataset.likeCount || 0) === 0) {
1342					// No likes.
1343					return;
1344				}
1345				const commentId = getCommentId(star);
1346				if (commentId in commentLikeCache) {
1347					// Already in cache.
1348					return;
1349				}
1350
1351				precacheTimeout = setTimeout(() => {
1352					precacheTimeout = null;
1353					if (commentId in commentLikeCache) {
1354						// Was cached in the interim.
1355						return;
1356					}
1357					fetchLikeData(link, commentId);
1358				}, 1000);
1359			},
1360			true
1361		);
1362	}
1363
1364	if (document.readyState !== 'loading') {
1365		init();
1366	} else {
1367		document.addEventListener('DOMContentLoaded', init);
1368	}
1369})();
1370;
1371/**
1372 * File skip-link-focus-fix.js.
1373 *
1374 * Helps with accessibility for keyboard only users.
1375 *
1376 * Learn more: https://git.io/vWdr2
1377 */
1378( function() {
1379	var isWebkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1,
1380	    isOpera  = navigator.userAgent.toLowerCase().indexOf( 'opera' )  > -1,
1381	    isIe     = navigator.userAgent.toLowerCase().indexOf( 'msie' )   > -1;
1382
1383	if ( ( isWebkit || isOpera || isIe ) && document.getElementById && window.addEventListener ) {
1384		window.addEventListener( 'hashchange', function() {
1385			var id = location.hash.substring( 1 ),
1386				element;
1387
1388			if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) {
1389				return;
1390			}
1391
1392			element = document.getElementById( id );
1393
1394			if ( element ) {
1395				if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) {
1396					element.tabIndex = -1;
1397				}
1398
1399				element.focus();
1400			}
1401		}, false );
1402	}
1403})();;
1404/*
1405 * jQuery FlexSlider v2.4.0
1406 * Copyright 2012 WooThemes
1407 * Contributing Author: Tyler Smith
1408 */
1409;
1410(function ($) {
1411
1412  //FlexSlider: Object Instance
1413  $.flexslider = function(el, options) {
1414    var slider = $(el);
1415
1416    // making variables public
1417    slider.vars = $.extend({}, $.flexslider.defaults, options);
1418
1419    var namespace = slider.vars.namespace,
1420        msGesture = window.navigator && window.navigator.msPointerEnabled && window.MSGesture,
1421        touch = (( "ontouchstart" in window ) || msGesture || window.DocumentTouch && document instanceof DocumentTouch) && slider.vars.touch,
1422        // depricating this idea, as devices are being released with both of these events
1423        //eventType = (touch) ? "touchend" : "click",
1424        eventType = "click touchend MSPointerUp keyup",
1425        watchedEvent = "",
1426        watchedEventClearTimer,
1427        vertical = slider.vars.direction === "vertical",
1428        reverse = slider.vars.reverse,
1429        carousel = (slider.vars.itemWidth > 0),
1430        fade = slider.vars.animation === "fade",
1431        asNav = slider.vars.asNavFor !== "",
1432        methods = {},
1433        focused = true;
1434
1435    // Store a reference to the slider object
1436    $.data(el, "flexslider", slider);
1437
1438    // Private slider methods
1439    methods = {
1440      init: function() {
1441        slider.animating = false;
1442        // Get current slide and make sure it is a number
1443        slider.currentSlide = parseInt( ( slider.vars.startAt ? slider.vars.startAt : 0), 10 );
1444        if ( isNaN( slider.currentSlide ) ) { slider.currentSlide = 0; }
1445        slider.animatingTo = slider.currentSlide;
1446        slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last);
1447        slider.containerSelector = slider.vars.selector.substr(0,slider.vars.selector.search(' '));
1448        slider.slides = $(slider.vars.selector, slider);
1449        slider.container = $(slider.containerSelector, slider);
1450        slider.count = slider.slides.length;
1451        // SYNC:
1452        slider.syncExists = $(slider.vars.sync).length > 0;
1453        // SLIDE:
1454        if (slider.vars.animation === "slide") { slider.vars.animation = "swing"; }
1455        slider.prop = (vertical) ? "top" : "marginLeft";
1456        slider.args = {};
1457        // SLIDESHOW:
1458        slider.manualPause = false;
1459        slider.stopped = false;
1460        //PAUSE WHEN INVISIBLE
1461        slider.started = false;
vendor: 44,878 bytes, lines 1462-2504
1462        slider.startTimeout = null;
1463        // TOUCH/USECSS:
1464        slider.transitions = !slider.vars.video && !fade && slider.vars.useCSS && (function() {
1465          var obj = document.createElement('div'),
1466              props = ['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
1467          for (var i in props) {
1468            if ( obj.style[ props[i] ] !== undefined ) {
1469              slider.pfx = props[i].replace('Perspective','').toLowerCase();
1470              slider.prop = "-" + slider.pfx + "-transform";
1471              return true;
1472            }
1473          }
1474          return false;
1475        }());
1476        slider.ensureAnimationEnd = '';
1477        // CONTROLSCONTAINER:
1478        if (slider.vars.controlsContainer !== "") slider.controlsContainer = $(slider.vars.controlsContainer).length > 0 && $(slider.vars.controlsContainer);
1479        // MANUAL:
1480        if (slider.vars.manualControls !== "") slider.manualControls = $(slider.vars.manualControls).length > 0 && $(slider.vars.manualControls);
1481
1482        // RANDOMIZE:
1483        if (slider.vars.randomize) {
1484          slider.slides.sort(function() { return (Math.round(Math.random())-0.5); });
1485          slider.container.empty().append(slider.slides);
1486        }
1487
1488        slider.doMath();
1489
1490        // INIT
1491        slider.setup("init");
1492
1493        // CONTROLNAV:
1494        if (slider.vars.controlNav) { methods.controlNav.setup(); }
1495
1496        // DIRECTIONNAV:
1497        if (slider.vars.directionNav) { methods.directionNav.setup(); }
1498
1499        // KEYBOARD:
1500        if (slider.vars.keyboard && ($(slider.containerSelector).length === 1 || slider.vars.multipleKeyboard)) {
1501          $(document).bind('keyup', function(event) {
1502            var keycode = event.keyCode;
1503            if (!slider.animating && (keycode === 39 || keycode === 37)) {
1504              var target = (keycode === 39) ? slider.getTarget('next') :
1505                           (keycode === 37) ? slider.getTarget('prev') : false;
1506              slider.flexAnimate(target, slider.vars.pauseOnAction);
1507            }
1508          });
1509        }
1510        // MOUSEWHEEL:
1511        if (slider.vars.mousewheel) {
1512          slider.bind('mousewheel', function(event, delta, deltaX, deltaY) {
1513            event.preventDefault();
1514            var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev');
1515            slider.flexAnimate(target, slider.vars.pauseOnAction);
1516          });
1517        }
1518
1519        // PAUSEPLAY
1520        if (slider.vars.pausePlay) { methods.pausePlay.setup(); }
1521
1522        //PAUSE WHEN INVISIBLE
1523        if (slider.vars.slideshow && slider.vars.pauseInvisible) { methods.pauseInvisible.init(); }
1524
1525        // SLIDSESHOW
1526        if (slider.vars.slideshow) {
1527          if (slider.vars.pauseOnHover) {
1528            slider.hover(function() {
1529              if (!slider.manualPlay && !slider.manualPause) { slider.pause(); }
1530            }, function() {
1531              if (!slider.manualPause && !slider.manualPlay && !slider.stopped) { slider.play(); }
1532            });
1533          }
1534          // initialize animation
1535          //If we're visible, or we don't use PageVisibility API
1536          if(!slider.vars.pauseInvisible || !methods.pauseInvisible.isHidden()) {
1537            (slider.vars.initDelay > 0) ? slider.startTimeout = setTimeout(slider.play, slider.vars.initDelay) : slider.play();
1538          }
1539        }
1540
1541        // ASNAV:
1542        if (asNav) { methods.asNav.setup(); }
1543
1544        // TOUCH
1545        if (touch && slider.vars.touch) { methods.touch(); }
1546
1547        // FADE&&SMOOTHHEIGHT || SLIDE:
1548        if (!fade || (fade && slider.vars.smoothHeight)) { $(window).bind("resize orientationchange focus", methods.resize); }
1549
1550        slider.find("img").attr("draggable", "false");
1551
1552        // API: start() Callback
1553        setTimeout(function(){
1554          slider.vars.start(slider);
1555        }, 200);
1556      },
1557      asNav: {
1558        setup: function() {
1559          slider.asNav = true;
1560          slider.animatingTo = Math.floor(slider.currentSlide/slider.move);
1561          slider.currentItem = slider.currentSlide;
1562          slider.slides.removeClass(namespace + "active-slide").eq(slider.currentItem).addClass(namespace + "active-slide");
1563          if(!msGesture){
1564              slider.slides.on(eventType, function(e){
1565                e.preventDefault();
1566                var $slide = $(this),
1567                    target = $slide.index();
1568                var posFromLeft = $slide.offset().left - $(slider).scrollLeft(); // Find position of slide relative to left of slider container
1569                if( posFromLeft <= 0 && $slide.hasClass( namespace + 'active-slide' ) ) {
1570                  slider.flexAnimate(slider.getTarget("prev"), true);
1571                } else if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass(namespace + "active-slide")) {
1572                  slider.direction = (slider.currentItem < target) ? "next" : "prev";
1573                  slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
1574                }
1575              });
1576          }else{
1577              el._slider = slider;
1578              slider.slides.each(function (){
1579                  var that = this;
1580                  that._gesture = new MSGesture();
1581                  that._gesture.target = that;
1582                  that.addEventListener("MSPointerDown", function (e){
1583                      e.preventDefault();
1584                      if(e.currentTarget._gesture) {
1585                        e.currentTarget._gesture.addPointer(e.pointerId);
1586                      }
1587                  }, false);
1588                  that.addEventListener("MSGestureTap", function (e){
1589                      e.preventDefault();
1590                      var $slide = $(this),
1591                          target = $slide.index();
1592                      if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass('active')) {
1593                          slider.direction = (slider.currentItem < target) ? "next" : "prev";
1594                          slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
1595                      }
1596                  });
1597              });
1598          }
1599        }
1600      },
1601      controlNav: {
1602        setup: function() {
1603          if (!slider.manualControls) {
1604            methods.controlNav.setupPaging();
1605          } else { // MANUALCONTROLS:
1606            methods.controlNav.setupManual();
1607          }
1608        },
1609        setupPaging: function() {
1610          var type = (slider.vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging',
1611              j = 1,
1612              item,
1613              slide;
1614
1615          slider.controlNavScaffold = $('<ol class="'+ namespace + 'control-nav ' + namespace + type + '"></ol>');
1616
1617          if (slider.pagingCount > 1) {
1618            for (var i = 0; i < slider.pagingCount; i++) {
1619              slide = slider.slides.eq(i);
1620
1621              if ( undefined === slide.attr( 'data-thumb-alt' ) ) { 
1622                slide.attr( 'data-thumb-alt', '' ); 
1623              }
1624              
1625              item = $( '<a></a>' ).attr( 'href', '#' ).text( j );
1626              if ( slider.vars.controlNav === "thumbnails" ) {
1627                item = $( '<img/>' ).attr( 'src', slide.attr( 'data-thumb' ) );
1628              }
1629              
1630              if ( '' !== slide.attr( 'data-thumb-alt' ) ) {
1631                item.attr( 'alt', slide.attr( 'data-thumb-alt' ) );
1632              }
1633
1634              if ( 'thumbnails' === slider.vars.controlNav && true === slider.vars.thumbCaptions ) {
1635                var captn = slide.attr( 'data-thumbcaption' );
1636                if ( '' !== captn && undefined !== captn ) { 
1637                  var caption = $('<span></span>' ).addClass( namespace + 'caption' ).text( captn );
1638                  item.append( caption );
1639                }
1640              }
1641              
1642              var liElement = $( '<li>' );
1643              item.appendTo( liElement );
1644              liElement.append( '</li>' );
1645
1646              slider.controlNavScaffold.append(liElement);
1647              j++;
1648            }
1649          }
1650
1651          // CONTROLSCONTAINER:
1652          (slider.controlsContainer) ? $(slider.controlsContainer).append(slider.controlNavScaffold) : slider.append(slider.controlNavScaffold);
1653          methods.controlNav.set();
1654
1655          methods.controlNav.active();
1656
1657          slider.controlNavScaffold.delegate('a, img', eventType, function(event) {
1658            event.preventDefault();
1659
1660            if (watchedEvent === "" || watchedEvent === event.type) {
1661              var $this = $(this),
1662                  target = slider.controlNav.index($this);
1663
1664              if (!$this.hasClass(namespace + 'active')) {
1665                slider.direction = (target > slider.currentSlide) ? "next" : "prev";
1666                slider.flexAnimate(target, slider.vars.pauseOnAction);
1667              }
1668            }
1669
1670            // setup flags to prevent event duplication
1671            if (watchedEvent === "") {
1672              watchedEvent = event.type;
1673            }
1674            methods.setToClearWatchedEvent();
1675
1676          });
1677        },
1678        setupManual: function() {
1679          slider.controlNav = slider.manualControls;
1680          methods.controlNav.active();
1681
1682          slider.controlNav.bind(eventType, function(event) {
1683            event.preventDefault();
1684
1685            if (watchedEvent === "" || watchedEvent === event.type) {
1686              var $this = $(this),
1687                  target = slider.controlNav.index($this);
1688
1689              if (!$this.hasClass(namespace + 'active')) {
1690                (target > slider.currentSlide) ? slider.direction = "next" : slider.direction = "prev";
1691                slider.flexAnimate(target, slider.vars.pauseOnAction);
1692              }
1693            }
1694
1695            // setup flags to prevent event duplication
1696            if (watchedEvent === "") {
1697              watchedEvent = event.type;
1698            }
1699            methods.setToClearWatchedEvent();
1700          });
1701        },
1702        set: function() {
1703          var selector = (slider.vars.controlNav === "thumbnails") ? 'img' : 'a';
1704          slider.controlNav = $('.' + namespace + 'control-nav li ' + selector, (slider.controlsContainer) ? slider.controlsContainer : slider);
1705        },
1706        active: function() {
1707          slider.controlNav.removeClass(namespace + "active").eq(slider.animatingTo).addClass(namespace + "active");
1708        },
1709        update: function(action, pos) {
1710          if (slider.pagingCount > 1 && action === "add") {
1711            slider.controlNavScaffold.append($('<li><a>' + slider.count + '</a></li>'));
1712          } else if (slider.pagingCount === 1) {
1713            slider.controlNavScaffold.find('li').remove();
1714          } else {
1715            slider.controlNav.eq(pos).closest('li').remove();
1716          }
1717          methods.controlNav.set();
1718          (slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length) ? slider.update(pos, action) : methods.controlNav.active();
1719        }
1720      },
1721      directionNav: {
1722        setup: function() {
1723          var directionNavScaffold = $('<ul class="' + namespace + 'direction-nav"><li class="' + namespace + 'nav-prev"><a class="' + namespace + 'prev" href="#">' + slider.vars.prevText + '</a></li><li class="' + namespace + 'nav-next"><a class="' + namespace + 'next" href="#">' + slider.vars.nextText + '</a></li></ul>');
1724
1725          // CONTROLSCONTAINER:
1726          if (slider.controlsContainer) {
1727            $(slider.controlsContainer).append(directionNavScaffold);
1728            slider.directionNav = $('.' + namespace + 'direction-nav li a', slider.controlsContainer);
1729          } else {
1730            slider.append(directionNavScaffold);
1731            slider.directionNav = $('.' + namespace + 'direction-nav li a', slider);
1732          }
1733
1734          methods.directionNav.update();
1735
1736          slider.directionNav.bind(eventType, function(event) {
1737            event.preventDefault();
1738            var target;
1739
1740            if (watchedEvent === "" || watchedEvent === event.type) {
1741              target = ($(this).hasClass(namespace + 'next')) ? slider.getTarget('next') : slider.getTarget('prev');
1742              slider.flexAnimate(target, slider.vars.pauseOnAction);
1743            }
1744
1745            // setup flags to prevent event duplication
1746            if (watchedEvent === "") {
1747              watchedEvent = event.type;
1748            }
1749            methods.setToClearWatchedEvent();
1750          });
1751        },
1752        update: function() {
1753          var disabledClass = namespace + 'disabled';
1754          if (slider.pagingCount === 1) {
1755            slider.directionNav.addClass(disabledClass).attr('tabindex', '-1');
1756          } else if (!slider.vars.animationLoop) {
1757            if (slider.animatingTo === 0) {
1758              slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "prev").addClass(disabledClass).attr('tabindex', '-1');
1759            } else if (slider.animatingTo === slider.last) {
1760              slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass).attr('tabindex', '-1');
1761            } else {
1762              slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
1763            }
1764          } else {
1765            slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
1766          }
1767        }
1768      },
1769      pausePlay: {
1770        setup: function() {
1771          var pausePlayScaffold = $('<div class="' + namespace + 'pauseplay"><a></a></div>');
1772
1773          // CONTROLSCONTAINER:
1774          if (slider.controlsContainer) {
1775            slider.controlsContainer.append(pausePlayScaffold);
1776            slider.pausePlay = $('.' + namespace + 'pauseplay a', slider.controlsContainer);
1777          } else {
1778            slider.append(pausePlayScaffold);
1779            slider.pausePlay = $('.' + namespace + 'pauseplay a', slider);
1780          }
1781
1782          methods.pausePlay.update((slider.vars.slideshow) ? namespace + 'pause' : namespace + 'play');
1783
1784          slider.pausePlay.bind(eventType, function(event) {
1785            event.preventDefault();
1786
1787            if (watchedEvent === "" || watchedEvent === event.type) {
1788              if ($(this).hasClass(namespace + 'pause')) {
1789                slider.manualPause = true;
1790                slider.manualPlay = false;
1791                slider.pause();
1792              } else {
1793                slider.manualPause = false;
1794                slider.manualPlay = true;
1795                slider.play();
1796              }
1797            }
1798
1799            // setup flags to prevent event duplication
1800            if (watchedEvent === "") {
1801              watchedEvent = event.type;
1802            }
1803            methods.setToClearWatchedEvent();
1804          });
1805        },
1806        update: function(state) {
1807          (state === "play") ? slider.pausePlay.removeClass(namespace + 'pause').addClass(namespace + 'play').html(slider.vars.playText) : slider.pausePlay.removeClass(namespace + 'play').addClass(namespace + 'pause').html(slider.vars.pauseText);
1808        }
1809      },
1810      touch: function() {
1811        var startX,
1812          startY,
1813          offset,
1814          cwidth,
1815          dx,
1816          startT,
1817          scrolling = false,
1818          localX = 0,
1819          localY = 0,
1820          accDx = 0;
1821
1822        if(!msGesture){
1823            el.addEventListener('touchstart', onTouchStart, false);
1824
1825            function onTouchStart(e) {
1826              if (slider.animating) {
1827                e.preventDefault();
1828              } else if ( ( window.navigator.msPointerEnabled ) || e.touches.length === 1 ) {
1829                slider.pause();
1830                // CAROUSEL:
1831                cwidth = (vertical) ? slider.h : slider. w;
1832                startT = Number(new Date());
1833                // CAROUSEL:
1834
1835                // Local vars for X and Y points.
1836                localX = e.touches[0].pageX;
1837                localY = e.touches[0].pageY;
1838
1839                offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
1840                         (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
1841                         (carousel && slider.currentSlide === slider.last) ? slider.limit :
1842                         (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
1843                         (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
1844                startX = (vertical) ? localY : localX;
1845                startY = (vertical) ? localX : localY;
1846
1847                el.addEventListener('touchmove', onTouchMove, false);
1848                el.addEventListener('touchend', onTouchEnd, false);
1849              }
1850            }
1851
1852            function onTouchMove(e) {
1853              // Local vars for X and Y points.
1854
1855              localX = e.touches[0].pageX;
1856              localY = e.touches[0].pageY;
1857
1858              dx = (vertical) ? startX - localY : startX - localX;
1859              scrolling = (vertical) ? (Math.abs(dx) < Math.abs(localX - startY)) : (Math.abs(dx) < Math.abs(localY - startY));
1860
1861              var fxms = 500;
1862
1863              if ( ! scrolling || Number( new Date() ) - startT > fxms ) {
1864                e.preventDefault();
1865                if (!fade && slider.transitions) {
1866                  if (!slider.vars.animationLoop) {
1867                    dx = dx/((slider.currentSlide === 0 && dx < 0 || slider.currentSlide === slider.last && dx > 0) ? (Math.abs(dx)/cwidth+2) : 1);
1868                  }
1869                  slider.setProps(offset + dx, "setTouch");
1870                }
1871              }
1872            }
1873
1874            function onTouchEnd(e) {
1875              // finish the touch by undoing the touch session
1876              el.removeEventListener('touchmove', onTouchMove, false);
1877
1878              if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
1879                var updateDx = (reverse) ? -dx : dx,
1880                    target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
1881
1882                if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
1883                  slider.flexAnimate(target, slider.vars.pauseOnAction);
1884                } else {
1885                  if (!fade) { slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true); }
1886                }
1887              }
1888              el.removeEventListener('touchend', onTouchEnd, false);
1889
1890              startX = null;
1891              startY = null;
1892              dx = null;
1893              offset = null;
1894            }
1895        }else{
1896            el.style.msTouchAction = "none";
1897            el._gesture = new MSGesture();
1898            el._gesture.target = el;
1899            el.addEventListener("MSPointerDown", onMSPointerDown, false);
1900            el._slider = slider;
1901            el.addEventListener("MSGestureChange", onMSGestureChange, false);
1902            el.addEventListener("MSGestureEnd", onMSGestureEnd, false);
1903
1904            function onMSPointerDown(e){
1905                e.stopPropagation();
1906                if (slider.animating) {
1907                    e.preventDefault();
1908                }else{
1909                    slider.pause();
1910                    el._gesture.addPointer(e.pointerId);
1911                    accDx = 0;
1912                    cwidth = (vertical) ? slider.h : slider. w;
1913                    startT = Number(new Date());
1914                    // CAROUSEL:
1915
1916                    offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
1917                        (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
1918                            (carousel && slider.currentSlide === slider.last) ? slider.limit :
1919                                (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
1920                                    (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
1921                }
1922            }
1923
1924            function onMSGestureChange(e) {
1925                e.stopPropagation();
1926                var slider = e.target._slider;
1927                if(!slider){
1928                    return;
1929                }
1930                var transX = -e.translationX,
1931                    transY = -e.translationY;
1932
1933                //Accumulate translations.
1934                accDx = accDx + ((vertical) ? transY : transX);
1935                dx = accDx;
1936                scrolling = (vertical) ? (Math.abs(accDx) < Math.abs(-transX)) : (Math.abs(accDx) < Math.abs(-transY));
1937
1938                if(e.detail === e.MSGESTURE_FLAG_INERTIA){
1939                    setImmediate(function (){
1940                        el._gesture.stop();
1941                    });
1942
1943                    return;
1944                }
1945
1946                if (!scrolling || Number(new Date()) - startT > 500) {
1947                    e.preventDefault();
1948                    if (!fade && slider.transitions) {
1949                        if (!slider.vars.animationLoop) {
1950                            dx = accDx / ((slider.currentSlide === 0 && accDx < 0 || slider.currentSlide === slider.last && accDx > 0) ? (Math.abs(accDx) / cwidth + 2) : 1);
1951                        }
1952                        slider.setProps(offset + dx, "setTouch");
1953                    }
1954                }
1955            }
1956
1957            function onMSGestureEnd(e) {
1958                e.stopPropagation();
1959                var slider = e.target._slider;
1960                if(!slider){
1961                    return;
1962                }
1963                if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
1964                    var updateDx = (reverse) ? -dx : dx,
1965                        target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
1966
1967                    if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
1968                        slider.flexAnimate(target, slider.vars.pauseOnAction);
1969                    } else {
1970                        if (!fade) { slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true); }
1971                    }
1972                }
1973
1974                startX = null;
1975                startY = null;
1976                dx = null;
1977                offset = null;
1978                accDx = 0;
1979            }
1980        }
1981      },
1982      resize: function() {
1983        if (!slider.animating && slider.is(':visible')) {
1984          if (!carousel) { slider.doMath(); }
1985
1986          if (fade) {
1987            // SMOOTH HEIGHT:
1988            methods.smoothHeight();
1989          } else if (carousel) { //CAROUSEL:
1990            slider.slides.width(slider.computedW);
1991            slider.update(slider.pagingCount);
1992            slider.setProps();
1993          }
1994          else if (vertical) { //VERTICAL:
1995            slider.viewport.height(slider.h);
1996            slider.setProps(slider.h, "setTotal");
1997          } else {
1998            // SMOOTH HEIGHT:
1999            if (slider.vars.smoothHeight) { methods.smoothHeight(); }
2000            slider.newSlides.width(slider.computedW);
2001            slider.setProps(slider.computedW, "setTotal");
2002          }
2003        }
2004      },
2005      smoothHeight: function(dur) {
2006        if (!vertical || fade) {
2007          var $obj = (fade) ? slider : slider.viewport;
2008          (dur) ? $obj.animate({"height": slider.slides.eq(slider.animatingTo).height()}, dur) : $obj.height(slider.slides.eq(slider.animatingTo).height());
2009        }
2010      },
2011      sync: function(action) {
2012        var $obj = $(slider.vars.sync).data("flexslider"),
2013            target = slider.animatingTo;
2014
2015        switch (action) {
2016          case "animate": $obj.flexAnimate(target, slider.vars.pauseOnAction, false, true); break;
2017          case "play": if (!$obj.playing && !$obj.asNav) { $obj.play(); } break;
2018          case "pause": $obj.pause(); break;
2019        }
2020      },
2021      uniqueID: function($clone) {
2022        // Append _clone to current level and children elements with id attributes
2023        $clone.filter( '[id]' ).add($clone.find( '[id]' )).each(function() {
2024          var $this = $(this);
2025          $this.attr( 'id', $this.attr( 'id' ) + '_clone' );
2026        });
2027        return $clone;
2028      },
2029      pauseInvisible: {
2030        visProp: null,
2031        init: function() {
2032          var visProp = methods.pauseInvisible.getHiddenProp();
2033          if (visProp) {
2034            var evtname = visProp.replace(/[H|h]idden/,'') + 'visibilitychange';
2035            document.addEventListener(evtname, function() {
2036              if (methods.pauseInvisible.isHidden()) {
2037                if(slider.startTimeout) {
2038                  clearTimeout(slider.startTimeout); //If clock is ticking, stop timer and prevent from starting while invisible
2039                } else { 
2040                  slider.pause(); //Or just pause
2041                }
2042              }
2043              else {
2044                if(slider.started) {
2045                  slider.play(); //Initiated before, just play
2046                } else { 
2047                  if (slider.vars.initDelay > 0) { 
2048                    setTimeout(slider.play, slider.vars.initDelay);
2049                  } else {
2050                    slider.play(); //Didn't init before: simply init or wait for it
2051                  } 
2052                }
2053              }
2054            });
2055          }
2056        },
2057        isHidden: function() {
2058          var prop = methods.pauseInvisible.getHiddenProp();
2059          if (!prop) {
2060            return false;
2061          }
2062          return document[prop];
2063        },
2064        getHiddenProp: function() {
2065          var prefixes = ['webkit','moz','ms','o'];
2066          // if 'hidden' is natively supported just return it
2067          if ('hidden' in document) {
2068            return 'hidden';
2069          }
2070          // otherwise loop over all the known prefixes until we find one
2071          for ( var i = 0; i < prefixes.length; i++ ) {
2072              if ((prefixes[i] + 'Hidden') in document) {
2073                return prefixes[i] + 'Hidden';
2074              }
2075          }
2076          // otherwise it's not supported
2077          return null;
2078        }
2079      },
2080      setToClearWatchedEvent: function() {
2081        clearTimeout(watchedEventClearTimer);
2082        watchedEventClearTimer = setTimeout(function() {
2083          watchedEvent = "";
2084        }, 3000);
2085      }
2086    };
2087
2088    // public methods
2089    slider.flexAnimate = function(target, pause, override, withSync, fromNav) {
2090      if (!slider.vars.animationLoop && target !== slider.currentSlide) {
2091        slider.direction = (target > slider.currentSlide) ? "next" : "prev";
2092      }
2093
2094      if (asNav && slider.pagingCount === 1) slider.direction = (slider.currentItem < target) ? "next" : "prev";
2095
2096      if (!slider.animating && (slider.canAdvance(target, fromNav) || override) && slider.is(":visible")) {
2097        if (asNav && withSync) {
2098          var master = $(slider.vars.asNavFor).data('flexslider');
2099          slider.atEnd = target === 0 || target === slider.count - 1;
2100          master.flexAnimate(target, true, false, true, fromNav);
2101          slider.direction = (slider.currentItem < target) ? "next" : "prev";
2102          master.direction = slider.direction;
2103
2104          if (Math.ceil((target + 1)/slider.visible) - 1 !== slider.currentSlide && target !== 0) {
2105            slider.currentItem = target;
2106            slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
2107            target = Math.floor(target/slider.visible);
2108          } else {
2109            slider.currentItem = target;
2110            slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
2111            return false;
2112          }
2113        }
2114
2115        slider.animating = true;
2116        slider.animatingTo = target;
2117
2118        // SLIDESHOW:
2119        if (pause) { slider.pause(); }
2120
2121        // API: before() animation Callback
2122        slider.vars.before(slider);
2123
2124        // SYNC:
2125        if (slider.syncExists && !fromNav) { methods.sync("animate"); }
2126
2127        // CONTROLNAV
2128        if (slider.vars.controlNav) { methods.controlNav.active(); }
2129
2130        // !CAROUSEL:
2131        // CANDIDATE: slide active class (for add/remove slide)
2132        if (!carousel) { slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide'); }
2133
2134        // INFINITE LOOP:
2135        // CANDIDATE: atEnd
2136        slider.atEnd = target === 0 || target === slider.last;
2137
2138        // DIRECTIONNAV:
2139        if (slider.vars.directionNav) { methods.directionNav.update(); }
2140
2141        if (target === slider.last) {
2142          // API: end() of cycle Callback
2143          slider.vars.end(slider);
2144          // SLIDESHOW && !INFINITE LOOP:
2145          if (!slider.vars.animationLoop) { slider.pause(); }
2146        }
2147
2148        // SLIDE:
2149        if (!fade) {
2150          var dimension = (vertical) ? slider.slides.filter(':first').height() : slider.computedW,
2151              margin, slideString, calcNext;
2152
2153          // INFINITE LOOP / REVERSE:
2154          if (carousel) {
2155            //margin = (slider.vars.itemWidth > slider.w) ? slider.vars.itemMargin * 2 : slider.vars.itemMargin;
2156            margin = slider.vars.itemMargin;
2157            calcNext = ((slider.itemW + margin) * slider.move) * slider.animatingTo;
2158            slideString = (calcNext > slider.limit && slider.visible !== 1) ? slider.limit : calcNext;
2159          } else if (slider.currentSlide === 0 && target === slider.count - 1 && slider.vars.animationLoop && slider.direction !== "next") {
2160            slideString = (reverse) ? (slider.count + slider.cloneOffset) * dimension : 0;
2161          } else if (slider.currentSlide === slider.last && target === 0 && slider.vars.animationLoop && slider.direction !== "prev") {
2162            slideString = (reverse) ? 0 : (slider.count + 1) * dimension;
2163          } else {
2164            slideString = (reverse) ? ((slider.count - 1) - target + slider.cloneOffset) * dimension : (target + slider.cloneOffset) * dimension;
2165          }
2166          slider.setProps(slideString, "", slider.vars.animationSpeed);
2167          if (slider.transitions) {
2168            if (!slider.vars.animationLoop || !slider.atEnd) {
2169              slider.animating = false;
2170              slider.currentSlide = slider.animatingTo;
2171            }
2172            
2173            // Unbind previous transitionEnd events and re-bind new transitionEnd event
2174            slider.container.unbind("webkitTransitionEnd transitionend");
2175            slider.container.bind("webkitTransitionEnd transitionend", function() {
2176              clearTimeout(slider.ensureAnimationEnd);
2177              slider.wrapup(dimension);
2178            });
2179
2180            // Insurance for the ever-so-fickle transitionEnd event
2181            clearTimeout(slider.ensureAnimationEnd);
2182            slider.ensureAnimationEnd = setTimeout(function() {
2183              slider.wrapup(dimension);
2184            }, slider.vars.animationSpeed + 100);
2185
2186          } else {
2187            slider.container.animate(slider.args, slider.vars.animationSpeed, slider.vars.easing, function(){
2188              slider.wrapup(dimension);
2189            });
2190          }
2191        } else { // FADE:
2192          if (!touch) {
2193            //slider.slides.eq(slider.currentSlide).fadeOut(slider.vars.animationSpeed, slider.vars.easing);
2194            //slider.slides.eq(target).fadeIn(slider.vars.animationSpeed, slider.vars.easing, slider.wrapup);
2195
2196            slider.slides.eq(slider.currentSlide).css({"zIndex": 1}).animate({"opacity": 0}, slider.vars.animationSpeed, slider.vars.easing);
2197            slider.slides.eq(target).css({"zIndex": 2}).animate({"opacity": 1}, slider.vars.animationSpeed, slider.vars.easing, slider.wrapup);
2198
2199          } else {
2200            slider.slides.eq(slider.currentSlide).css({ "opacity": 0, "zIndex": 1 });
2201            slider.slides.eq(target).css({ "opacity": 1, "zIndex": 2 });
2202            slider.wrapup(dimension);
2203          }
2204        }
2205        // SMOOTH HEIGHT:
2206        if (slider.vars.smoothHeight) { methods.smoothHeight(slider.vars.animationSpeed); }
2207      }
2208    };
2209    slider.wrapup = function(dimension) {
2210      // SLIDE:
2211      if (!fade && !carousel) {
2212        if (slider.currentSlide === 0 && slider.animatingTo === slider.last && slider.vars.animationLoop) {
2213          slider.setProps(dimension, "jumpEnd");
2214        } else if (slider.currentSlide === slider.last && slider.animatingTo === 0 && slider.vars.animationLoop) {
2215          slider.setProps(dimension, "jumpStart");
2216        }
2217      }
2218      slider.animating = false;
2219      slider.currentSlide = slider.animatingTo;
2220      // API: after() animation Callback
2221      slider.vars.after(slider);
2222    };
2223
2224    // SLIDESHOW:
2225    slider.animateSlides = function() {
2226      if (!slider.animating && focused ) { slider.flexAnimate(slider.getTarget("next")); }
2227    };
2228    // SLIDESHOW:
2229    slider.pause = function() {
2230      clearInterval(slider.animatedSlides);
2231      slider.animatedSlides = null;
2232      slider.playing = false;
2233      // PAUSEPLAY:
2234      if (slider.vars.pausePlay) { methods.pausePlay.update("play"); }
2235      // SYNC:
2236      if (slider.syncExists) { methods.sync("pause"); }
2237    };
2238    // SLIDESHOW:
2239    slider.play = function() {
2240      if (slider.playing) { clearInterval(slider.animatedSlides); }
2241      slider.animatedSlides = slider.animatedSlides || setInterval(slider.animateSlides, slider.vars.slideshowSpeed);
2242      slider.started = slider.playing = true;
2243      // PAUSEPLAY:
2244      if (slider.vars.pausePlay) { methods.pausePlay.update("pause"); }
2245      // SYNC:
2246      if (slider.syncExists) { methods.sync("play"); }
2247    };
2248    // STOP:
2249    slider.stop = function () {
2250      slider.pause();
2251      slider.stopped = true;
2252    };
2253    slider.canAdvance = function(target, fromNav) {
2254      // ASNAV:
2255      var last = (asNav) ? slider.pagingCount - 1 : slider.last;
2256      return (fromNav) ? true :
2257             (asNav && slider.currentItem === slider.count - 1 && target === 0 && slider.direction === "prev") ? true :
2258             (asNav && slider.currentItem === 0 && target === slider.pagingCount - 1 && slider.direction !== "next") ? false :
2259             (target === slider.currentSlide && !asNav) ? false :
2260             (slider.vars.animationLoop) ? true :
2261             (slider.atEnd && slider.currentSlide === 0 && target === last && slider.direction !== "next") ? false :
2262             (slider.atEnd && slider.currentSlide === last && target === 0 && slider.direction === "next") ? false :
2263             true;
2264    };
2265    slider.getTarget = function(dir) {
2266      slider.direction = dir;
2267      if (dir === "next") {
2268        return (slider.currentSlide === slider.last) ? 0 : slider.currentSlide + 1;
2269      } else {
2270        return (slider.currentSlide === 0) ? slider.last : slider.currentSlide - 1;
2271      }
2272    };
2273
2274    // SLIDE:
2275    slider.setProps = function(pos, special, dur) {
2276      var target = (function() {
2277        var posCheck = (pos) ? pos : ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo,
2278            posCalc = (function() {
2279              if (carousel) {
2280                return (special === "setTouch") ? pos :
2281                       (reverse && slider.animatingTo === slider.last) ? 0 :
2282                       (reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
2283                       (slider.animatingTo === slider.last) ? slider.limit : posCheck;
2284              } else {
2285                switch (special) {
2286                  case "setTotal": return (reverse) ? ((slider.count - 1) - slider.currentSlide + slider.cloneOffset) * pos : (slider.currentSlide + slider.cloneOffset) * pos;
2287                  case "setTouch": return (reverse) ? pos : pos;
2288                  case "jumpEnd": return (reverse) ? pos : slider.count * pos;
2289                  case "jumpStart": return (reverse) ? slider.count * pos : pos;
2290                  default: return pos;
2291                }
2292              }
2293            }());
2294
2295            return (posCalc * -1) + "px";
2296          }());
2297
2298      if (slider.transitions) {
2299        target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + target + ",0,0)";
2300        dur = (dur !== undefined) ? (dur/1000) + "s" : "0s";
2301        slider.container.css("-" + slider.pfx + "-transition-duration", dur);
2302         slider.container.css("transition-duration", dur);
2303      }
2304
2305      slider.args[slider.prop] = target;
2306      if (slider.transitions || dur === undefined) { slider.container.css(slider.args); }
2307
2308      slider.container.css('transform',target);
2309    };
2310
2311    slider.setup = function(type) {
2312      // SLIDE:
2313      if (!fade) {
2314        var sliderOffset, arr;
2315
2316        if (type === "init") {
2317          slider.viewport = $('<div class="' + namespace + 'viewport"></div>').css({"overflow": "hidden", "position": "relative"}).appendTo(slider).append(slider.container);
2318          // INFINITE LOOP:
2319          slider.cloneCount = 0;
2320          slider.cloneOffset = 0;
2321          // REVERSE:
2322          if (reverse) {
2323            arr = $.makeArray(slider.slides).reverse();
2324            slider.slides = $(arr);
2325            slider.container.empty().append(slider.slides);
2326          }
2327        }
2328        // INFINITE LOOP && !CAROUSEL:
2329        if (slider.vars.animationLoop && !carousel) {
2330          slider.cloneCount = 2;
2331          slider.cloneOffset = 1;
2332          // clear out old clones
2333          if (type !== "init") { slider.container.find('.clone').remove(); }
2334          slider.container.append(methods.uniqueID(slider.slides.first().clone().addClass('clone')).attr('aria-hidden', 'true'))
2335                          .prepend(methods.uniqueID(slider.slides.last().clone().addClass('clone')).attr('aria-hidden', 'true'));
2336        }
2337        slider.newSlides = $(slider.vars.selector, slider);
2338
2339        sliderOffset = (reverse) ? slider.count - 1 - slider.currentSlide + slider.cloneOffset : slider.currentSlide + slider.cloneOffset;
2340        // VERTICAL:
2341        if (vertical && !carousel) {
2342          slider.container.height((slider.count + slider.cloneCount) * 200 + "%").css("position", "absolute").width("100%");
2343          setTimeout(function(){
2344            slider.newSlides.css({"display": "block"});
2345            slider.doMath();
2346            slider.viewport.height(slider.h);
2347            slider.setProps(sliderOffset * slider.h, "init");
2348          }, (type === "init") ? 100 : 0);
2349        } else {
2350          slider.container.width((slider.count + slider.cloneCount) * 200 + "%");
2351          slider.setProps(sliderOffset * slider.computedW, "init");
2352          setTimeout(function(){
2353            slider.doMath();
2354            slider.newSlides.css({"width": slider.computedW, "float": "left", "display": "block"});
2355            // SMOOTH HEIGHT:
2356            if (slider.vars.smoothHeight) { methods.smoothHeight(); }
2357          }, (type === "init") ? 100 : 0);
2358        }
2359      } else { // FADE:
2360        slider.slides.css({"width": "100%", "float": "left", "marginRight": "-100%", "position": "relative"});
2361        if (type === "init") {
2362          if (!touch) {
2363            //slider.slides.eq(slider.currentSlide).fadeIn(slider.vars.animationSpeed, slider.vars.easing);
2364            if (slider.vars.fadeFirstSlide == false) {
2365              slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).css({"opacity": 1});
2366            } else {
2367              slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).animate({"opacity": 1},slider.vars.animationSpeed,slider.vars.easing);
2368            }
2369          } else {
2370            slider.slides.css({ "opacity": 0, "display": "block", "webkitTransition": "opacity " + slider.vars.animationSpeed / 1000 + "s ease", "zIndex": 1 }).eq(slider.currentSlide).css({ "opacity": 1, "zIndex": 2});
2371          }
2372        }
2373        // SMOOTH HEIGHT:
2374        if (slider.vars.smoothHeight) { methods.smoothHeight(); }
2375      }
2376      // !CAROUSEL:
2377      // CANDIDATE: active slide
2378      if (!carousel) { slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide"); }
2379
2380      //FlexSlider: init() Callback
2381      slider.vars.init(slider);
2382    };
2383
2384    slider.doMath = function() {
2385      var slide = slider.slides.first(),
2386          slideMargin = slider.vars.itemMargin,
2387          minItems = slider.vars.minItems,
2388          maxItems = slider.vars.maxItems;
2389
2390      slider.w = (slider.viewport===undefined) ? slider.width() : slider.viewport.width();
2391      slider.h = slide.height();
2392      slider.boxPadding = slide.outerWidth() - slide.width();
2393
2394      // CAROUSEL:
2395      if (carousel) {
2396        slider.itemT = slider.vars.itemWidth + slideMargin;
2397        slider.minW = (minItems) ? minItems * slider.itemT : slider.w;
2398        slider.maxW = (maxItems) ? (maxItems * slider.itemT) - slideMargin : slider.w;
2399        slider.itemW = (slider.minW > slider.w) ? (slider.w - (slideMargin * (minItems - 1)))/minItems :
2400                       (slider.maxW < slider.w) ? (slider.w - (slideMargin * (maxItems - 1)))/maxItems :
2401                       (slider.vars.itemWidth > slider.w) ? slider.w : slider.vars.itemWidth;
2402
2403        slider.visible = Math.floor(slider.w/(slider.itemW));
2404        slider.move = (slider.vars.move > 0 && slider.vars.move < slider.visible ) ? slider.vars.move : slider.visible;
2405        slider.pagingCount = Math.ceil(((slider.count - slider.visible)/slider.move) + 1);
2406        slider.last =  slider.pagingCount - 1;
2407        slider.limit = (slider.pagingCount === 1) ? 0 :
2408                       (slider.vars.itemWidth > slider.w) ? (slider.itemW * (slider.count - 1)) + (slideMargin * (slider.count - 1)) : ((slider.itemW + slideMargin) * slider.count) - slider.w - slideMargin;
2409      } else {
2410        slider.itemW = slider.w;
2411        slider.pagingCount = slider.count;
2412        slider.last = slider.count - 1;
2413      }
2414      slider.computedW = slider.itemW - slider.boxPadding;
2415    };
2416
2417    slider.update = function(pos, action) {
2418      slider.doMath();
2419
2420      // update currentSlide and slider.animatingTo if necessary
2421      if (!carousel) {
2422        if (pos < slider.currentSlide) {
2423          slider.currentSlide += 1;
2424        } else if (pos <= slider.currentSlide && pos !== 0) {
2425          slider.currentSlide -= 1;
2426        }
2427        slider.animatingTo = slider.currentSlide;
2428      }
2429
2430      // update controlNav
2431      if (slider.vars.controlNav && !slider.manualControls) {
2432        if ((action === "add" && !carousel) || slider.pagingCount > slider.controlNav.length) {
2433          methods.controlNav.update("add");
2434        } else if ((action === "remove" && !carousel) || slider.pagingCount < slider.controlNav.length) {
2435          if (carousel && slider.currentSlide > slider.last) {
2436            slider.currentSlide -= 1;
2437            slider.animatingTo -= 1;
2438          }
2439          methods.controlNav.update("remove", slider.last);
2440        }
2441      }
2442      // update directionNav
2443      if (slider.vars.directionNav) { methods.directionNav.update(); }
2444
2445    };
2446
2447    slider.addSlide = function(obj, pos) {
2448      var $obj = $(obj);
2449
2450      slider.count += 1;
2451      slider.last = slider.count - 1;
2452
2453      // append new slide
2454      if (vertical && reverse) {
2455        (pos !== undefined) ? slider.slides.eq(slider.count - pos).after($obj) : slider.container.prepend($obj);
2456      } else {
2457        (pos !== undefined) ? slider.slides.eq(pos).before($obj) : slider.container.append($obj);
2458      }
2459
2460      // update currentSlide, animatingTo, controlNav, and directionNav
2461      slider.update(pos, "add");
2462
2463      // update slider.slides
2464      slider.slides = $(slider.vars.selector + ':not(.clone)', slider);
2465      // re-setup the slider to accomdate new slide
2466      slider.setup();
2467
2468      //FlexSlider: added() Callback
2469      slider.vars.added(slider);
2470    };
2471    slider.removeSlide = function(obj) {
2472      var pos = (isNaN(obj)) ? slider.slides.index($(obj)) : obj;
2473
2474      // update count
2475      slider.count -= 1;
2476      slider.last = slider.count - 1;
2477
2478      // remove slide
2479      if (isNaN(obj)) {
2480        $(obj, slider.slides).remove();
2481      } else {
2482        (vertical && reverse) ? slider.slides.eq(slider.last).remove() : slider.slides.eq(obj).remove();
2483      }
2484
2485      // update currentSlide, animatingTo, controlNav, and directionNav
2486      slider.doMath();
2487      slider.update(pos, "remove");
2488
2489      // update slider.slides
2490      slider.slides = $(slider.vars.selector + ':not(.clone)', slider);
2491      // re-setup the slider to accomdate new slide
2492      slider.setup();
2493
2494      // FlexSlider: removed() Callback
2495      slider.vars.removed(slider);
2496    };
2497
2498    //FlexSlider: Initialize
2499    methods.init();
2500  };
2501
2502  // Ensure the slider isn't focussed if the window loses focus.
2503  $( window ).blur( function ( e ) {
2504    focused = false;
2505  }).focus( function ( e ) {
2506    focused = true;
2507  });
2508
2509  //FlexSlider: Default Settings
2510  $.flexslider.defaults = {
2511    namespace: "flex-",             //{NEW} String: Prefix string attached to the class of every element generated by the plugin
2512    selector: ".slides > li",       //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
2513    animation: "fade",              //String: Select your animation type, "fade" or "slide"
2514    easing: "swing",                //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
2515    direction: "horizontal",        //String: Select the sliding direction, "horizontal" or "vertical"
2516    reverse: false,                 //{NEW} Boolean: Reverse the animation direction
2517    animationLoop: true,            //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
2518    smoothHeight: false,            //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
2519    startAt: 0,                     //Integer: The slide that the slider should start on. Array notation (0 = first slide)
2520    slideshow: true,                //Boolean: Animate slider automatically
2521    slideshowSpeed: 7000,           //Integer: Set the speed of the slideshow cycling, in milliseconds
2522    animationSpeed: 600,            //Integer: Set the speed of animations, in milliseconds
2523    initDelay: 0,                   //{NEW} Integer: Set an initialization delay, in milliseconds
2524    randomize: false,               //Boolean: Randomize slide order
2525    fadeFirstSlide: true,           //Boolean: Fade in the first slide when animation type is "fade"
2526    thumbCaptions: false,           //Boolean: Whether or not to put captions on thumbnails when using the "thumbnails" controlNav.
2527
2528    // Usability features
2529    pauseOnAction: true,            //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
2530    pauseOnHover: false,            //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
2531    pauseInvisible: true,   		//{NEW} Boolean: Pause the slideshow when tab is invisible, resume when visible. Provides better UX, lower CPU usage.
2532    useCSS: true,                   //{NEW} Boolean: Slider will use CSS3 transitions if available
2533    touch: true,                    //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices
2534    video: false,                   //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches
2535
2536    // Primary Controls
2537    controlNav: true,               //Boolean: Create navigation for paging control of each slide? Note: Leave true for manualControls usage
2538    directionNav: true,             //Boolean: Create navigation for previous/next navigation? (true/false)
2539    prevText: "Previous",           //String: Set the text for the "previous" directionNav item
2540    nextText: "Next",               //String: Set the text for the "next" directionNav item
2541
2542    // Secondary Navigation
2543    keyboard: true,                 //Boolean: Allow slider navigating via keyboard left/right keys
2544    multipleKeyboard: false,        //{NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present.
2545    mousewheel: false,              //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
2546    pausePlay: false,               //Boolean: Create pause/play dynamic element
2547    pauseText: "Pause",             //String: Set the text for the "pause" pausePlay item
2548    playText: "Play",               //String: Set the text for the "play" pausePlay item
2549
2550    // Special properties
2551    controlsContainer: "",          //{UPDATED} jQuery Object/Selector: Declare which container the navigation elements should be appended too. Default container is the FlexSlider element. Example use would be $(".flexslider-container"). Property is ignored if given element is not found.
2552    manualControls: "",             //{UPDATED} jQuery Object/Selector: Declare custom control navigation. Examples would be $(".flex-control-nav li") or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.
2553    sync: "",                       //{NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care.
2554    asNavFor: "",                   //{NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider
2555
2556    // Carousel Options
2557    itemWidth: 0,                   //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding.
2558    itemMargin: 0,                  //{NEW} Integer: Margin between carousel items.
2559    minItems: 1,                    //{NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this.
2560    maxItems: 0,                    //{NEW} Integer: Maxmimum number of carousel items that should be visible. Items will resize fluidly when above this limit.
2561    move: 0,                        //{NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items.
2562    allowOneSlide: true,           //{NEW} Boolean: Whether or not to allow a slider comprised of a single slide
2563
2564    // Callback API
2565    start: function(){},            //Callback: function(slider) - Fires when the slider loads the first slide
2566    before: function(){},           //Callback: function(slider) - Fires asynchronously with each slider animation
2567    after: function(){},            //Callback: function(slider) - Fires after each slider animation completes
2568    end: function(){},              //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
2569    added: function(){},            //{NEW} Callback: function(slider) - Fires after a slide is added
2570    removed: function(){},           //{NEW} Callback: function(slider) - Fires after a slide is removed
2571    init: function() {}             //{NEW}
2571 Callback: function(slider) - Fires after the slider is initially setup
2572  };
2573
2574  //FlexSlider: Plugin Function
2575  $.fn.flexslider = function(options) {
2576    if (options === undefined) { options = {}; }
2577
2578    if (typeof options === "object") {
2579      return this.each(function() {
2580        var $this = $(this),
2581            selector = (options.selector) ? options.selector : ".slides > li",
2582            $slides = $this.find(selector);
2583
2584      if ( ( $slides.length === 1 && options.allowOneSlide === true ) || $slides.length === 0 ) {
2585          $slides.fadeIn(400);
2586          if (options.start) { options.start($this); }
2587        } else if ($this.data('flexslider') === undefined) {
2588          new $.flexslider(this, options);
2589        }
2590      });
2591    } else {
2592      // Helper strings to quickly perform functions on the slider
2593      var $slider = $(this).data('flexslider');
2594      switch (options) {
2595        case "play": $slider.play(); break;
2596        case "pause": $slider.pause(); break;
2597        case "stop": $slider.stop(); break;
2598        case "next": $slider.flexAnimate($slider.getTarget("next"), true); break;
2599        case "prev":
2600        case "previous": $slider.flexAnimate($slider.getTarget("prev"), true); break;
2601        default: if (typeof options === "number") { $slider.flexAnimate(options, true); }
2602      }
2603    }
2604  };
2605})(jQuery);
2606;
2607/*
2608	By Osvaldas Valutis, www.osvaldas.info
2609	Available for use under the MIT License
2610*/
2611
2612
2613
2614;(function( $, window, document, undefined )
2615{
2616	$.fn.doubleTapToGo = function( params )
2617	{
2618		if( !( 'ontouchstart' in window ) &&
2619			!navigator.msMaxTouchPoints &&
2620			!navigator.userAgent.toLowerCase().match( /windows phone os 7/i ) ) return false;
2621
2622		this.each( function()
2623		{
2624			var curItem = false;
2625
2626			$( this ).on( 'click', function( e )
2627			{
2628				var item = $( this );
2629				if( item[ 0 ] != curItem[ 0 ] )
2630				{
2631					e.preventDefault();
2632					curItem = item;
2633				}
2634			});
2635
2636			$( document ).on( 'click touchstart MSPointerDown', function( e )
2637			{
2638				var resetItem = true,
2639					parents	= $( e.target ).parents();
2640
2641				for( var i = 0; i < parents.length; i++ )
2642					if( parents[ i ] == curItem[ 0 ] )
2643						resetItem = false;
2644
2645				if( resetItem )
2646					curItem = false;
2647			});
2648		});
2649		return this;
2650	};
2651})( jQuery, window, document );;
2652/**
2653 * global.js
2654 *
2655 * Handles various UI actions
2656 * - Mobile menu
2657 * - Search form show/hide
2658 * - Touch device dropdowns (requires: doubletaptogo.js)
2659 * - Flexslider (requires: flexslider.js)
2660 * - Scroll to top
2661 * - Smooth page load
2662 *
2663 * @package Rowling
2664 */
2665( function( $ ) {
2666
2667/**
2668 * On ready
2669 */
2670	$( document ).ready( function() {
2671		var windowWidth = $( window ).width();
2672
2673
2674		// Toggle mobile menu
2675		$( ".nav-toggle" ).on( "click", function() {
2676			$( this ).toggleClass( "active" );
2677			$( ".header-bottom-menu" ).slideToggle();
2678			if ( $( ".search-toggle" ).hasClass( "active" ) ) {
2679				$( ".search-toggle" ).removeClass( "active" );
2680				$( ".search-container" ).slideToggle();
2681			}
2682			return false;
2683		});
2684
2685
2686		// Toggle search container
2687		$( ".search-toggle" ).on( "click", function() {
2688			$( this ).toggleClass( "active" );
2689			$( ".search-container" ).slideToggle();
2690			if ( $( ".nav-toggle" ).hasClass( "active" ) ) {
2691				$( ".nav-toggle" ).removeClass( "active" );
2692				$( ".header-bottom-menu" ).slideToggle();
2693			}
2694			return false;
2695		});
2696
2697		$( window ).resize( function() {
2698
2699			// Prevent the Android keyboard from triggering the following code
2700			if ( windowWidth !== $( window ).width() ) {
2701
2702				// Hide mobile menu/search container at resize
2703				if ( $(window).width() >= 851 ) {
2704					$( ".nav-toggle" ).removeClass( "active" );
2705					$( ".header-bottom-menu" ).show();
2706				}
2707
2708				if ( $(window).width() <= 850 ) {
2709					$( ".search-toggle" ).removeClass( "active" );
2710					$( ".search-container" ).hide();
2711				}
2712
2713				// Dropdown menus on touch devices, excluding mobile menu
2714				if ( $(window).width() <= 851 ) {
2715					$( ".header-bottom-menu li:has(ul)" ).doubleTapToGo();
2716					$( ".header-top-menu li:has(ul)" ).doubleTapToGo();
2717				}
2718
2719				if ( $(window).width() >= 850 ) {
2720					$( ".header-bottom-menu li:has(ul)" ).unbind();
2721					$( ".header-top-menu li:has(ul)" ).unbind();
2722				}
2723			}
2724
2725			windowWidth = $( window ).width();
2726
2727		}).resize();
2728
2729		// Load Flexslider
2730		$( ".flexslider" ).flexslider( {
2731			animation: "slide",
2732			controlNav: false,
2733			prevText: "",
2734			nextText: "",
2735			smoothHeight: true
2736		});
2737
2738		// smooth scroll to the top
2739		$( ".to-the-top" ).click( function() {
2740			$( "html, body" ).animate( { scrollTop: 0 }, 500 );
2741				return false;
2742		});
2743
2744	});
2745
2746
2747	/**
2748	 * On load
2749	 */
2750	$( document.body ).on( 'post-load', function () {
2751
2752		// Load Flexslider after new posts have been added to the page.
2753		$( ".flexslider" ).flexslider( {
2754			animation: "slide",
2755			controlNav: false,
2756			prevText: "",
2757			nextText: "",
2758			smoothHeight: true
2759		});
2760
2761	});
2762
2763} ) ( jQuery );
2764;
2765/*! This file is auto-generated */
2766window.addComment=function(v){var I,C,h,E=v.document,b={commentReplyClass:"comment-reply-link",commentReplyTitleId:"reply-title",cancelReplyId:"cancel-comment-reply-link",commentFormId:"commentform",temporaryFormId:"wp-temp-form-div",parentIdFieldId:"comment_parent",postIdFieldId:"comment_post_ID"},e=v.MutationObserver||v.WebKitMutationObserver||v.MozMutationObserver,i="querySelector"in E&&"addEventListener"in v,n=!!E.documentElement.dataset;function t(){o(),e&&new e(d).observe(E.body,{childList:!0,subtree:!0})}function o(e){if(i&&(I=g(b.cancelReplyId),C=g(b.commentFormId),I)){I.addEventListener("click",l);function t(e){if((e.metaKey||e.ctrlKey)&&13===e.keyCode&&"a"!==E.activeElement.tagName.toLowerCase())return C.removeEventListener("keydown",t),e.preventDefault(),C.submit.click(),!1}C&&C.addEventListener("keydown",t);for(var n=function(e){var t=b.commentReplyClass;e&&e.childNodes||(e=E);e=E.getElementsByClassName?e.getElementsByClassName(t):e.querySelectorAll("."+t);return e}(e),o=0,d=n.length;o<d;o++)n[o].addEventListener("click",r)}}function l(e){var t,n,o=g(b.temporaryFormId);o&&h&&(g(b.parentIdFieldId).value="0",t=o.textContent,o.parentNode.replaceChild(h,o),this.style.display="none",n=(o=(o=g(b.commentReplyTitleId))&&o.firstChild)&&o.nextSibling,o&&o.nodeType===Node.TEXT_NODE&&t&&(n&&"A"===n.nodeName&&n.id!==b.cancelReplyId&&(n.style.display=""),o.textContent=t),e.preventDefault())}function r(e){var t=g(b.commentReplyTitleId),t=t&&t.firstChild.textContent,n=this,o=a(n,"belowelement"),d=a(n,"commentid"),i=a(n,"respondelement"),l=a(n,"postid"),n=a(n,"replyto")||t;o&&d&&i&&l&&!1===v.addComment.moveForm(o,d,i,l,n)&&e.preventDefault()}function d(e){for(var t=e.length;t--;)if(e[t].addedNodes.length)return void o()}function a(e,t){return n?e.dataset[t]:e.getAttribute("data-"+t)}function g(e){return E.getElementById(e)}return i&&"loading"!==E.readyState?t():i&&v.addEventListener("DOMContentLoaded",t,!1),{init:o,moveForm:function(e,t,n,o,d){var i,l,r,a,m,c,s,e=g(e),n=(h=g(n),g(b.parentIdFieldId)),y=g(b.postIdFieldId),p=g(b.commentReplyTitleId),u=(p=p&&p.firstChild)&&p.nextSibling;if(e&&h&&n){void 0===d&&(d=p&&p.textContent),a=h,m=b.temporaryFormId,c=g(m),s=(s=g(b.commentReplyTitleId))?s.firstChild.textContent:"",c||((c=E.createElement("div")).id=m,c.style.display="none",c.textContent=s,a.parentNode.insertBefore(c,a)),o&&y&&(y.value=o),n.value=t,I.style.display="",e.parentNode.insertBefore(h,e.nextSibling),p&&p.nodeType===Node.TEXT_NODE&&(u&&"A"===u.nodeName&&u.id!==b.cancelReplyId&&(u.style.display="none"),p.textContent=d),I.onclick=function(){return!1};try{for(var f=0;f<C.elements.length;f++)if(i=C.elements[f],l=!1,"getComputedStyle"in v?r=v.getComputedStyle(i):E.documentElement.currentStyle&&(r=i.currentStyle),(i.offsetWidth<=0&&i.offsetHeight<=0||"hidden"===r.visibility)&&(l=!0),"hidden"!==i.type&&!i.disabled&&!l){i.focus();break}}catch(e){}return!1}}}}(window);;
2767/* global FB, jpfbembed */
2768( function ( window ) {
2769	var facebookEmbed = function () {
2770		var fbroot, src, newScript, firstScript;
2771
2772		if ( 'undefined' !== typeof FB && FB.XFBML ) {
2773			FB.XFBML.parse();
2774		} else {
2775			fbroot = document.createElement( 'div' );
2776			fbroot.id = 'fb-root';
2777			document.getElementsByTagName( 'body' )[ 0 ].appendChild( fbroot );
2778
2779			src = '//connect.facebook.net/' + jpfbembed.locale + '/sdk.js#xfbml=1';
2780			if ( jpfbembed.appid ) {
2781				src += '&appId=' + jpfbembed.appid;
2782			}
2783			src += '&version=v2.3';
2784
2785			newScript = document.createElement( 'script' );
2786			newScript.setAttribute( 'src', src );
2787			firstScript = document.querySelector( 'script' );
2788			firstScript.parentNode.insertBefore( newScript, firstScript );
2789		}
2790	};
2791
2792	window.fbAsyncInit = function () {
2793		FB.init( {
2794			appId: jpfbembed.appid,
2795			version: 'v2.3',
2796		} );
2797
2798		FB.XFBML.parse();
2799	};
2800
2801	if ( 'undefined' !== typeof infiniteScroll ) {
2802		document.body.addEventListener( 'post-load', facebookEmbed );
2803	}
2804
2805	facebookEmbed();
2806} )( window );
2807;
2808!function(){"use strict";var e,t={noop:function(){}
2808,texturize:function(e){return(e=(e=(e=(e+="").replace(/'/g,"&#8217;").replace(/&#039;/g,"&#8217;")).replace(/"/g,"&#8221;").replace(/&#034;/g,"&#8221;").replace(/&quot;/g,"&#8221;").replace(/[\u201D]/g,"&#8221;")).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.jpCarouselCancelFade&&e.jpCarouselCancelFade(),e.classList.remove("jp-carousel-fade"),e.style.removeProperty("display"),e.style.opacity=t,e.style.pointerEvents="none",e.offsetWidth,e.classList.add("jp-carousel-fade"),e.style.opacity=r;var a=1e3*parseFloat(getComputedStyle(e).transitionDuration)||0,n=setTimeout(function(){e.jpCarouselCancelFade=null,e.style.removeProperty("pointer-events"),o()},a+50);e.jpCarouselCancelFade=function(){clearTimeout(n),e.jpCarouselCancelFade=null}}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,n=Date.now(),i=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),n=parseInt(a.paddingTop,10)+parseInt(a.paddingBottom,10);return n=isNaN(n)?0:n,o.offsetHeight+t.offsetHeight+n}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-n)/300)<.5?2*c*c:1-Math.pow(-2*c+2,2)/2,m=(d=d>1?1:d)*l;if(t.scrollTop=i+m,u<=n+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){var t=document.createElement("div");return t.innerHTML=e.replace(/<[^>]*>?/gm,""),t.textContent},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},prefersReducedMotion:function(){return!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}}}();function o(){var o,a,n,i,l={},s={},c="",u=!1,d="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",m=".gallery-item, .tiled-gallery-item, .blocks-gallery-item,  .tiled-gallery__item",p=m+", .wp-block-image",g={},h="undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.stat?wpcom.carousel.stat:t.noop,f="undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.pageview?wpcom.carousel.pageview:t.noop;function v(t){if(!u)switch(t.which){case 38:t.preventDefault(),g.overlay.scrollTop-=100;break;case 40:t.preventDefault(),g.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 y(){u=!0}function w(){u=!1}function S(e){e.role="button",e.tabIndex=0,e.ariaLabel=jetpackCarouselStrings.image_label}function j(){g.overlay||(g.overlay=document.querySelector(".jp-carousel-overlay"),g.container=g.overlay.querySelector(".jp-carousel-wrap"),g.gallery=g.container.querySelector(".jp-carousel"),g.info=g.overlay.querySelector(".jp-carousel-info"),g.caption=g.
2808info.querySelector(".jp-carousel-caption"),g.commentField=g.overlay.querySelector("#jp-carousel-comment-form-comment-field"),g.emailField=g.overlay.querySelector("#jp-carousel-comment-form-email-field"),g.authorField=g.overlay.querySelector("#jp-carousel-comment-form-author-field"),g.urlField=g.overlay.querySelector("#jp-carousel-comment-form-url-field"),window.innerWidth<=760&&Math.round(window.innerWidth/760*110)<40&&r.isTouch(),[g.commentField,g.emailField,g.authorField,g.urlField].forEach(function(e){e&&(e.addEventListener("focus",y),e.addEventListener("blur",w))}),g.overlay.addEventListener("click",function(e){var t,o,a=e.target,n=!!r.closest(a,".jp-carousel-close-hint"),i=!!window.matchMedia("(max-device-width: 760px)").matches;a===g.overlay?i||k():n?k():a.classList.contains("jp-carousel-image-download")?h("download_original_click"):a.classList.contains("jp-carousel-comment-login")?(t=g.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(g.container,"data-carousel-extra")||{},a=g.currentSlide.attrs.attachmentId,n=document.querySelector("#jp-carousel-comment-form-submit-and-info-wrapper"),i=document.querySelector("#jp-carousel-comment-form-spinner"),s=document.querySelector("#jp-carousel-comment-form-button-submit"),c=document.querySelector("#jp-carousel-comment-form");if(g.commentField&&g.commentField.getAttribute("id")===t.getAttribute("id"))y(),r.show(n);else if(r.matches(t,'input[type="submit"]')){e.preventDefault(),e.stopPropagation(),r.show(i),c.classList.add("jp-carousel-is-disabled");var u={action:"post_attachment_comment",nonce:jetpackCarouselStrings.nonce,blog_id:o.blog_id,id:a,comment:g.commentField.value};if(!u.comment.length)return void b(jetpackCarouselStrings.no_comment_text,!1);if(1!==Number(jetpackCarouselStrings.is_logged_in)&&(u.email=g.emailField.value,u.author=g.authorField.value,u.url=g.urlField.value,1===Number(jetpackCarouselStrings.require_name_email))){if(!u.email.length||!u.email.match("@"))return void b(jetpackCarouselStrings.no_comment_email,!1);if(!u.author.length)return void b(jetpackCarouselStrings.no_comment_author,!1)}var d=new XMLHttpRequest;d.open("POST",jetpackCarouselStrings.ajaxurl,!0),d.setRequestHeader("X-Requested-With","XMLHttpRequest"),d.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),d.onreadystatechange=function(){if(this.readyState===XMLHttpRequest.DONE&&this.status>=200&&this.status<300){var e;try{e=JSON.parse(this.response)}catch{return void b(jetpackCarouselStrings.comment_post_error,!1)}if("approved"===e.comment_status){b(jetpackCarouselStrings.comment_approved,!0);var t=function(e){for(var t=0;t<g.slides.length;t++)if(g.slides[t].attrs.attachmentId===e)return g.slides[t];return null}(a);t&&(t.attrs.commentsCount=(parseInt(t.attrs.commentsCount,10)||0)+1)}else"unapproved"===e.comment_status?b(jetpackCarouselStrings.comment_unapproved,!0):b(jetpackCarouselStrings.comment_post_error,!1);W(),delete l[a],_(a,void 0,!0),s.value=jetpackCarouselStrings.post_comment,r.hide(i),c.classList.remove("jp-carousel-is-disabled")}else b(jetpackCarouselStrings.comment_post_error,!1)};var m=[];for(var p in u)if(p){var h=encodeURIComponent(p)+"="+encodeURIComponent(u[p]);m.push(h.replace(/%20/g,"+"))}var f=m.join("&");d.send(f)}}(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=g.info.querySelector(".jp-carousel-info-extra"),a=g.info.querySelector(".jp-carousel-image-meta"),n=g.info.querySelector(".jp-carousel-comments-wrapper"),i=g.info.querySelector(".jp-carousel-icon-info"),s=g.info.querySelector(".jp-carousel-icon-comments");function c(){s&&s.classList.remove("jp-carousel-selected"),i.classList.toggle("jp-carousel-selected"),n&&n.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 u(){if(i&&i.classList.remove("jp-carousel-selected"),s.classList.toggle("jp-carousel-selected"),a&&a.classList.remove("jp-carousel-show"),n)if(n.classList.toggle("jp-carousel-show"),n.classList.contains("jp-carousel-show")){o.classList.add("jp-carousel-show");var e=g.currentSlide;if(e){var t=l[e.attrs.attachmentId];t?t.hasMore&&T(e.attrs.attachmentId,t.nextOffset):_(e.attrs.attachmentId)}}else 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(g.overlay,g.overlay,c):(c(),r.scrollToElement(g.info,g.overlay))),r.closest(t,".jp-carousel-icon-comments")&&(n&&n.classList.contains("jp-carousel-show")?r.scrollToElement(g.overlay,g.overlay,u):(u(),r.scrollToElement(g.info,g.overlay)))}(e)}),window.addEventListener("keydown",v),g.overlay.addEventListener("jp_carousel.afterOpen",function(){w(),g.slides.length<=1||(g.slides.length<=5?r.show(g.info.querySelector(".jp-swiper-pagination")):r.show(g.info.querySelector(".jp-carousel-pagination")))}),g.overlay.addEventListener("jp_carousel.beforeClose",function(){y(),document.documentElement.style.removeProperty("height"),e&&e.enable(),r.hide(g.info.querySelector(".jp-swiper-pagination")),r.hide(g.info.querySelector(".jp-carousel-pagination"))}),g.overlay.addEventListener("jp_carousel.afterClose",function(){window.history.pushState?history.pushState("",document.title,window.location.pathname+window.location.search):window.location.href="",c="",g.isOpen=!1}),g.overlay.addEventListener("touchstart",function(e){e.touches.length>1&&e.preventDefault()}))}function b(e,t){var o=g.overlay.querySelector("#jp-carousel-comment-post-results"),a="jp-carousel-comment-post-"+(t?"success":"error");o.innerHTML='<span class="'+a+'">'+e+"</span>",r.hide(g.overlay.querySelector("#jp-carousel-comment-form-spinner")),g.overlay.querySelector("#jp-carousel-comment-form").classList.remove("jp-carousel-is-disabled"),r.show(o)}function L(){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,m)&&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&&(S(e),t.classList.add("single-image-gallery"),t.setAttribute("data-carousel-extra",JSON.stringify({blog_id:Number(jetpackCarouselStrings.blog_id)})))}})}function x(t,r){g.isOpen?(C(r),e.slideTo(r+1)):z(t,{startIndex:r})}function C(e){(!e||e<0||e>g.slides.length)&&(e=0),g.currentSlide=g.slides[e];var a,n,i=g.currentSlide,s=i.attrs.attachmentId;M(g.slides[e]),function(e){var t=[],r=g.slides.length;if(r>1){var o=e>0?e-1:r-1;t.push(o);var a=e<r-1?e+1:0;t.push(a)}t.forEach(function(e){var t=g.slides[e];t&&(M(t),1!==Number(jetpackCarouselStrings.display_background_image)||t.backgroundImage||F(t))})}(e),1!==Number(jetpackCarouselStrings.display_background_image)||g.slides[e].backgroundImage||F(g.slides[e]),r.hide(g.caption),function(e){var t,o,a,n,i,l,s;if(n=g.overlay.querySelector(".jp-carousel-photo-caption"),i=g.overlay.querySelector(".jp-carousel-caption"),l=g.overlay.querySelector(".jp-carousel-photo-title"),s=g.overlay.querySelector(".jp-carousel-photo-description"),r.hide(n),r.hide(i),r.hide(l),r.hide(s),t=A(e.caption)||"",o=A(e.title)||"",a=A(e.desc)||"",(t||o||a)&&(t&&(n.innerHTML=t,i.innerHTML=t,r.show(n),r.show(i)),r.stripHTML(t)===r.stripHTML(o)&&(o=""),r.stripHTML(t)===r.stripHTML(a)&&(a=""),r.stripHTML(o)===r.stripHTML(a)&&(a=""),a&&(s.innerHTML=a,r.show(s),o||t||(n.textContent=r.stripHTML(a),r.show(n))),o)){var c=r.stripHTML(o);l.textContent=c,t||(n.textContent=c,i.textContent=c,r.show(n)),r.show(l)}}
2808({caption:i.attrs.caption,title:i.attrs.title,desc:i.attrs.desc}),function(e){if(!e||1!==Number(jetpackCarouselStrings.display_exif))return!1;var t=g.info.querySelector(".jp-carousel-image-meta");if(!t)return!1;var r="";for(var o in e){var a=e[o],n=jetpackCarouselStrings.meta_data||[];if(0!==parseFloat(a)&&a.length&&-1!==n.indexOf(o)){switch(o){case"focal_length":a+="mm";break;case"shutter_speed":a=E(a);break;case"aperture":a="f/"+a}r+="<li><h5>"+jetpackCarouselStrings[o]+"</h5>"+a+"</li>"}}var i=t.querySelector("ul.jp-carousel-image-exif");if(""!==r){if(!i){(i=document.createElement("ul")).className="jp-carousel-image-exif";var l=t.querySelector(".jp-carousel-title-and-caption");l&&l.nextSibling?t.insertBefore(i,l.nextSibling):t.insertBefore(i,t.firstChild)}i.innerHTML=r,i.style.removeProperty("display")}else i&&i.parentNode.removeChild(i)}(g.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 n=g.info.querySelector(".jp-carousel-download-text"),i=g.info.querySelector(".jp-carousel-image-download");n.innerHTML=t.applyReplacements(jetpackCarouselStrings.download_original,o),i.setAttribute("href",r),i.style.removeProperty("display")}(i),1===Number(jetpackCarouselStrings.display_comments)&&(a=g.slides[e].attrs.commentsOpened,n=g.info.querySelector("#jp-carousel-comment-form-container"),1===parseInt(a,10)?r.fadeIn(n):r.fadeOut(n),function(e){var t=e.attrs.attachmentId,a=g.info.querySelector(".jp-carousel-comments"),n=l[t];if(clearInterval(o),r.hide(g.info.querySelector("#jp-carousel-comments-loading")),n)return a.innerHTML=n.html,H(n.count),r.show(a),void(n.hasMore&&I()&&T(t,n.nextOffset));a.innerHTML="",r.hide(a),H(parseInt(e.attrs.commentsCount,10)||0),I()&&_(t)}(i),r.hide(g.info.querySelector("#jp-carousel-comment-post-results")));var u=g.info.querySelector(".jp-carousel-pagination");if(u&&g.slides.length>5){var d=e+1;u.innerHTML="<span>"+d+" / "+g.slides.length+"</span>"}jetpackCarouselStrings.stats&&g.isOpen&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?"+jetpackCarouselStrings.stats+"&post="+encodeURIComponent(s)+"&rand="+Math.random()),g.isOpen&&f(s),c="#jp-carousel-"+s,window.location.hash=c}function k(){document.body.style.overflow=a,document.documentElement.style.overflow=n,W(),y(),r.emitEvent(g.overlay,"jp_carousel.beforeClose"),window.scrollTo(window.scrollX||window.pageXOffset||0,i||0),g.isOpen=!1,e.destroy(),g.slides=[],l={},s={},g.currentSlide=void 0,g.gallery.innerHTML="",r.fadeOut(g.overlay,function(){r.emitEvent(g.overlay,"jp_carousel.afterClose")})}function q(e){if("object"!=typeof e&&(e={}),void 0===e.origFile)return"";if(void 0===e.origWidth||void 0===e.maxWidth)return e.origFile;if(!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=function(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}(e.largeFile,e.origWidth,r),a=parseInt(o[0],10),n=parseInt(o[1],10);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);var i=e.zoomHeadroom||1;if(i>1&&(e.maxWidth=e.maxWidth*i,e.maxHeight=e.maxHeight*i),a>=e.maxWidth||n>=e.maxHeight)return e.largeFile;if(r){if(-1===e.largeFile.lastIndexOf("?"))return e.largeFile;var l=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=e.maxWidth,e.origMaxHeight=e.maxHeight,l.searchParams.set("fit",e.origMaxWidth+","+e.origMaxHeight)),l.toString()}return e.origFile}function E(e){return e>=1?Math.round(10*e)/10+"s":"1/"+Math.round(1/e)+"s"}
2808function A(e){return!e.match(" ")&&e.match("_")?"":e}function I(){var e=g.info.querySelector(".jp-carousel-comments-wrapper");return!!e&&e.classList.contains("jp-carousel-show")}function H(e){var t=g.info.querySelector(".jp-carousel-icon-comments .jp-carousel-has-comments-indicator");t&&(e>0?(t.innerText=e,t.classList.add("jp-carousel-show")):t.classList.remove("jp-carousel-show"))}function T(e,t){clearInterval(o),o=setInterval(function(){g.container.scrollTop+150>window.innerHeight&&(clearInterval(o),_(e,t))},300)}function _(e,t,a){var n=void 0===t;if(clearInterval(o),e&&g.currentSlide&&g.currentSlide.attrs.attachmentId===e&&(!s[e]||a)){(!t||t<1)&&(t=0);var i=g.info.querySelector(".jp-carousel-comments"),c=g.info.querySelector("#jp-carousel-comments-loading");r.show(c),n&&(r.hide(i),i.innerHTML="");var u=new XMLHttpRequest;s[e]=u;var d=function(){return s[e]===u},m=jetpackCarouselStrings.ajaxurl+"?action=get_attachment_comments&nonce="+jetpackCarouselStrings.nonce+"&id="+e+"&offset="+t;u.open("GET",m),u.setRequestHeader("X-Requested-With","XMLHttpRequest");var p=function(){r.fadeIn(i),r.fadeOut(c)};u.onload=function(){if(d()&&(delete s[e],g.currentSlide&&g.currentSlide.attrs.attachmentId===e)){var o,a=u.status>=200&&u.status<300;try{o=JSON.parse(u.responseText)}catch{}if(a&&o&&Array.isArray(o)){n&&(i.innerHTML="");for(var m=0;m<o.length;m++){var h=o[m];if(!i.querySelector("#jp-carousel-comment-"+h.id)){var f=document.createElement("div");f.classList.add("jp-carousel-comment"),f.setAttribute("id","jp-carousel-comment-"+h.id),f.innerHTML='<div class="comment-gravatar">'+h.gravatar_markup+'</div><div class="comment-content"><div class="comment-author">'+h.author_markup+'</div><div class="comment-date">'+h.date_gmt+"</div>"+h.content+"</div>",i.appendChild(f)}}var v=o.length>=10,y=t+10;v&&T(e,y);var w=i.querySelectorAll(".jp-carousel-comment").length,S=Math.max(parseInt(g.currentSlide.attrs.commentsCount,10)||0,w);o.length>0&&(r.show(i),H(S)),l[e]={html:i.innerHTML,count:S,hasMore:v,nextOffset:y},r.hide(c)}else p()}},u.onerror=function(){d()&&(delete s[e],g.currentSlide&&g.currentSlide.attrs.attachmentId===e&&p())},u.send()}}function M(e){var t=e.attrs,r=e.el.querySelector("img");if(!r.hasAttribute("data-loaded"))if(r.setAttribute("itemprop","image"),r.setAttribute("data-loaded",1),t.previewImage&&t.previewImage!==t.src){r.src=t.previewImage,r.style.filter="blur(8px)";var o=new window.Image;o.addEventListener("load",function(){r.hasAttribute("data-zoom-loaded")||(r.src=t.src),r.style.filter=""},{once:!0}),o.addEventListener("error",function(){r.style.filter=""},{once:!0}),o.src=t.src}else r.src=t.src}function F(e){var t=e.attrs.originalElement;if(t)if(t.complete&&0!==t.naturalHeight)O(e,t);else{var r=function(){t.removeEventListener("error",o),O(e,t)},o=function(){t.removeEventListener("load",r)};t.addEventListener("load",r,{once:!0}),t.addEventListener("error",o,{once:!0})}}function O(e,r){var o=t.getBackgroundImage(r);o&&(e.backgroundImage=o,e.el.style.backgroundImage="url("+o+")",e.el.style.backgroundSize="cover",e.el.style.backgroundPosition="center")}function W(){g.commentField&&(g.commentField.value="")}function N(e,o){g.slides=[];var a={width:window.innerWidth,height:window.innerHeight-64};0!==o&&null!==e[o].getAttribute("data-gallery-src")&&((new Image).src=e[o].getAttribute("data-gallery-src")),Array.prototype.forEach.call(e,function(e,o){var n=r.closest(e,"a"),i=e.getAttribute("data-orig-file")||e.getAttribute("src-orig"),l=e.getAttribute("data-attachment-id")||e.getAttribute("data-id")||"0",s=document.querySelector('img[data-attachment-id="'+l+'"] + figcaption');s=s?s.innerHTML:e.getAttribute("data-image-caption");var c={originalElement:e,attachmentId:l,commentsOpened:e.getAttribute("data-comments-opened")||"0",commentsCount:e.getAttribute("data-comments-count")||"0",imageMeta:r.getJSONAttribute(e,"data-image-meta")||{},title:e.getAttribute("data-image-title")||"",desc:e.getAttribute("data-image-description")||"",largeFile:e.getAttribute("data-large-file")||"",origFile:i||"",thumbSize:{width:e.naturalWidth,height:e.naturalHeight},caption:s||"",permalink:n&&n.getAttribute("href"),src:i||e.getAttribute("src")||""},u=r.closest(e,".tiled-gallery-item"),d=u&&u.querySelector(".tiled-gallery-caption"),m=d&&d.innerHTML;m&&(c.caption=m);var p=function(e){var t=e.getAttribute("data-orig-size")||"";if(t){var r=t.split(",");return{width:parseInt(r[0],10),height:parseInt(r[1],10)}}return{width:e.getAttribute("data-original-width")||e.getAttribute("width")||void 0,height:e.getAttribute("data-original-height")||e.getAttribute("height")||void 0}}(e);if(c.origWidth=p.width||c.thumbSize.width,c.origHeight=p.height||c.thumbSize.height,"undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.generateImgSrc)c.src=wpcom.carousel.generateImgSrc(e,a);else{var h=function(e){return{origFile:c.src,origWidth:c.origWidth,origHeight:c.origHeight,maxWidth:a.width,maxHeight:a.height,largeFile:c.largeFile,zoomHeadroom:e}};c.zoomSrc=q(h(2)),c.src=q(h(1))}if(e.setAttribute("data-gallery-src",c.src),"0"!==c.attachmentId){c.title=t.texturize(c.title),c.desc=t.texturize(c.desc),c.caption=t.texturize(c.caption);var f=new Image,v=document.createElement("div");v.classList.add("swiper-slide"),v.setAttribute("itemprop","associatedMedia"),v.setAttribute("itemscope",""),v.setAttribute("itemtype","https://schema.org/ImageObject");var y=document.createElement("div");y.classList.add("swiper-zoom-container"),g.gallery.appendChild(v),v.appendChild(y),y.appendChild(f),v.setAttribute("data-attachment-id",c.attachmentId),v.setAttribute("data-permalink",c.permalink),v.setAttribute("data-orig-file",c.origFile),c.previewImage=e.currentSrc||e.getAttribute("src")||"";var w={el:v,attrs:c,index:o};g.slides.push(w)}})}function z(e,t){if(!window.JetpackSwiper){var o=document.querySelector("#jp-carousel-loading-overlay");r.show(o);var a=document.createElement("script");return a.id="jetpack-carousel-swiper-js",a.src=window.jetpackSwiperLibraryPath.url,a.async=!0,a.onload=function(){r.hide(o),R(e,t)},a.onerror=function(){r.hide(o)},void document.head.appendChild(a)}R(e,t)}function R(t,o){var c,u={imgSelector:".gallery-item [data-attachment-id], .tiled-gallery-item [data-attachment-id], img[data-attachment-id], img[data-id]",startIndex:0},d=r.getJSONAttribute(t,"data-carousel-extra");if(!d)return;const m=t.querySelectorAll(u.imgSelector);if(m.length&&(j(),!g.isOpen)){for(var p in g.isOpen=!0,a=getComputedStyle(document.body).overflow,document.body.style.overflow="hidden",n=getComputedStyle(document.documentElement).overflow,document.documentElement.style.overflow="hidden",i=window.scrollY||window.pageYOffset||0,g.container.setAttribute("data-carousel-extra",JSON.stringify(d)),h(["open","view_image"]),o||{})u[p]=o[p];-1===u.startIndex&&(u.startIndex=0),r.emitEvent(g.overlay,"jp_carousel.beforeOpen"),g.gallery.innerHTML="",l={},s={},g.overlay.style.opacity=1,g.overlay.style.display="block",N(m,u.startIndex),(e=new window.JetpackSwiper(".jp-carousel-swiper-container",{centeredSlides:!0,speed:r.prefersReducedMotion()?0:250,zoom:!0,loop:g.slides.length>1,enabled:g.slides.length>1,pagination:{el:".jp-swiper-pagination",clickable:!0},navigation:{nextEl:".jp-swiper-button-next",prevEl:".jp-swiper-button-prev"},initialSlide:u.startIndex,on:{init:function(){C(u.startIndex)}},preventClicks:!1,preventClicksPropagation:!1,preventInteractionOnTransition:!r.isTouch(),threshold:5})).on("slideChange",function(e){g.isOpen&&(C(e.realIndex),g.overlay.classList.remove("jp-carousel-hide-control
2808s"))}),e.on("zoomChange",function(e,t){t>1&&(function(e){if(e&&e.attrs.zoomSrc&&e.attrs.zoomSrc!==e.attrs.src){var t=e.el.querySelector("img");t&&!t.hasAttribute("data-zoom-loaded")&&(t.setAttribute("data-zoom-loaded",1),t.src=e.attrs.zoomSrc)}}(g.currentSlide),g.overlay.classList.add("jp-carousel-hide-controls")),1===t&&g.overlay.classList.remove("jp-carousel-hide-controls")}),e.on("doubleTap",function(e){if(clearTimeout(c),1===e.zoom.scale)var t=setTimeout(function(){g.overlay.classList.remove("jp-carousel-hide-controls"),clearTimeout(t)},150)}),e.on("tap",function(){e.zoom.scale>1&&(c=setTimeout(function(){g.overlay.classList.toggle("jp-carousel-hide-controls")},150))}),r.fadeIn(g.overlay,function(){r.emitEvent(g.overlay,"jp_carousel.afterOpen")})}}function P(e){if("click"!==e.type){if("keydown"===e.type){const t=document.activeElement.parentElement,r=t&&t.classList.contains("tiled-gallery__item");" "!==e.key&&"Enter"!==e.key||!r||$(e)}}else $(e)}function D(e){return(e||"").split("?")[0].replace(/\/$/,"")}function J(e){"A"===e.tagName&&(e=e.querySelector("img")||e);var t=e.parentElement,o=t?t.parentElement:null,a=null;if(o&&o.classList.contains("wp-block-image")?a=t.getAttribute("href"):t&&t.classList.contains("wp-block-image")&&t.querySelector(":scope > a")&&(a=t.querySelector(":scope > a").getAttribute("href")),a){var n=D(a),i=D(e.getAttribute("data-orig-file")),l=D(e.getAttribute("data-permalink"));if(n!==i&&n!==l)return!1}return!(t&&t.classList.contains("gallery-caption")||r.matches(t,"figcaption"))}function $(e){if(window.CSS&&window.CSS.supports&&window.CSS.supports("display","grid")){var t,o=e.target,a=r.closest(o,d);if(a){if(!(t=a)||!t.getAttribute("data-carousel-extra"))return;if(!J(o))return;document.documentElement.style.height="auto",e.preventDefault(),e.stopPropagation();var n=r.closest(o,p),i=Array.prototype.indexOf.call(a.querySelectorAll(p),n);z(a,{startIndex:i})}}}document.body.addEventListener("click",P),document.body.addEventListener("keydown",P),document.querySelectorAll(m+"img").forEach(function(e){J(e)&&S(e)}),1===Number(jetpackCarouselStrings.single_image_gallery)&&(L(),document.body.addEventListener("is.post-load",function(){L()})),window.addEventListener("hashchange",function(){var e=/jp-carousel-(\d+)/;if(window.location.hash&&e.test(window.location.hash)){if(window.location.hash!==c||!g.isOpen)if(window.location.hash&&g.gallery&&!g.isOpen&&history.back)history.back();else{c=window.location.hash;for(var t=window.location.hash.match(e),r=parseInt(t[1],10),o=document.querySelectorAll(d),a=0;a<o.length;a++){for(var n,i=o[a],l=i.querySelectorAll("img"),s=0;s<l.length;s++)if(parseInt(l[s].getAttribute("data-attachment-id"),10)===r||parseInt(l[s].getAttribute("data-id"),10)===r){n=s;break}if(void 0!==n){x(i,n);break}}}}else g.isOpen&&k()}),window.location.hash&&r.emitEvent(window,"hashchange")}"loading"!==document.readyState?o():document.addEventListener("DOMContentLoaded",o)}();;
2809/**
2810 * Observe how the user enters content into the comment form in order to determine whether it's a bot or not.
2811 *
2812 * Note that no actual input is being saved here, only counts and timings between events.
2813 */
2814
2815( function() {
2816	// Passive event listeners are guaranteed to never call e.preventDefault(),
2817	// but they're not supported in all browsers.  Use this feature detection
2818	// to determine whether they're available for use.
2819	var supportsPassive = false;
2820
2821	try {
2822		var opts = Object.defineProperty( {}, 'passive', {
2823			get : function() {
2824				supportsPassive = true;
2825			}
2826		} );
2827
2828		window.addEventListener( 'testPassive', null, opts );
2829		window.removeEventListener( 'testPassive', null, opts );
2830	} catch ( e ) {}
2831
2832	function init() {
2833		var input_begin = '';
2834
2835		var keydowns = {};
2836		var lastKeyup = null;
2837		var lastKeydown = null;
2838		var keypresses = [];
2839
2840		var modifierKeys = [];
2841		var correctionKeys = [];
2842
2843		var lastMouseup = null;
2844		var lastMousedown = null;
2845		var mouseclicks = [];
2846		var mouseclickCoordinates = [];
2847
2848		var mousemoveTimer = null;
2849		var lastMousemoveX = null;
2850		var lastMousemoveY = null;
2851		var lastMousemoveTime = null;
2852		var mousemoveStart = null;
2853		var mousemoves = [];
2854		var intervalsBetweenMousemovesAndClicks = [];
2855
2856		var touchmoveCountTimer = null;
2857		var touchmoveCount = 0;
2858
2859		var lastTouchEnd = null;
2860		var lastTouchStart = null;
2861		var touchEvents = [];
2862
2863		var scrollCountTimer = null;
2864		var scrollCount = 0;
2865
2866		var correctionKeyCodes = [ 'Backspace', 'Delete', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Home', 'End', 'PageUp', 'PageDown' ];
2867		var modifierKeyCodes = [ 'Shift', 'CapsLock' ];
2868
2869		var forms = document.querySelectorAll( 'form[method=post]' );
2870
2871		for ( var i = 0; i < forms.length; i++ ) {
2872			var form = forms[i];
2873
2874			var formAction = form.getAttribute( 'action' );
2875
2876			// Ignore forms that POST directly to other domains; these could be things like payment forms.
2877			if ( formAction ) {
2878				// Check that the form is posting to an external URL, not a path.
2879				if ( formAction.indexOf( 'http://' ) == 0 || formAction.indexOf( 'https://' ) == 0 ) {
2880					if ( formAction.indexOf( 'http://' + window.location.hostname + '/' ) != 0 && formAction.indexOf( 'https://' + window.location.hostname + '/' ) != 0 ) {
2881						continue;
2882					}
2883				}
2884			}
2885
2886			form.addEventListener( 'submit', function () {
2887				var ak_bkp = prepare_array_for_request( keypresses );
2888				var ak_bmc = prepare_array_for_request( mouseclicks );
2889				var ak_bte = prepare_array_for_request( touchEvents );
2890				var ak_bmm = prepare_array_for_request( mousemoves );
2891				var ak_bcc = prepare_array_for_request( mouseclickCoordinates );
2892				var ak_bibmac = intervalsBetweenMousemovesAndClicks.slice( 0, 100 ).join( ';' );
2893
2894				var input_fields = {
2895					// When did the user begin entering any input?
2896					'bib': input_begin,
2897
2898					// When was the form submitted?
2899					'bfs': Date.now(),
2900
2901					// How many keypresses did they make?
2902					'bkpc': keypresses.length,
2903
2904					// How quickly did they press a sample of keys, and how long between them?
2905					'bkp': ak_bkp,
2906
2907					// How quickly did they click the mouse, and how long between clicks?
2908					'bmc': ak_bmc,
2909
2910					// How many mouseclicks did they make?
2911					'bmcc': mouseclicks.length,
2912
2913					// When did they press modifier keys (like Shift or Capslock)?
2914					'bmk': modifierKeys.join( ';' ),
2915
2916					// When did they correct themselves? e.g., press Backspace, or use the arrow keys to move the cursor back
2917					'bck': correctionKeys.join( ';' ),
2918
2919					// How many times did they move the mouse?
2920					'bmmc': mousemoves.length,
2921
2922					// How many times did they move around using a touchscreen?
2923					'btmc': touchmoveCount,
2924
2925					// How many times did they scroll?
2926					'bsc': scrollCount,
2927
2928					// How quickly did they perform touch events, and how long between them?
2929					'bte': ak_bte,
2930
2931					// How many touch events were there?
2932					'btec' : touchEvents.length,
2933
2934					// How quickly did they move the mouse, and how long between moves?
2935					'bmm' : ak_bmm,
2936
2937					// Click coordinates
2938					'bcc' : ak_bcc,
2939
2940					// Milliseconds between last mouse movement and each click
2941					'bibmac' : ak_bibmac
2942				};
2943
2944				var akismet_field_prefix = 'ak_';
2945
2946				if ( this.getElementsByClassName ) {
2947					// Check to see if we've used an alternate field name prefix. We store this as an attribute of the container around some of the Akismet fields.
2948					var possible_akismet_containers = this.getElementsByClassName( 'akismet-fields-container' );
2949
2950					for ( var containerIndex = 0; containerIndex < possible_akismet_containers.length; containerIndex++ ) {
2951						var container = possible_akismet_containers.item( containerIndex );
2952
2953						if ( container.getAttribute( 'data-prefix' ) ) {
2954							akismet_field_prefix = container.getAttribute( 'data-prefix' );
2955							break;
2956						}
2957					}
2958				}
2959
2960				for ( var field_name in input_fields ) {
2961					var field = document.createElement( 'input' );
2962					field.setAttribute( 'type', 'hidden' );
2963					field.setAttribute( 'name', akismet_field_prefix + field_name );
2964					field.setAttribute( 'value', input_fields[ field_name ] );
2965					this.appendChild( field );
2966				}
2967			}, supportsPassive ? { passive: true } : false  );
2968
2969			form.addEventListener( 'keydown', function ( e ) {
2970				// If you hold a key down, some browsers send multiple keydown events in a row.
2971				// Ignore any keydown events for a key that hasn't come back up yet.
2972				if ( e.key in keydowns ) {
2973					return;
2974				}
2975
2976				var keydownTime = ( new Date() ).getTime();
2977				keydowns[ e.key ] = [ keydownTime ];
2978
2979				if ( ! input_begin ) {
2980					input_begin = keydownTime;
2981				}
2982
2983				// In some situations, we don't want to record an interval since the last keypress -- for example,
2984				// on the first keypress, or on a keypress after focus has changed to another element. Normally,
2985				// we want to record the time between the last keyup and this keydown. But if they press a
2986				// key while already pressing a key, we want to record the time between the two keydowns.
2987
2988				var lastKeyEvent = Math.max( lastKeydown, lastKeyup );
2989
2990				if ( lastKeyEvent ) {
2991					keydowns[ e.key ].push( keydownTime - lastKeyEvent );
2992				}
2993
2994				lastKeydown = keydownTime;
2995			}, supportsPassive ? { passive: true } : false  );
2996
2997			form.addEventListener( 'keyup', function ( e ) {
2998				if ( ! ( e.key in keydowns ) ) {
2999					// This key was pressed before this script was loaded, or a mouseclick happened during the keypress, or...
3000					return;
3001				}
3002
3003				var keyupTime = ( new Date() ).getTime();
3004
3005				if ( 'TEXTAREA' === e.target.nodeName || 'INPUT' === e.target.nodeName ) {
3006					if ( -1 !== modifierKeyCodes.indexOf( e.key ) ) {
3007						modifierKeys.push( keypresses.length - 1 );
3008					} else if ( -1 !== correctionKeyCodes.indexOf( e.key ) ) {
3009						correctionKeys.push( keypresses.length - 1 );
3010					} else {
3011						// ^ Don't record timings for keys like Shift or backspace, since they
3012						// typically get held down for longer than regular typing.
3013
3014						var keydownTime = keydowns[ e.key ][0];
3015
3016						var keypress = [];
3017
3018						// Keypress duration.
3019						keypress.push( keyupTime - keydownTime );
3020
3021						// Amount of time between this keypress and the previous keypress.
3022						if ( keydowns[ e.key ].length > 1 ) {
3023							keypress.push( keydowns[ e.key ][1] );
3024						}
3025
3026						keypresses.push( keypress );
3027					}
3028				}
3029
3030				delete keydowns[ e.key ];
3031
3032				lastKeyup = keyupTime;
3033			}, supportsPassive ? { passive: true } : false  );
3034
3035			form.addEventListener( "focusin", function ( e ) {
3036				lastKeydown = null;
3037				lastKeyup = null;
3038				keydowns = {};
3039			}, supportsPassive ? { passive: true } : false  );
3040
3041			form.addEventListener( "focusout", function ( e ) {
3042				lastKeydown = null;
3043				lastKeyup = null;
3044				keydowns = {};
3045			}, supportsPassive ? { passive: true } : false  );
3046		}
3047
3048		document.addEventListener( 'mousedown', function ( e ) {
3049			lastMousedown = ( new Date() ).getTime();
3050
3051			if ( lastMousemoveTime ) {
3052				intervalsBetweenMousemovesAndClicks.push( lastMousedown - lastMousemoveTime );
3053			}
3054
3055			var mouseclickCoordinate = [];
3056
3057			var rect = e.target.getBoundingClientRect();
3058			var relativeX = e.clientX - rect.left;
3059			var relativeY = e.clientY - rect.top;
3060
3061			// Pixel offset of the click within the target element.
3062			mouseclickCoordinate.push( Math.round( relativeX ) );
3063			mouseclickCoordinate.push( Math.round( relativeY ) );
3064
3065			// Percentage offset of the click within the target element.
3066			mouseclickCoordinate.push( rect.width > 0 ? Math.round( relativeX / rect.width * 100 ) : 0 );
3067			mouseclickCoordinate.push( rect.height > 0 ? Math.round( relativeY / rect.height * 100 ) : 0 );
3068
3069			mouseclickCoordinates.push( mouseclickCoordinate );
3070		}, supportsPassive ? { passive: true } : false  );
3071
3072		document.addEventListener( 'mouseup', function ( e ) {
3073			if ( ! lastMousedown ) {
3074				// If the mousedown happened before this script was loaded, but the mouseup happened after...
3075				return;
3076			}
3077
3078			var now = ( new Date() ).getTime();
3079
3080			var mouseclick = [];
3081			mouseclick.push( now - lastMousedown );
3082
3083			if ( lastMouseup ) {
3084				mouseclick.push( lastMousedown - lastMouseup );
3085			}
3086
3087			mouseclicks.push( mouseclick );
3088
3089			lastMouseup = now;
3090
3091			// If the mouse has been clicked, don't record this time as an interval between keypresses.
3092			lastKeydown = null;
3093			lastKeyup = null;
3094			keydowns = {};
3095		}, supportsPassive ? { passive: true } : false  );
3096
3097		document.addEventListener( 'mousemove', function ( e ) {
3098			lastMousemoveTime = ( new Date() ).getTime();
3099
3100			if ( mousemoveTimer ) {
3101				clearTimeout( mousemoveTimer );
3102				mousemoveTimer = null;
3103			}
3104			else {
3105				mousemoveStart = lastMousemoveTime;
3106				lastMousemoveX = e.offsetX;
3107				lastMousemoveY = e.offsetY;
3108			}
3109
3110			mousemoveTimer = setTimeout( function ( theEvent, originalMousemoveStart ) {
3111				var now = ( new Date() ).getTime() - 500; // To account for the timer delay.
3112
3113				var mousemove = [];
3114				mousemove.push( now - originalMousemoveStart );
3115				mousemove.push(
3116					Math.round(
3117						Math.sqrt(
3118							Math.pow( theEvent.offsetX - lastMousemoveX, 2 ) +
3119							Math.pow( theEvent.offsetY - lastMousemoveY, 2 )
3120						)
3121					)
3122				);
3123
3124				if ( mousemove[1] > 0 ) {
3125					// If there was no measurable distance, then it wasn't really a move.
3126					mousemoves.push( mousemove );
3127				}
3128
3129				mousemoveStart = null;
3130				mousemoveTimer = null;
3131			}, 500, e, mousemoveStart );
3132		}, supportsPassive ? { passive: true } : false  );
3133
3134		document.addEventListener( 'touchmove', function ( e ) {
3135			if ( touchmoveCountTimer ) {
3136				clearTimeout( touchmoveCountTimer );
3137			}
3138
3139			touchmoveCountTimer = setTimeout( function () {
3140				touchmoveCount++;
3141			}, 500 );
3142		}, supportsPassive ? { passive: true } : false );
3143
3144		document.addEventListener( 'touchstart', function ( e ) {
3145			lastTouchStart = ( new Date() ).getTime();
3146		}, supportsPassive ? { passive: true } : false );
3147
3148		document.addEventListener( 'touchend', function ( e ) {
3149			if ( ! lastTouchStart ) {
3150				// If the touchstart happened before this script was loaded, but the touchend happened after...
3151				return;
3152			}
3153
3154			var now = ( new Date() ).getTime();
3155
3156			var touchEvent = [];
3157			touchEvent.push( now - lastTouchStart );
3158
3159			if ( lastTouchEnd ) {
3160				touchEvent.push( lastTouchStart - lastTouchEnd );
3161			}
3162
3163			touchEvents.push( touchEvent );
3164
3165			lastTouchEnd = now;
3166
3167			// Don't record this time as an interval between keypresses.
3168			lastKeydown = null;
3169			lastKeyup = null;
3170			keydowns = {};
3171		}, supportsPassive ? { passive: true } : false );
3172
3173		document.addEventListener( 'scroll', function ( e ) {
3174			if ( scrollCountTimer ) {
3175				clearTimeout( scrollCountTimer );
3176			}
3177
3178			scrollCountTimer = setTimeout( function () {
3179				scrollCount++;
3180			}, 500 );
3181		}, supportsPassive ? { passive: true } : false );
3182	}
3183
3184	/**
3185	 * For the timing/coordinate data that is collected, don't send more than `limit` data points in the request.
3186	 * Choose a random slice and send those, with each batch separated by semicolons and the items in each batch
3187	 * separated by commas.
3188	 */
3189	function prepare_array_for_request( a, limit ) {
3190		if ( ! limit ) {
3191			limit = 100;
3192		}
3193
3194		var rv = '';
3195
3196		if ( a.length > 0 ) {
3197			var random_starting_point = Math.max( 0, Math.floor( Math.random() * a.length - limit ) );
3198
3199			for ( var i = 0; i < limit && i < a.length; i++ ) {
3200				var entry = a[ random_starting_point + i ];
3201				rv += entry.join( ',' ) + ';';
3202			}
3203		}
3204
3205		return rv;
3206	}
3207
3208	if ( document.readyState !== 'loading' ) {
3209		init();
3210	} else {
3211		document.addEventListener( 'DOMContentLoaded', init );
3212	}
3213})();;
3214( function () {
3215	'use strict';
3216
3217	if ( typeof window.wpcom === 'undefined' ) {
3218		window.wpcom = {};
3219	}
3220
3221	if ( window.wpcom.carousel ) {
3222		return;
3223	}
3224
3225	var prebuilt_widths = jetpackCarouselStrings.widths;
3226	var pageviews_stats_args = jetpackCarouselStrings.stats_query_args;
3227
3228	var findFirstLargeEnoughWidth = function ( original_w, original_h, dest_w, dest_h ) {
3229		var inverse_ratio = original_h / original_w;
3230
3231		for ( var i = 0; i < prebuilt_widths.length; ++i ) {
3232			if ( prebuilt_widths[ i ] >= dest_w || prebuilt_widths[ i ] * inverse_ratio >= dest_h ) {
3233				return prebuilt_widths[ i ];
3234			}
3235		}
3236
3237		return original_w;
3238	};
3239
3240	var removeResizeFromImageURL = function ( url ) {
3241		return removeArgFromURL( url, 'resize' );
3242	};
3243
3244	var removeArgFromURL = function ( url, arg ) {
3245		var re = new RegExp( '[\\?&]' + arg + '(=[^?&]+)?' );
3246		if ( url.match( re ) ) {
3247			return url.replace( re, '' );
3248		}
3249		return url;
3250	};
3251
3252	var addWidthToImageURL = function ( url, width ) {
3253		width = parseInt( width, 10 );
3254		// Give devices with a higher devicePixelRatio higher-res images (Retina display = 2, Android phones = 1.5, etc)
3255		if ( 'undefined' !== typeof window.devicePixelRatio && window.devicePixelRatio > 1 ) {
3256			width = Math.round( width * window.devicePixelRatio );
3257		}
3258		url = addArgToURL( url, 'w', width );
3259		url = addArgToURL( url, 'h', '' );
3260		return url;
3261	};
3262
3263	var addArgToURL = function ( url, arg, value ) {
3264		var re = new RegExp( arg + '=[^?&]+' );
3265		if ( url.match( re ) ) {
3266			return url.replace( re, arg + '=' + value );
3267		} else {
3268			var divider = url.indexOf( '?' ) !== -1 ? '&' : '?';
3269			return url + divider + arg + '=' + value;
3270		}
3271	};
3272
3273	var stat = function ( names ) {
3274		if ( typeof names !== 'string' ) {
3275			names = names.join( ',' );
3276		}
3277
3278		new Image().src = window.location.protocol +
3279			'//pixel.wp.com/g.gif?v=wpcom-no-pv' +
3280			'&x_carousel=' + names +
3281			'&baba=' + Math.random();
3282	};
3283
3284	var lastTrackedPostId = null;
3285
3286	var pageview = function ( post_id ) {
3287		// Prevent duplicate tracking of the same post during slide transitions
3288		if ( post_id === lastTrackedPostId ) {
3289			return;
3290		}
3291
3292		lastTrackedPostId = post_id;
3293
3294		new Image().src = window.location.protocol +
3295			'//pixel.wp.com/g.gif?host=' + encodeURIComponent( window.location.host ) +
3296			'&ref=' + encodeURIComponent( document.referrer ) +
3297			'&rand=' + Math.random() +
3298			'&' + pageviews_stats_args +
3299			'&post=' + encodeURIComponent( post_id );
3300	};
3301
3302	var generateImgSrc = function ( srcItem, max ) {
3303		var origSize = srcItem.getAttribute( 'data-orig-size' ) || '';
3304
3305		var src = srcItem.getAttribute( 'src' ) || srcItem.getAttribute( 'original' ) || srcItem.getAttribute( 'data-original' ) || srcItem.getAttribute( 'data-lazy-src' );
3306		if ( src.indexOf( 'imgpress' ) !== -1 ) {
3307			src = srcItem.getAttribute( 'data-orig-file' );
3308		}
3309		// Square/Circle galleries use a resize param that needs to be removed.
3310		src = removeResizeFromImageURL( src );
3311		src = addWidthToImageURL(
3312			src,
3313			findFirstLargeEnoughWidth( origSize.width, origSize.height, max.width, max.height )
3314		);
3315
3316		return src;
3317	};
3318
3319	window.wpcom.carousel = {
3320		findFirstLargeEnoughWidth: findFirstLargeEnoughWidth,
3321		removeResizeFromImageURL: removeResizeFromImageURL,
3322		addWidthToImageURL: addWidthToImageURL,
3323		stat: stat,
3324		pageview: pageview,
3325		generateImgSrc: generateImgSrc
3326	};
3327
3328} )();
3329;
3330!function(){var e=document.currentScript;function t(t){var n=document.createElement("script"),o=e||document.getElementsByTagName("script")[0];n.setAttribute("async",!0),n.setAttribute("src",t),o.parentNode.insertBefore(n,o)}function n(e,t){return Element.prototype.matches?e.matches(t):Element.prototype.msMatchesSelector?e.msMatchesSelector(t):void 0}function o(e,t){if(e.closest)return e.closest(t);var o=e;do{if(n(o,t))return o;o=o.parentElement||o.parentNode}while(null!==o&&1===o.nodeType);return null}function i(e,t){for(var n=0;n<e.length;n++)t(e[n],n,e)}var r,s=".sharing-hidden .inner",a="data-sharing-more-button-id";function c(e){this.button=e,this.pane=o(e,"div").querySelector(s),this.openedBy=null,this.recentlyOpenedByHover=!1,c.instances.push(this),this.pane.setAttribute(a,c.instances.length-1),this.attachHandlers()}if(c.instances=[],c.hoverOpenDelay=200,c.recentOpenDelay=400,c.hoverCloseDelay=300,c.instantiateOrReuse=function(e){var t=o(e,"div").querySelector(s),n=t&&t.getAttribute(a),i=c.instances[n];return i||new c(e)},c.getButtonInstanceFromPane=function(e){var t=e&&e.getAttribute(a);return c.instances[t]},c.closeAll=function(){for(var e=0;e<c.instances.length;e++)c.instances[e].close()},c.prototype.open=function(){var e,t,n=[0,0];function o(e){var t=e.getBoundingClientRect();return[t.left+(window.scrollX||window.pageXOffset||0),t.top+(window.scrollY||window.pageYOffset||0)]}function i(e,t){return parseInt(getComputedStyle(e).getPropertyValue(t)||0)}for(e=o(this.button),t=this.button.offsetParent||document.documentElement;t&&(t===document.body||t===document.documentElement)&&"static"===getComputedStyle(t).getPropertyValue("position");)t=t.parentNode;t&&t!==this.button&&1===t.nodeType&&(n=[(n=o(t))[0]+i(t,"border-left-width"),n[1]+i(t,"border-top-width")]);var r,s=e[0]-n[0]-i(this.button,"margin-left"),a=e[1]-n[1]-i(this.button,"margin-top");this.pane.style.left=s+"px",this.pane.style.top=a+this.button.offsetHeight+3+"px",(r=this.pane)&&r.style.removeProperty("display")},c.prototype.close=function(){var e;(e=this.pane)&&(e.style.display="none"),this.openedBy=null},c.prototype.toggle=function(){var e;(e=this.pane)&&"none"!==e.style.display?this.close():this.open()}
3330,c.prototype.nonHoverOpen=function(){clearTimeout(this.openTimer),clearTimeout(this.closeTimer),this.recentlyOpenedByHover?(this.recentlyOpenedByHover=!1,clearTimeout(this.hoverOpenTimer),this.open()):this.toggle()},c.prototype.resetCloseTimer=function(){clearTimeout(this.closeTimer),this.closeTimer=setTimeout(this.close.bind(this),c.hoverCloseDelay)},c.prototype.attachHandlers=function(){this.buttonClick=function(e){e.preventDefault(),e.stopPropagation(),this.openedBy="click",this.nonHoverOpen()}.bind(this),this.buttonKeydown=function(e){13!==e.keyCode&&32!==e.keyCode||(e.preventDefault(),e.stopPropagation(),this.openedBy="keydown",this.nonHoverOpen())}.bind(this),this.buttonEnter=function(){this.openedBy||(this.openTimer=setTimeout(function(){this.open(),this.openedBy="hover",this.recentlyOpenedByHover=!0,this.hoverOpenTimer=setTimeout(function(){this.recentlyOpenedByHover=!1}.bind(this),c.recentOpenDelay)}.bind(this),c.hoverOpenDelay)),clearTimeout(this.closeTimer)}.bind(this),this.buttonLeave=function(){"hover"===this.openedBy&&this.resetCloseTimer(),clearTimeout(this.openTimer)}.bind(this),this.paneEnter=function(){clearTimeout(this.closeTimer)}.bind(this),this.paneLeave=function(){"hover"===this.openedBy&&this.resetCloseTimer()}.bind(this),this.documentClick=function(){this.close()}.bind(this),this.button.addEventListener("click",this.buttonClick),this.button.addEventListener("keydown",this.buttonKeydown),document.addEventListener("click",this.documentClick),void 0===document.ontouchstart&&(this.button.addEventListener("mouseenter",this.buttonEnter),this.button.addEventListener("mouseleave",this.buttonLeave),this.pane.addEventListener("mouseenter",this.paneEnter),this.pane.addEventListener("mouseleave",this.paneLeave))},window.sharing_js_options&&window.sharing_js_options.counts){var u={done_urls:[],get_counts:function(){var e,n,o,i,r;if("undefined"!=typeof WPCOM_sharing_counts)for(e in WPCOM_sharing_counts)if(o=WPCOM_sharing_counts[e],void 0===u.done_urls[o]){for(i in n={pinterest:[window.location.protocol+"//api.pinterest.com/v1/urls/count.json?callback=WPCOMSharing.update_pinterest_count&url="+encodeURIComponent(e)]})if(document.querySelector("a[data-shared=sharing-"+i+"-"+o+"]")){for(;r=n[i].pop();)t(r);window.sharing_js_options.is_stats_active&&u.bump_sharing_count_stat(i)}u.done_urls[o]=!0}},update_pinterest_count:function(e){void 0!==e.count&&1*e.count>0&&u.inject_share_count("sharing-pinterest-"+WPCOM_sharing_counts[e.url],e.count)},inject_share_count:function(e,t){i(document.querySelectorAll("a[data-shared="+e+"] > span"),function(e){var n,o=e.querySelector(".share-count");(n=o)&&n.parentNode&&n.parentNode.removeChild(n);var i=document.createElement("span");i.className="share-count",i.textContent=u.format_count(t),e.appendChild(i)})},format_count:function(e){return e<1e3?e:e>=1e3&&e<1e4?String(e).substring(0,1)+"K+":"10K+"},bump_sharing_count_stat:function(e){(new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom-no-pv&x_sharing-count-request="+e+"&r="+Math.random()}};window.WPCOMSharing=u}function d(e,t){e.setAttribute("jetpack-share-click-count",t)}function l(e){var t=e.getAttribute("jetpack-share-click-count");return null===t?0:parseInt(t,10)}function h(e,t){var n,o=new XMLHttpRequest;o.open("POST",e,!0),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),o.setRequestHeader("x-requested-with","XMLHttpRequest"),o.send((n=t,(encodeURIComponent("email-share-nonce")+"="+encodeURIComponent(n)).replace(/%20/g,"+")))}function p(){m()}function m(){window.WPCOMSharing&&window.WPCOMSharing.get_counts(),i(document.querySelectorAll(".sharedaddy a"),function(e){var t=e.getAttribute("href");t&&-1!==t.indexOf("share=")&&-1===t.indexOf("&nb=1")&&e.setAttribute("href",t+"&nb=1")}),i(document.querySelectorAll(".sharedaddy a.sharing-anchor"),function(e){c.instantiateOrReuse(e)}),void 0!==document.ontouchstart&&document.body.classList.add("jp-sharing-input-touch"),i(document.querySelectorAll(".sharedaddy ul"),function(e){"true"!==e.getAttribute("data-sharing-events-added")&&(e.setAttribute("data-sharing-events-added","true"),i(e.querySelectorAll("a.share-print"),function(e){e.addEventListener("click",function(t){t.preventDefault(),t.stopPropagation();var n=e.getAttribute("href")||"",i=function(){if(-1===n.indexOf("#print")){var e=(new Date).getTime();t=e,o=n,(i=document.createElement("iframe")).setAttribute("style","position:fixed; top:100; left:100; height:1px; width:1px; border:none;"),i.setAttribute("id","printFrame-"+t),i.setAttribute("name",i.getAttribute("id")),i.setAttribute("src",o),i.setAttribute("onload",'frames["printFrame-'+t+'"].focus();frames["printFrame-'+t+'"].print();'),document.body.appendChild(i)}else window.print();var t,o,i}
3330,r=o(e,s);if(r){var a=c.getButtonInstanceFromPane(r);a&&(a.close(),i())}else i()})}),i(e.querySelectorAll("a.share-press-this"),function(e){var t="wp-press-this-"+Math.random().toString(36).slice(2);e.addEventListener("click",function(n){n.preventDefault(),n.stopPropagation();var o="";if(window.getSelection?o=window.getSelection():document.getSelection?o=document.getSelection():document.selection&&(o=document.selection.createRange().text),o){var i=e.getAttribute("href");e.setAttribute("href",i+"&sel="+encodeURI(o))}window.open(e.getAttribute("href"),t,"toolbar=0,resizable=1,scrollbars=1,status=1,width=720,height=570")||(document.location.href=e.getAttribute("href"))})}),i(e.querySelectorAll("a.share-email"),function(t){d(t,0);var n,o,r=t.getAttribute("data-email-share-nonce"),s=t.getAttribute("data-email-share-track-url");r&&s&&(n=s,o=window.location.protocol+"//"+window.location.hostname+"/",0===String(n).indexOf(o))&&t.addEventListener("click",function(){var n;d(n=t,l(n)+1),l(t)>2&&function(e,t){var n=t.parentElement;if(n.classList.contains("sd-content")){i(n.querySelectorAll(".share-email-error"),function(e){e.parentElement.removeChild(e)});var o=document.createElement("div");o.className="share-email-error";var r=document.createElement("h6");r.className="share-email-error-title",r.innerText=e.getAttribute("data-email-share-error-title"),o.appendChild(r);var s=document.createElement("p");s.className="share-email-error-text",s.innerText=e.getAttribute("data-email-share-error-text"),o.appendChild(s),n.appendChild(o)}}(t,e),h(s,r)})}))}),i(document.querySelectorAll("li.share-email, li.share-custom a.sharing-anchor"),function(e){e.classList.add("share-service-visible")})}"loading"!==document.readyState?p():document.addEventListener("DOMContentLoaded",p),document.body.addEventListener("is.post-load",m);var f={};!0!==window.WPCOM_sharing_popups_bound&&(document.body.addEventListener("click",function(e){var t=e.target;if(t&&1===t.nodeType){var n=function(e){if("A"===e.nodeName)return e;var t=e.parentNode;return t&&"A"===t.nodeName?t:null}(t);if(n){var o=function(e){var t=window.WPCOM_sharing_popups;if(!t)return null;for(var n="share-",o=(e.getAttribute("class")||"").split(/\s+/),i=0;i<o.length;i++)if(0===o[i].indexOf(n)){var r=o[i].slice(6);if("string"==typeof t[r])return r}return null}(n);o&&(e.preventDefault(),r&&r.close(),r=window.open(n.getAttribute("href"),function(e){return"string"!=typeof f[e]&&(f[e]="wpcom"+e+"-"+Math.random().toString(36).slice(2)),f[e]}(o),window.WPCOM_sharing_popups[o]))}}}),window.WPCOM_sharing_popups_bound=!0)}();;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.