(()=>{"use strict";var t={338(t,e,n){var o=n(795);e.H=o.createRoot,o.hydrateRoot},723(t){t.exports=window.wp.i18n},727(t,e,n){n.d(e,{PU:()=>i,p4:()=>m,vB:()=>a});const o=window.wp.apiFetch;var r=n.n(o),s=n(723),c=n(790);function a(t){return JSON.parse(t||"{}")}async function m(t,e){const n=function(t){const e={number:t.number||5,offset:t.offset||0,order:t.order||"asc",orderby:t.orderby||"comment_author_email",...t.post_id&&{post_id:t.post_id},...t.post__in&&{post__in:t.post__in},...t.post__not_in&&{post__not_in:t.post__not_in},...t.post_type&&{post_type:t.post_type},...t.taxonomy&&{taxonomy:t.taxonomy},...t.terms&&{terms:t.terms},...t.term_ids&&{term_ids:t.term_ids},...t.exclude_post_author&&{exclude_post_author:t.exclude_post_author},...t.pingback&&{pingback:t.pingback},...t.trackback&&{trackback:t.trackback},...t.avatar_size&&{avatar_size:t.avatar_size}};return new URLSearchParams(e)}(t);return await r()({path:`decent-comments/v1/comments?${n.toString()}`,method:"GET",headers:{"X-WP-Nonce":e}})}const i=({comments:t,attributes:e})=>(0,c.jsxs)("div",{className:"decent-comments",children:[e.title?.length>0&&(0,c.jsx)("div",{className:"decent-comments-heading gamma widget-title",children:e.title}),(0,c.jsx)("ul",{className:"decent-comments-list",children:0===t.length?(0,c.jsx)("li",{className:"comment no-comment",children:(0,s.__)("No comments","decent-comments")}):t.filter(t=>!e.exclude_post_author||t.author_email!==t.post_author).map(t=>(0,c.jsx)(d,{comment:t,attributes:e},t.id))})]}),d=({comment:t,attributes:e})=>{const n=e.show_author?e.link_authors&&t.author_url?(0,c.jsx)("a",{href:l(t.author_url),className:"comment-author-link",children:t.author}):t.author:null,o=e.show_date?`${t.date} ${(0,s.__)("at","decent-comments")} ${t.time}`:null;let r="",a="";t.author_url&&(r='<a href="'+t.author_url+'" rel="external">',a="</a>");const m=e.show_avatar&&t.avatar?(0,c.jsx)("div",{className:"comment-avatar",dangerouslySetInnerHTML:{__html:r+t.avatar+a}}):null,i=e.show_comment?function(t,e){let n=e.show_excerpt?t:"";if(e.strip_tags&&(n=n.replace(/(<([^>]+)>)/gi,"")),e.max_excerpt_words>0){const t=n.split(" ");n=t.slice(0,e.max_excerpt_words).join(" ")+(t.length>e.max_excerpt_words?e.ellipsis:"")}return e.max_excerpt_characters>0&&(n=n.substring(0,e.max_excerpt_characters)+(n.length>e.max_excerpt_characters?e.ellipsis:"")),n}(t.content,e):"",d=e.show_link&&t.comment_link?(0,c.jsxs)("div",{className:"comment-link",children:[(0,s.__)("on","decent-comments")," ",(0,c.jsx)("a",{href:l(t.comment_link),className:"comment-post-title",children:t.post_title||""})]}):null;return(0,c.jsx)("li",{className:"comment-entry",children:(0,c.jsxs)("div",{className:"comment-content",children:[m,n&&(0,c.jsxs)("div",{className:"comment-author",children:[n," "]}),o&&(0,c.jsxs)("div",{className:"comment-date",children:[o," "]}),d," ",i&&(0,c.jsx)("div",{className:"comment-excerpt",children:i})]})},t.id)};function l(t){try{const e=new URL(t);return["http:","https:"].includes(e.protocol)?encodeURI(t):"#"}catch{return"#"}}},790(t){t.exports=window.ReactJSXRuntime},795(t){t.exports=window.ReactDOM}},e={};function n(o){var r=e[o];if(void 0!==r)return r.exports;var s=e[o]={exports:{}};return t[o](s,s.exports,n),s.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var o=n(338),r=n(723),s=n(727),c=n(790);let a=null,m=null;window.decentCommentsView&&(window.decentCommentsView.current_post_id&&(a=window.decentCommentsView.current_post_id),window.decentCommentsView.current_term_id&&(m=window.decentCommentsView.current_term_id)),document.addEventListener("DOMContentLoaded",async()=>{const t=document.querySelectorAll(".wp-block-itthinx-decent-comments");for(const e of t){e._decentCommentsRoot||(e._decentCommentsRoot=(0,o.H)(e));const t=e._decentCommentsRoot;try{const n=(0,s.vB)(e.dataset.attributes);"[current]"!==n.post_id&&"{current}"!==n.post_id||a&&(n.post_id=a),"[current]"!==n.terms&&"{current}"!==n.terms||m&&(n.term_ids=m);const o=window.decentCommentsView?.nonce||"",r=await(0,s.p4)(n,o);t.render((0,c.jsx)(s.PU,{comments:r.comments||[],attributes:n}))}catch(e){t.render((0,c.jsx)("p",{className:"text-red-500",children:(0,r.__)("Error loading comments","decent-comments")})),console.error("Decent Comments Error:",e)}}})})();
!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t("object"==typeof module&&module.exports?require("jquery"):jQuery)}(function(t){function e(t){return t.replace(/(:|\.|\/)/g,"\\$1")}var o="1.6.0",i={},l={exclude:[],excludeWithin:[],offset:0,direction:"top",delegateSelector:null,scrollElement:null,scrollTarget:null,beforeScroll:function(){},afterScroll:function(){},easing:"swing",speed:400,autoCoefficient:2,preventDefault:!0},s=function(e){var o=[],i=!1,l=e.dir&&"left"===e.dir?"scrollLeft":"scrollTop";return this.each(function(){var e=t(this);return this!==document&&this!==window?!document.scrollingElement||this!==document.documentElement&&this!==document.body?void(e[l]()>0?o.push(this):(e[l](1),i=e[l]()>0,i&&o.push(this),e[l](0))):(o.push(document.scrollingElement),!1):void 0}),o.length||this.each(function(){"BODY"===this.nodeName&&(o=[this])}),"first"===e.el&&o.length>1&&(o=[o[0]]),o};t.fn.extend({scrollable:function(t){var e=s.call(this,{dir:t});return this.pushStack(e)},firstScrollable:function(t){var e=s.call(this,{el:"first",dir:t});return this.pushStack(e)},smoothScroll:function(o,i){if(o=o||{},"options"===o)return i?this.each(function(){var e=t(this),o=t.extend(e.data("ssOpts")||{},i);t(this).data("ssOpts",o)}):this.first().data("ssOpts");var l=t.extend({},t.fn.smoothScroll.defaults,o),s=function(o){var i=this,s=t(this),n=t.extend({},l,s.data("ssOpts")||{}),c=l.exclude,a=n.excludeWithin,r=0,h=0,u=!0,d={},p=t.smoothScroll.filterPath(location.pathname),f=t.smoothScroll.filterPath(i.pathname),m=location.hostname===i.hostname||!i.hostname,g=n.scrollTarget||f===p,v=e(i.hash);if(n.scrollTarget||m&&g&&v){for(;u&&r<c.length;)s.is(e(c[r++]))&&(u=!1);for(;u&&h<a.length;)s.closest(a[h++]).length&&(u=!1)}else u=!1;u&&(n.preventDefault&&o.preventDefault(),t.extend(d,n,{scrollTarget:n.scrollTarget||v,link:i}),t.smoothScroll(d))};return null!==o.delegateSelector?this.undelegate(o.delegateSelector,"click.smoothscroll").delegate(o.delegateSelector,"click.smoothscroll",s):this.unbind("click.smoothscroll").bind("click.smoothscroll",s),this}}),t.smoothScroll=function(e,o){if("options"===e&&"object"==typeof o)return t.extend(i,o);var l,s,n,c,a,r=0,h="offset",u="scrollTop",d={},p={};"number"==typeof e?(l=t.extend({link:null},t.fn.smoothScroll.defaults,i),n=e):(l=t.extend({link:null},t.fn.smoothScroll.defaults,e||{},i),l.scrollElement&&(h="position","static"===l.scrollElement.css("position")&&l.scrollElement.css("position","relative"))),u="left"===l.direction?"scrollLeft":u,l.scrollElement?(s=l.scrollElement,/^(?:HTML|BODY)$/.test(s[0].nodeName)||(r=s[u]())):s=t("html, body").firstScrollable(l.direction),l.beforeScroll.call(s,l),n="number"==typeof e?e:o||t(l.scrollTarget)[h]()&&t(l.scrollTarget)[h]()[l.direction]||0,d[u]=n+r+l.offset,c=l.speed,"auto"===c&&(a=Math.abs(d[u]-s[u]()),c=a/l.autoCoefficient),p={duration:c,easing:l.easing,complete:function(){l.afterScroll.call(l.link,l)}},l.step&&(p.step=l.step),s.length?s.stop().animate(d,p):l.afterScroll.call(l.link,l)},t.smoothScroll.version=o,t.smoothScroll.filterPath=function(t){return t=t||"",t.replace(/^\//,"").replace(/(?:index|default).[a-zA-Z]{3,4}$/,"").replace(/\/$/,"")},t.fn.smoothScroll.defaults=l}),jQuery.cookie=function(t,e,o){if(arguments.length>1&&"[object Object]"!==String(e)){if(o=jQuery.extend({},o),(null===e||void 0===e)&&(o.expires=-1),"number"==typeof o.expires){var i=o.expires,l=o.expires=new Date;l.setDate(l.getDate()+i)}return e=String(e),document.cookie=[encodeURIComponent(t),"=",o.raw?e:encodeURIComponent(e),o.expires?"; expires="+o.expires.toUTCString():"",o.path?"; path="+o.path:"",o.domain?"; domain="+o.domain:"",o.secure?"; secure":""].join("")}o=e||{};var s,n=o.raw?function(t){return t}:decodeURIComponent;return(s=new RegExp("(?:^|;)"+encodeURIComponent(t)+"=([^;]*)").exec(document.cookie))?n(s[1]):null},jQuery(document).ready(function(t){if("undefined"!=typeof tocplus){if(t.fn.shrinkTOCWidth=function(){t(this).css({width:"auto",display:"table"}),/MSIE 7\./.test(navigator.userAgent)&&t(this).css("width","")},1==tocplus.smooth_scroll){var e=hostname=pathname=qs=hash=null;t("body a").click(function(){if(hostname=t(this).prop("hostname"),pathname=t(this).prop("pathname"),qs=t(this).prop("search"),hash=t(this).prop("hash"),pathname.length>0&&"/"!=pathname.charAt(0)&&(pathname="/"+pathname),window.location.hostname==hostname&&window.location.pathname==pathname&&window.location.search==qs&&""!==hash){var o=hash.replace(/([ !"$%&'()*+,.\/:;<=>?@[\]^`{|}~])/g,"\\$1");t(o).length>0?e=hash:(anchor=hash,anchor=anchor.replace("#",""),e='a[name="'+anchor+'"]',0==t(e).length&&(e="")),offset="undefined"!=typeof tocplus.smooth_scroll_offset?-1*tocplus.smooth_scroll_offset:t("#wpadminbar").length>0&&t("#wpadminbar").is(":visible")?-30:0,e&&t.smoothScroll({scrollTarget:e,offset:offset})}})}if("undefined"!=typeof tocplus.visibility_show){var o="undefined"!=typeof tocplus.visibility_hide_by_default?!0:!1;if(t.cookie)var i=t.cookie("tocplus_hidetoc")?tocplus.visibility_show:tocplus.visibility_hide;else var i=tocplus.visibility_hide;o&&(i=i==tocplus.visibility_hide?tocplus.visibility_show:tocplus.visibility_hide),t("#toc_container p.toc_title").append(' <span class="toc_toggle"><span class="toc_brackets">[</span><a href="#">'+i+'</a><span class="toc_brackets">]</span></span>'),i==tocplus.visibility_show&&(t("ul.toc_list").hide(),t("#toc_container").addClass("contracted").shrinkTOCWidth()),t("span.toc_toggle a").click(function(e){switch(e.preventDefault(),t(this).html()){case t("<div/>").html(tocplus.visibility_hide).text():t(this).html(tocplus.visibility_show),t.cookie&&(o?t.cookie("tocplus_hidetoc",null,{path:"/"}):t.cookie("tocplus_hidetoc","1",{expires:30,path:"/"})),t("ul.toc_list").hide("fast"),t("#toc_container").addClass("contracted").shrinkTOCWidth();break;case t("<div/>").html(tocplus.visibility_show).text():default:t(this).html(tocplus.visibility_hide),t.cookie&&(o?t.cookie("tocplus_hidetoc","1",{expires:30,path:"/"}):t.cookie("tocplus_hidetoc",null,{path:"/"})),t("#toc_container").css("width",tocplus.width).removeClass("contracted"),t("ul.toc_list").show("fast")}})}}});
window.MD={
foreach: function(items, fn){
if(Object.prototype.toString.call(items)!=='[object Array]')
items=items.split(' ');
for(var i=0; i < items.length; i++)
fn(items[i], i);
},
hasClass: function(el, className){
return new RegExp('(^|\\s)' + className + '(\\s|$)').test(el.className);
},
addClass: function(el, classes){
MD.foreach(classes, function(className){
if(! MD.hasClass(el, className) )
el.className +=(el.className ? ' ':'') + className;
});
},
removeClass: function(el, classes){
MD.foreach(classes, function(className){
if(MD.hasClass(el, className) )
el.className=el.className.replace(new RegExp('(?:^|\\s)' + className + '(?!\\S)'), '');
});
},
toggleClass: function(el, classes){
MD.foreach(classes, function(className){
(MD.hasClass(el, className) ? MD.removeClass:MD.addClass)(el, className);
});
},
cookie: {
create: function(name, value, days){
var expires='';
if(days){
var date=new Date();
date.setTime(date.getTime() +(days * 24 * 60 * 60 * 1000) );
expires='; expires=' + date.toGMTString();
}
document.cookie=name + '=' + value + expires + '; path=/';
},
get: function(name){
var nameEQ=name + '=';
var ca=document.cookie.split(';');
for(var i=0; i < ca.length; i++){
var c=ca[i];
while(c.charAt(0)==' ') c=c.substring(1, c.length);
if(c.indexOf(nameEQ)===0) return c.substring(nameEQ.length, c.length);
}
return null;
},
erase: function(name){
this.create(name, '', -1);
}},
headerMenu: function(){
var headerTrigger=document.getElementById('header-menu-trigger');
if(headerTrigger)
headerTrigger.onclick=function(e){
MD.toggleClass(document.getElementById('header'), 'has-mobile-menu');
}},
mainMenu: function(){
var mainMenu=document.getElementById('main_menu'),
triggers=document.getElementsByClassName('menu-trigger');
for(var i=0; i < triggers.length; i++){
triggers[i].onclick=function(e){
e.preventDefault();
var type=this.dataset.menuTrigger;
if(MD.hasClass(mainMenu, 'has-' + type) )
MD.removeClass(mainMenu, 'has-' + type);
else {
mainMenu.className='main-menu';
MD.addClass(mainMenu, 'has-' + type);
}
if(type=='search')
document.getElementById('main_menu_search_input').focus();
}}
document.onclick=function(e){
var target=e.target||e.srcElement;
do {
if(mainMenu===target)
return;
target=target.parentNode;
}
while(target)
MD.removeClass(mainMenu, 'has-search');
}},
tabs: function(parent){
var tabs=document.getElementsByClassName('md-tab');
for(var i=0; i < tabs.length; i++){
tabs[i].onclick=function(e){
var tabID=this.getAttribute('data-tab'),
parentTabs=document.querySelectorAll('#' + parent + ' .md-tab'),
parentContent=document.querySelectorAll('#' + parent + ' .md-tab-content');
for(var i=0; i < parentTabs.length; i++)
MD.removeClass(parentTabs[i], 'active');
for(var i=0; i < parentContent.length; i++)
MD.removeClass(parentContent[i], 'active');
document.getElementById(parent).className=parent + ' has-' + tabID;
MD.addClass(document.getElementById(tabID), 'active');
MD.addClass(document.getElementById(tabID + '_tab'), 'active');
}}
},
accordion: function(parent){
var titles=document.getElementsByClassName('accordion-title');
for(var i=0; i < titles.length; i++){
titles[i].onclick=function(e){
var groups=document.querySelectorAll('#' + parent + ' .accordion-group'),
groupID=this.getAttribute('data-accordion'),
group=document.getElementById(parent + '_' + groupID);
for(var i=0; i < groups.length; i++)
MD.removeClass(groups[i], 'active');
MD.addClass(group, 'active');
}}
},
footnotes: function(){
var footnotes=document.getElementsByClassName('footnote');
for(var i=0; i < footnotes.length; i++){
footnotes[i].onclick=function(e){
MD.toggleClass(document.getElementById(this.id), 'footnote-show');
}}
},
button: function(){
var buttons=document.getElementsByClassName('button-loading');
for(var i=0; i < buttons.length; i++){
buttons[i].onclick=function(e){
var form=this.parentNode;
form.addEventListener('submit', function(){
MD.addClass(this, 'is-loading');
});
}}
},
share: {
init: function(){
MD.share.window();
MD.share.like();
if(document.getElementById('share_side') )
MD.share.sticky();
},
window: function(){
shares=document.querySelectorAll('[data-share]');
for(var i=0; i < shares.length; i++){
shares[i].onclick=function(){
window.open(this.getAttribute('href'), 'newWindow','left=100, top=150, width=600, height=300, toolbar=0, resizable=1');
return false;
}}
},
like: function(){
var name='md_likes',
likes=document.getElementsByClassName('share-like'),
totals=document.getElementsByClassName('share-total');
for(var i=0; i < likes.length; i++){
likes[i].onclick=function(e){
e.preventDefault();
if(! MD.hasClass(this, 'liked') ){
var post_id=this.getAttribute('data-share-id'),
post_type=this.getAttribute('data-share-type'),
archive=this.getAttribute('data-share-archive'),
counts=document.getElementsByClassName('share-count'),
request=new XMLHttpRequest();
for(var i=0; i < counts.length; i++)
if(likes[i].getAttribute('data-share-id')===post_id){
counts[i].innerHTML++;
MD.addClass(likes[i], 'liked');
}
request.open('POST', MDJS.ajaxurl, true);
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
request.onreadystatechange=function(){
if(request.readyState===4&&request.status===200){
var liked=MD.cookie.get(name) ? JSON.parse(MD.cookie.get(name) ):[];
liked.push(post_id);
if(totals)
for(var i=0; i < totals.length; i++)
if(totals[i].getAttribute('data-share-total')===post_type)
totals[i].innerHTML++;
MD.cookie.create(name, JSON.stringify(liked), 365);
}};
request.send('action=md_like&post_id=' + post_id + '&archive=' + archive + '&nonce=' + MDJS.nonce);
}}
}},
sticky: function(){
var content=document.getElementById('content_box'),
contentHeight=content.offsetTop + content.clientHeight,
share=document.getElementById('share_side'),
pos=0,
ticking=false;
window.onscroll=function(e){
pos=window.scrollY;
if(! ticking){
window.requestAnimationFrame(function(){
if(pos > content.offsetTop)
MD.addClass(share, 'is-sticky');
else
MD.removeClass(share, 'is-sticky');
if(pos >(( content.offsetTop + content.clientHeight) - 300) ){
MD.removeClass(share, 'is-sticky');
MD.addClass(share, 'is-stuck');
}else{
MD.removeClass(share, 'is-stuck');
if(pos > content.offsetTop)
MD.addClass(share, 'is-sticky');
}
ticking=false;
});
}
ticking=true;
}}
},
focusInputs: function(id){
var search=document.querySelector('#' + id + ' .search-input'),
name=document.querySelector('#' + id + ' .form-input-name'),
email=document.querySelector('#' + id + ' .form-input-email');
if(search)
search.focus();
else if(name)
name.focus();
else if(email)
email.focus();
},
floatingBars: {
init: function(floatingBars){
this.opened=false;
this.data=floatingBars;
MD.floatingBars.open.events();
MD.floatingBars.close.events();
},
open: {
events: function(){
for(var id in MD.floatingBars.data){
if(MD.floatingBars.opened) break;
MD.floatingBar=MD.floatingBars.data[id];
if(MD.floatingBar.show==='seconds')
this.timer();
if(MD.floatingBar.show==='percent')
this.percent();
MD.floatingBars.opened=true;
}},
percent: function(){
window.onscroll=function(){
var pos=window.scrollY,
el=document.getElementById(MD.floatingBar.id);
if(! MD.hasClass(el, 'closed') ){
window.requestAnimationFrame(function(){
var percent=Math.round(( pos / document.body.scrollHeight) * 100);
if(MD.floatingBar.delay <=percent)
MD.floatingBars.open.show();
else if(MD.hasClass(el, 'active') )
MD.removeClass(el, 'active');
});
}}
},
timer: function(){
setTimeout(function(){
MD.floatingBars.open.show();
}, MD.floatingBar.delay * 1000);
},
show: function(){
var element=document.getElementById(MD.floatingBar.id);
MD.addClass(element, 'active');
if(! MD.hasClass(element, 'top static') )
setTimeout(function(){ MD.focusInputs(MD.floatingBar.id); }, 100);
if(MD.floatingBar.position==='top'){
var adminBar=MDJS.hasAdminBar ? 32:0;
document.getElementsByTagName('body')[0].style.paddingTop=(element.clientHeight + adminBar) + 'px';
}}
},
close: {
events: function(){
this.trigger();
},
trigger: function(){
var triggers=document.getElementsByClassName('cta-bar-close')
for(var i=0; i < triggers.length; i++){
triggers[i].onclick=function(){
MD.removeClass(document.getElementById(MD.floatingBar.id), 'active');
MD.floatingBars.close.close();
}}
},
close: function(){
if(MD.floatingBar.position==='top')
document.getElementsByTagName('body')[0].style.paddingTop='';
MD.addClass(document.getElementById(MD.floatingBar.id), 'closed');
MD.floatingBars.opened=false;
if(! MD.cookie.get(MD.floatingBar.id) )
MD.cookie.create(MD.floatingBar.id, true, MD.floatingBar.cookieExp);
delete MD.floatingBars.data[MD.floatingBar.id];
MD.floatingBars.open.events();
}}
},
popups: {
init: function(popups){
this.opened=this.showing=false;
this.data=popups;
MD.popups.open.events();
},
open: {
events: function(){
this.triggers();
for(var id in MD.popups.data){
if(MD.popups.opened) break;
MD.popup=MD.popups.data[id];
if(MD.popup.show==='seconds')
this.timer();
else if(MD.popup.show==='percent')
this.percent();
else if(MD.popup.show==='exit')
this.exit();
MD.popups.opened=MD.popup.id;
}},
triggers: function(){
var triggers=document.getElementsByClassName('md-popup-trigger');
for(var i=0; i < triggers.length; i++){
triggers[i].onclick=function(){
MD.popups.trigger=this.getAttribute('data-popup');
MD.popups.open.show();
return false;
}}
},
percent: function(){
var shown=false;
window.onscroll=function(){
if(shown||MD.popups.trigger) return;
var pos=window.scrollY,
el=document.getElementById(MD.popup.id);
window.requestAnimationFrame(function(){
var percent=Math.round(( pos / document.body.scrollHeight) * 100);
if(MD.popup.delay <=percent){
shown=true;
MD.popups.open.show();
}});
}},
timer: function(){
setTimeout(function(){
if(! MD.popups.trigger)
MD.popups.open.show();
}, MD.popup.delay * 1000);
},
exit: function(){
var shown=false;
window.document.onmousemove=function(e){
if(shown||MD.popups.trigger) return;
var scroll=window.pageYOffset||document.documentElement.scrollTop;
if(( e.pageY - scroll) < 7){
shown=true;
MD.popups.open.show();
}}
},
show: function(){
var id=MD.popups.trigger ? MD.popups.trigger:MD.popup.id;
MD.addClass(document.getElementsByTagName('html')[0], 'has-popup');
if(MD.popups.showing&&MD.popups.trigger)
MD.removeClass(document.getElementById(MD.popups.showing), 'md-popup-active');
MD.addClass(document.getElementById(id), 'md-popup-active');
MD.focusInputs(id);
MD.popups.showing=id;
if(! MD.popups.trigger)
delete MD.popups.data[MD.popup.id];
MD.popups.close.events();
}},
close: {
events: function(){
this.trigger();
this.bg();
this.esc();
},
trigger: function(){
var triggers=document.getElementsByClassName('md-popup-close');
for(var i=0; i < triggers.length; i++){
triggers[i].onclick=function(){
MD.popups.close.close();
}}
},
bg: function(){
document.getElementById('popup_bg').onclick=function(){
MD.popups.close.close();
}},
esc: function(){
window.document.onkeydown=function(e){
e=e||window.event;
if(e.keyCode==27)
MD.popups.close.close();
};},
close: function(){
MD.removeClass(document.getElementsByTagName('html')[0], 'has-popup');
if(MD.popups.trigger){
var id=MD.popups.trigger;
delete MD.popups.trigger;
}else{
var id=MD.popup.id;
if(MD.popup.cookieExp&&! MD.cookie.get(id) )
MD.cookie.create(id, true, MD.popup.cookieExp);
}
delete MD.popups.opened;
delete MD.popups.showing;
MD.removeClass(document.getElementById(id), 'md-popup-active');
MD.popups.toggleVideo(id);
MD.popups.open.events();
}},
toggleVideo: function(id){
var iframe=document.querySelector('#' + id + ' iframe'),
video=document.querySelector('#' + id + ' video');
if(iframe!==null){
var iframeSrc=iframe.src;
iframe.src=iframeSrc;
}
if(video!==null)
video.pause();
}}
};