var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(b){var a=0;return function(){return a<b.length?{done:!1,value:b[a++]}:{done:!0}}};$jscomp.arrayIterator=function(b){return{next:$jscomp.arrayIteratorImpl(b)}};$jscomp.makeIterator=function(b){var a="undefined"!=typeof Symbol&&Symbol.iterator&&b[Symbol.iterator];return a?a.call(b):$jscomp.arrayIterator(b)};var tdReadingProgressBar={};jQuery(window).on("load",function(){tdReadingProgressBar.init()});
(function(){tdReadingProgressBar={items:[],item:function(){this.barPosition=this.blockUid="";this._is_initialized=!1},init:function(){tdReadingProgressBar.items=[];this._is_running=!1},_initialize_item:function(b){!0!==b._is_initialized&&(b._is_initialized=!0)},createFixedBar:function(b,a,c){c=void 0===c?0:c;var f=b.barPosition,d=jQuery("#td-srp-fixed-wrap"),g=jQuery(".td-srp-"+f+'[data-article-index="'+a+'"]');d.length||(jQuery("body").prepend('<div id="td-srp-fixed-wrap"></div>'),d=jQuery("#td-srp-fixed-wrap"));
g.length||d.append('<div id="'+b.blockUid+'_b" class="td-srp-bar td-srp-'+f+'" data-article-index="'+a+'"><div class="td-srp-bar-fill" '+(0<c?'style="width:'+c+'%"':"")+"></div></div>")},calculateBarsFill:function(){var b=tdReadingProgressBar.items;if(b.length){var a=function(b,n){var a=this,c;return function(q){for(var d=[],e=0;e<arguments.length;++e)d[e-0]=arguments[e];clearTimeout(c);c=setTimeout(function(){b.apply(a,d)},n)}},c=jQuery(window),f=jQuery("#wpadminbar"),d=[],g=jQuery(".tdc-content-wrap").find("article");
g.length&&d.push(jQuery(g[0]));(new MutationObserver(function(b){b=$jscomp.makeIterator(b);for(var a=b.next();!a.done;a=b.next())if(a=a.value,"childList"===a.type){var c=a.addedNodes;if(c.length){a={};c=$jscomp.makeIterator(c);for(var k=c.next();!k.done;a={$jscomp$loop$prop$addedNode$4:a.$jscomp$loop$prop$addedNode$4},k=c.next())if(a.$jscomp$loop$prop$addedNode$4=k.value,a.$jscomp$loop$prop$addedNode$4.classList.contains("tdb-infinte-post-iframe")){var f=d.push(jQuery(a.$jscomp$loop$prop$addedNode$4))-
1;jQuery(a.$jscomp$loop$prop$addedNode$4).on("load",function(a){return function(){jQuery(a.$jscomp$loop$prop$addedNode$4).contents().find(".td-srp-inline").attr("data-article-index",f)}}(a))}}}})).observe(document.querySelector(".tdc-content-wrap"),{childList:!0});c.on("resize",a(function(){var g=c.height(),n=f.length?782<c.width()?f.outerHeight():0:0;c.on("scroll",a(function(){var a=c.scrollTop(),f=a+g;b.forEach(function(b){var c=b.barPosition;d.forEach(function(e,d){var l=Math.floor(e.offset().top)-
n,k=e.outerHeight(),m=l+k;"top"!==c&&"bottom"!==c||tdReadingProgressBar.createFixedBar(b,d);var p=jQuery('.td-srp-bar[data-article-index="'+d+'"] .td-srp-bar-fill'),h;e.hasClass("tdb-infinte-post-iframe")&&(h=e.contents().find('.td-srp-inline[data-article-index="'+d+'"] .td-srp-bar-fill'));a<=l&&m<=f||a>=l&&m<=f&&m>=a?(p.css("width","100%"),"undefined"!==typeof h&&h.css("width","100%")):a>=l&&m>=a?(e=Math.floor((a-l)/(k-g)*100),97<=e&&(e=100),p.css("width",e+"%"),"undefined"!==typeof h&&h.css("width",
e+"%")):(p.css("width","0"),"undefined"!==typeof h&&h.css("width","0"))})})},50));c.scroll()},100));c.resize()}},addItem:function(b){if("undefined"===typeof b.blockUid)throw"item.uid is not defined";tdReadingProgressBar.items.push(b);tdReadingProgressBar._initialize_item(b)},deleteItem:function(b){for(var a=0;a<tdReadingProgressBar.items.length;a++)if(tdReadingProgressBar.items[a].blockUid===b)return jQuery("#"+tdReadingProgressBar.items[a].blockUid+"_b").remove(),tdReadingProgressBar.items.splice(a,
1),!0;return!1},resetItems:function(){tdReadingProgressBar.items=[]}}})();
