var tdbTOC={};jQuery().ready(function(){tdbTOC.init()});
(function(){tdbTOC={items:[],item:function(){this.blockObj=this.uid="";this.tocLinks=[];this.headers=[];this.activeLink=this.activeHeader=void 0;this.smoothScroll=!0;this.scrollOffset=0;this.scrollDuration=500;this.activeHighlight=!0;this._is_initialized=this._is_updating=!1},init:function(){tdbTOC.items=[];this._is_running=!1},addItem:function(a){if("undefined"===typeof a.uid)throw"item.uid is not defined";tdbTOC.items.push(a);tdbTOC._initialize_item(a)},deleteItem:function(a){for(var c=0;c<tdbTOC.items.length;c++)if(tdbTOC.items[c].uid===
a)return tdbTOC.items.splice(c,1),!0;return!1},resetItems:function(){tdbTOC.items=[]},manageSmoothScroll:function(a){if(a.smoothScroll){var c=jQuery("html, body");jQuery(window);var f=jQuery("body");a.blockObj.on("click","a",function(g){g.preventDefault();a._is_updating=!0;g=jQuery(this).attr("href");var d=tdViewport.getCurrentIntervalIndex(),b=20,e=f.hasClass("admin-bar")?0!==d?32:46:0;if(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$/.test(a.scrollOffset)){var h=
JSON.parse(atob(a.scrollOffset));switch(d){case 0:b="undefined"!==typeof h.phone?parseInt(h.phone):b;break;case 1:b="undefined"!==typeof h.portrait?parseInt(h.portrait):b;break;case 2:b="undefined"!==typeof h.landscape?parseInt(h.landscape):b;break;case 3:b="undefined"!==typeof h.all?parseInt(h.all):b}}else b=parseInt(a.scrollOffset);b+=e;c.animate({scrollTop:jQuery(g).offset().top-b},a.scrollDuration,function(){a._is_updating=!1});window.location.hash=g})}},manageActiveLinks:function(a){if(a.activeHighlight){var c=
jQuery(window);c.scroll(function(){a._is_updating||(requestAnimationFrame(function(){var f=jQuery("body"),g=jQuery(".tdb_single_content"),d=tdViewport.getCurrentIntervalIndex(),b=0;f=f.hasClass("admin-bar")?0!==d?32:46:0;var e=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$/;if(a.smoothScroll)if(b=20,e.test(a.scrollOffset))switch(e=JSON.parse(atob(a.scrollOffset)),d){case 0:b="undefined"!==typeof e.phone?parseInt(e.phone):b;break;case 1:b="undefined"!==typeof e.portrait?
parseInt(e.portrait):b;break;case 2:b="undefined"!==typeof e.landscape?parseInt(e.landscape):b;break;case 3:b="undefined"!==typeof e.all?parseInt(e.all):b}else b=parseInt(a.scrollOffset);b+=f;d=a.headers.findIndex(function(a){return Math.floor(jQuery(a)[0].getBoundingClientRect().top)>=b+1});-1===d?d=a.headers.length-1:0<d&&d--;a.activeHeader=a.headers[d];a.activeLink=a.tocLinks[d];a.activeHeader===a.headers[0]&&c.scrollTop()+b<Math.floor(jQuery(a.activeHeader).offset().top)||a.activeHeader===a.headers[a.headers.length-
1]&&c.scrollTop()>=g.offset().top+g.height()?(jQuery(a.activeLink).hasClass("tdb-toc-active")&&jQuery(a.activeLink).removeClass("tdb-toc-active"),a.activeHeader=void 0,a.activeLink=void 0):(a.tocLinks.each(function(a,b){jQuery(b).removeClass("tdb-toc-active")}),jQuery(a.activeLink).addClass("tdb-toc-active"));a._is_updating=!1}),a._is_updating=!0)})}},_initialize_item:function(a){if(!0!==a._is_initialized){var c=jQuery("body");a.tocLinks=a.blockObj.find("a");a.tocLinks.each(function(f,g){f=c.find(jQuery(g).attr("href"));
f.length&&a.headers.push(f)});a.tocLinks.length!==a.headers.length?tdbTOC.deleteItem(a.uid):(tdbTOC.manageSmoothScroll(a),tdbTOC.manageActiveLinks(a),a._is_initialized=!0)}}}})();
