function wpcdt_pro_refresh_completion_text(t){t=t||jQuery("body");t.find('.wpcdt-completion-wrap iframe[src*="vimeo.com"]').wrap('<div class="wpcdt-iframe-wrap" />'),t.find('.wpcdt-completion-wrap iframe[src*="dailymotion.com"]').wrap('<div class="wpcdt-iframe-wrap" />'),t.find('.wpcdt-completion-wrap iframe[src*="youtube.com"]').wrap('<div class="wpcdt-iframe-wrap" />'),t.find('.wpcdt-completion-wrap iframe[src*="m.youtube.com"]').wrap('<div class="wpcdt-iframe-wrap" />'),t.find('.wpcdt-completion-wrap iframe[src*="youtu.be"]').wrap('<div class="wpcdt-iframe-wrap" />'),t.find('.wpcdt-completion-wrap iframe[src*="screencast-o-matic.com"]').wrap('<div class="wpcdt-iframe-wrap" />'),t.find('.wpcdt-completion-wrap iframe[src*="videopress.com"]').wrap('<div class="wpcdt-iframe-wrap" />'),t.find('.wpcdt-completion-wrap iframe[src*="video.wordpress.com"]').wrap('<div class="wpcdt-iframe-wrap" />'),t.find('.wpcdt-completion-wrap iframe[src*="docs.google.com/presentation"]').wrap('<div class="wpcdt-iframe-wrap" />'),t.find('.wpcdt-completion-wrap iframe[src*="fast.wistia.net"]').wrap('<div class="wpcdt-iframe-wrap" />'),t.find(".wpcdt-completion-wrap .wpcdt-iframe-responsive").wrap('<div class="wpcdt-iframe-wrap" />')}function wpcdt_pro_all_timer_init(p,t){var m=" .wpcdt-clock",l=p?p.shrt_atts:"",e=t?t.find(".wpcdt-clock-circle"):jQuery(".wpcdt-timer-circle .wpcdt-clock-circle");e.each(function(t){var e=jQuery(this).closest(".wpcdt-timer-wrap"),r=l||JSON.parse(e.attr("data-conf")),c=e.find(".wpcdt-timer-js").attr("id");c+=m;var d,i=new Date(r.current_date),a=new Date(r.expiry_date);1==r.is_caching&&!p||jQuery("#"+c).hasClass("wpcdt-timer-initialized")||(d=wpcdt_pro_timer_over_conf(r,c),e=wpcdt_pro_date_diff(i,a).total_seconds,"evergreen"==r.timer_mode&&0<r.recuring_time&&"active"==r.timer_status&&(a=wpcdt_pro_recuring_time(r),a=(a=JSON.parse(a))[0],e=wpcdt_pro_date_diff(i,new Date(a)).total_seconds,jQuery("#"+c).attr("data-timer",e)),jQuery("#"+c).TimeCircles({animation:r.timercircle_animation,bg_width:""!=r.timer_bg_width?r.timer_bg_width:1.2,fg_width:""!=r.timercircle_width?r.timercircle_width:.1,circle_bg_color:""!=r.timer_bgclr?r.timer_bgclr:"#313332",time:{Days:{text:r.day_text,color:r.timer_day_bgclr,show:1==r.is_days},Hours:{text:r.hour_text,color:r.timer_hour_bgclr,show:1==r.is_hours},Minutes:{text:r.minute_text,color:r.timer_minute_bgclr,show:1==r.is_minutes},Seconds:{text:r.second_text,color:r.timer_second_bgclr,show:1==r.is_seconds}}}),jQuery("#"+c).TimeCircles().addListener(function(t,e,i){i<=0&&jQuery("#"+c).TimeCircles().stop();0!=i||jQuery("#"+c).hasClass("wpcdt-timer-finished")||(jQuery("#"+c).addClass("wpcdt-timer-finished"),wpcdt_pro_timer_over(d,r))}),jQuery("#"+c).addClass("wpcdt-timer-initialized"),jQuery(window).on("resize",function(){jQuery("#"+c).TimeCircles().rebuild()}))}),(e=t?t.find(".wpcdt-clock-design-2"):jQuery(".wpcdt-timer-design-2 .wpcdt-clock-design-2")).each(function(t){firstCalculation=!0;var e=jQuery(this).closest(".wpcdt-timer-wrap"),i=l||JSON.parse(e.attr("data-conf")),r=e.find(".wpcdt-timer-js").attr("id");r+=m;var c,_=jQuery("#"+r),e=i.date_diff;1==i.is_caching&&!p||jQuery("#"+r).hasClass("wpcdt-timer-initialized")||(c=wpcdt_pro_timer_over_conf(i,r),"evergreen"==i.timer_mode&&0<i.recuring_time&&"active"==i.timer_status&&(r=wpcdt_pro_recuring_time(i),e=(e=JSON.parse(r))[1]),_.WpcdtClock({currentDateTime:i.date_c,day:e.day,month:e.month,year:e.year,hour:e.hour,minute:e.minute,second:e.second,daysLabel:i.day_text,hoursLabel:i.hour_text,minutesLabel:i.minute_text,secondsLabel:i.second_text,timeZone:parseFloat(WpCdtPro.timezone),onComplete:function(){wpcdt_pro_timer_over(c,i)},afterCalculation:function(){var o=this,n={days:this.days,hours:this.hours,minutes:this.minutes,seconds:this.seconds},s={hours:"23",minutes:"59",seconds:"59"},p="active";1==firstCalculation&&(firstCalculation=!1,_.find(".wpcdt-unit-wrap .wpcdt-digits-wrap").each(function(){for(var t=jQuery(this),e=t.attr("data-unit"),i=n[e],r="",c="",d=0;d<10;d++)r+=['<div class="wpcdt-digit-inr">','<div class="wpcdt-flip-wrap">','<div class="up wpcdt-flip-inr">','<div class="shadow"></div>','<div class="inn">'+d+"</div>","</div>",'<div class="down wpcdt-flip-inr">','<div class="shadow"></div>','<div class="inn">'+d+"</div>","</div>","</div>","</div>"].join("");for(var a=0;a<i.length;a++)c+='<div class="wpcdt-digits">'+r+"</div>";t.html(c)})),jQuery.each(n,function(t){for(var e=_.find("."+t+" .wpcdt-digits").length,i=s[t],r=o.strPad(this,e,"0"),c=r.length-1;0<=c;c--){var d=_.find("."+t+" .wpcdt-digits:eq("+c+")").find("div.wpcdt-digit-inr"),a=!i||0==i[c]?9:i[c],n=parseInt(r[c]),a=n==a?0:n+1;d.eq(a).hasClass(p)&&d.parent().addClass("play"),d.removeClass(p).removeClass("before"),d.eq(n).addClass(p),d.eq(a).addClass("before")}})}}).addClass("wpcdt-timer-initialized"))}),(e=t?t.find(".wpcdt-clock-design-3"):jQuery(".wpcdt-timer-design-3 .wpcdt-clock-design-3")).each(function(t){var e=jQuery(this).closest(".wpcdt-timer-wrap"),i=l||JSON.parse(e.attr("data-conf")),r=e.find(".wpcdt-timer-js").attr("id");r+=m;var c,d=i.date_diff;1==i.is_caching&&!p||jQuery("#"+r).hasClass("wpcdt-timer-initialized")||(c=wpcdt_pro_timer_over_conf(i,r),"evergreen"==i.timer_mode&&0<i.recuring_time&&"active"==i.timer_status&&(e=wpcdt_pro_recuring_time(i),d=(d=JSON.parse(e))[1]),jQuery("#"+r).WpcdtClock({currentDateTime:i.date_c,day:d.day,month:d.month,year:d.year,hour:d.hour,minute:d.minute,second:d.second,daysLabel:i.day_text,hoursLabel:i.hour_text,minutesLabel:i.minute_text,secondsLabel:i.second_text,timeZone:parseFloat(WpCdtPro.timezone),onComplete:function(){wpcdt_pro_timer_over(c,i)},onChange:function(){1==i.is_days&&wpcdt_pro_draw_circle(document.getElementById("ce-days-"+i.unique),this.days,365,i.timer_bgclr,i.timer_day_bgclr,i.timer2_width),1==i.is_hours&&wpcdt_pro_draw_circle(document.getElementById("ce-hours-"+i.unique),this.hours,24,i.timer_bgclr,i.timer_hour_bgclr,i.timer2_width),1==i.is_minutes&&wpcdt_pro_draw_circle(document.getElementById("ce-minutes-"+i.unique),this.minutes,60,i.timer_bgclr,i.timer_minute_bgclr,i.timer2_width),1==i.is_seconds&&wpcdt_pro_draw_circle(document.getElementById("ce-seconds-"+i.unique),this.seconds,60,i.timer_bgclr,i.timer_second_bgclr,i.timer2_width)}}).addClass("wpcdt-timer-initialized"))}),(e=t?t.find(".wpcdt-clock-design-4"):jQuery(".wpcdt-timer-design-4 .wpcdt-clock-design-4")).each(function(t){var e=jQuery(this).closest(".wpcdt-timer-wrap"),i=l||JSON.parse(e.attr("data-conf")),r=e.find(".wpcdt-timer-js").attr("id");r+=m;var c,d,a,n,o,s=i.date_diff;1==i.is_caching&&!p||jQuery("#"+r).hasClass("wpcdt-timer-initialized")||(c=wpcdt_pro_timer_over_conf(i,r),"evergreen"==i.timer_mode&&0<i.recuring_time&&"active"==i.timer_status&&(e=wpcdt_pro_recuring_time(i),s=(s=JSON.parse(e))[1]),d=jQuery("#"+r+" .ce-bar-days .wpcdt-fill"),a=jQuery("#"+r+" .ce-bar-hours .wpcdt-fill"),n=jQuery("#"+r+" .ce-bar-minutes .wpcdt-fill"),o=jQuery("#"+r+" .ce-bar-seconds .wpcdt-fill"),jQuery("#"+r).WpcdtClock({currentDateTime:i.date_c,day:s.day,month:s.month,year:s.year,hour:s.hour,minute:s.minute,second:s.second,daysLabel:i.day_text,hoursLabel:i.hour_text,minutesLabel:i.minute_text,secondsLabel:i.second_text,timeZone:parseFloat(WpCdtPro.timezone),onComplete:function(){wpcdt_pro_timer_over(c,i)},onChange:function(){wpcdt_pro_ct_bar(d,this.days,365),wpcdt_pro_ct_bar(a,this.hours,24),wpcdt_pro_ct_bar(n,this.minutes,60),wpcdt_pro_ct_bar(o,this.seconds,60)}}).addClass("wpcdt-timer-initialized"))}),(e=t?t.find(".wpcdt-clock-design-8"):jQuery(".wpcdt-timer-design-8 .wpcdt-clock-design-8")).each(function(t){var e=jQuery(this).closest(".wpcdt-timer-wrap"),i=l||JSON.parse(e.attr("data-conf")),r=e.find(".wpcdt-timer-js").attr("id");r+=m;var c,d=i.date_diff;1==i.is_caching&&!p||jQuery("#"+r).hasClass("wpcdt-timer-initialized")||(c=wpcdt_pro_timer_over_conf(i,r),"evergreen"==i.timer_mode&&0<i.recuring_time&&"active"==i.timer_status&&(e=wpcdt_pro_recuring_time(i),d=(d=JSON.parse(e))[1]),jQuery("#"+r).WpcdtClock({wrapDigits:!1,currentDateTime:i.date_c,day:d.day,month:d.month,year:d.year,hour:d.hour,minute:d.minute,second:d.second,daysLabel:i.day_text,hoursLabel:i.hour_text,minutesLabel:i.minute_text,secondsLabel:i.second_text,timeZone:parseFloat(WpCdtPro.timezone),daysWrapper:".ce-days .wpcdt-flip-back",hoursWrapper:".ce-hours .wpcdt-flip-back",minutesWrapper:".ce-minutes .wpcdt-flip-back",secondsWrapper:".ce-seconds .wpcdt-flip-back",onComplete:function(){wpcdt_pro_timer_over(c,i)},onChange:function(){wpcdt_pro_horizontal_animation(jQuery("#"+r+" .wpcdt-col .wpcdt-digits"),this)}}).addClass("wpcdt-timer-initialized"),(-1!==navigator.userAgent.indexOf("MSIE")||0<navigator.appVersion.indexOf("Trident/"))&&jQuery("html").addClass("wpcdt-ie"))}),(e=t?t.find(".wpcdt-clock-timer"):jQuery(".wpcdt-timer-clock .wpcdt-clock-timer")).each(function(t){var e=jQuery(this).closest(".wpcdt-timer-wrap"),i=l||JSON.parse(e.attr("data-conf")),r=e.find(".wpcdt-timer-js").attr("id");r+=m;var c,d=i.date_diff;1==i.is_caching&&!p||jQuery("#"+r).hasClass("wpcdt-timer-initialized")||(c=wpcdt_pro_timer_over_conf(i,r),"evergreen"==i.timer_mode&&0<i.recuring_time&&"active"==i.timer_status&&(e=wpcdt_pro_recuring_time(i),d=(d=JSON.parse(e))[1]),jQuery("#"+r).WpcdtClock({currentDateTime:i.date_c,day:d.day,month:d.month,year:d.year,hour:d.hour,minute:d.minute,second:d.second,daysLabel:i.day_text,hoursLabel:i.hour_text,minutesLabel:i.minute_text,secondsLabel:i.second_text,timeZone:parseFloat(WpCdtPro.timezone),onComplete:function(){wpcdt_pro_timer_over(c,i)},onChange:function(){"design-9"==i.design&&wpcdt_pro_modern_animation(jQuery("#"+r+" .wpcdt-digits span"))}}).addClass("wpcdt-timer-initialized"),(-1!==navigator.userAgent.indexOf("MSIE")||0<navigator.appVersion.indexOf("Trident/"))&&jQuery("html").addClass("wpcdt-ie"))}),(e=t?t.find(".wpcdt-clock-simple"):jQuery(".wpcdt-smpl-timer-wrap .wpcdt-clock-simple")).each(function(t){var e=jQuery(this).closest(".wpcdt-smpl-timer-wrap"),i=l||JSON.parse(e.attr("data-conf")),r=e.find(".wpcdt-timer-js").attr("id");r+=" .wpcdt-clock-simple";var c=i.date_diff;1==i.is_caching&&!p||jQuery("#"+r).hasClass("wpcdt-timer-initialized")||("evergreen"==i.timer_mode&&0<i.recuring_time&&"active"==i.timer_status&&(e=wpcdt_pro_recuring_time(i),c=(c=JSON.parse(e))[1]),jQuery("#"+r).WpcdtClock({currentDateTime:i.date_c,day:c.day,month:c.month,year:c.year,hour:c.hour,minute:c.minute,second:c.second,daysLabel:i.day_text,hoursLabel:i.hour_text,minutesLabel:i.minute_text,secondsLabel:i.second_text,timeZone:parseFloat(WpCdtPro.timezone)}).addClass("wpcdt-timer-initialized"))})}function wpcdt_pro_date_diff(t,e){if(material=[],material.days=0,material.hours=0,material.minutes=0,material.seconds=0,material.total_seconds=0,t<e){var i=Math.abs(e-t)/1e3,r=Math.floor(i/86400);i-=86400*r,material.days=r;r=Math.floor(i/3600)%24;i-=3600*r,material.hours=r;r=Math.floor(i/60)%60;i-=60*r,material.minutes=r;i=i%60;material.seconds=i;t=(e.getTime()-t.getTime())/1e3;return material.total_seconds=t,material}return material}function wpcdt_pro_deg(t){return Math.PI/180*t-Math.PI/2}function wpcdt_pro_draw_circle(t,e,i,r,c,d){var a;t&&((a=t.getContext("2d")).clearRect(0,0,t.width,t.height),a.lineWidth=d,a.beginPath(),a.arc(t.width/2,t.height/2,t.width/2-a.lineWidth,wpcdt_pro_deg(0),wpcdt_pro_deg(360/i*(i-e)),!1),a.strokeStyle=r,a.stroke(),a.beginPath(),a.arc(t.width/2,t.height/2,t.width/2-a.lineWidth,wpcdt_pro_deg(0),wpcdt_pro_deg(360/i*(i-e)),!0),a.strokeStyle=c,a.stroke())}function wpcdt_pro_ct_bar(t,e,i){barWidth=100-100/i*e,t.width(barWidth+"%")}function wpcdt_pro_horizontal_animation(t,e){t.each(function(t){var e=jQuery(this),i=e.find(".wpcdt-flip-front"),r=e.find(".wpcdt-flip-back").text(),c=e.attr("data-old");void 0===c&&e.attr("data-old",r),r!=c&&(e.addClass("wpcdt-animate"),window.setTimeout(function(){i.text(r),e.removeClass("wpcdt-animate").attr("data-old",r)},800))})}function wpcdt_pro_modern_animation(t){t.each(function(t){var e=jQuery(this),i=e.text(),r=e.attr("data-value");void 0===e.attr("data-old")&&e.attr("data-old",i),i!=r&&(e.attr("data-value",i).attr("data-old",r).addClass("wpcdt-animate"),window.setTimeout(function(){e.removeClass("wpcdt-animate").attr("data-old",i)},300))})}function wpcdt_pro_timer_over(e,i){var r=jQuery("#"+e.timer_id).closest(".wpcdt-timer-wrap"),t={action:"wpcdt_pro_end_timer",timer_conf:i};jQuery("body").trigger("wpcdt_timer_before_finish",[e,i,r]),jQuery.post(WpCdtPro.ajax_url,t,function(t){1==t.success&&(0==e.content_after_complete&&r.find(".wpcdt-desc").remove(),r.find(".wpcdt-clock").remove(),r.find(".wpcdt-timer").append(t.completion_text),r.find(".wpcdt-completion-wrap").fadeIn(),wpcdt_pro_refresh_completion_text(r),wpcdt_pro_all_timer_init(),localStorage.removeItem("wpcdt_"+e.post_id+"_current_time"),localStorage.removeItem("wpcdt_"+e.post_id+"_end_time"),jQuery("body").trigger("wpcdt_timer_after_finish",[e,i,t,r]))})}function wpcdt_pro_timer_over_conf(t,e){return{timer_id:e,post_id:t.timer_id,recur_flag:t.recuring_time,timer_mode:t.timer_mode,content_after_complete:t.content_after_complete}}function wpcdt_pro_set_recuring_data(t,e,i){var r,c="",d=t.timer_id;return"time_conf"==e?(r={0:t.recur_date_time,1:t.recuring_diff},c=JSON.stringify(r)):"current_time"==e?c=JSON.stringify(t.current_time):"end_time"==e&&(c=JSON.stringify(t.recuring_date)),c=localStorage.setItem(WpCdtPro.recuring_prefix+d+"_"+e,c)}function wpcdt_pro_get_recuring_data(t,e){t=t.timer_id;return localStorage.getItem(WpCdtPro.recuring_prefix+t+"_"+e)}function wpcdt_pro_recuring_time(t){var e="",i={0:t.recur_date_time,1:t.recuring_diff},r=wpcdt_pro_get_recuring_data(t,"time_conf");try{get_stored_data_obj=JSON.parse(r)}catch(t){r=""}return wpcdt_pro_set_recuring_data(t,"current_time",t.current_time),null==r||""==r?(wpcdt_pro_set_recuring_data(t,"time_conf",e=JSON.stringify(i)),wpcdt_pro_set_recuring_data(t,"end_time",t.recuring_date)):r&&(wpcdt_pro_get_recuring_data(t,"current_time")<wpcdt_pro_get_recuring_data(t,"end_time")?e=r:(wpcdt_pro_set_recuring_data(t,"time_conf",e=JSON.stringify(i)),wpcdt_pro_set_recuring_data(t,"end_time",t.recuring_date))),e}!function(i){"use strict";jQuery(".wpcdt-desc p:empty").remove(),wpcdt_pro_refresh_completion_text(),jQuery(".wpcdt-timer-ajax").each(function(t){var e=jQuery(this),i=JSON.parse(e.attr("data-conf")),r=(i.timer_id,i.is_caching);"below_timer"==i.content_position?e.find(".wpcdt-timer-js .wpcdt-desc").before('<div class="wpcdt-loading">'+WpCdtPro.loading_text+"</div>"):e.find(".wpcdt-timer-js").after('<div class="wpcdt-loading">'+WpCdtPro.loading_text+"</div>"),1==r&&(r={action:"wpcdt_timer_caching_data",timer_conf:i},jQuery.post(WpCdtPro.ajax_url,r,function(t){1==t.success&&(e.find(".wpcdt-loading").remove(),"content"==i.timer_type?e.find(".wpcdt-ajax-clock").replaceWith(t.data):e.find(".wpcdt-timer-js").append(t.data),wpcdt_pro_all_timer_init(t,e))}))}),wpcdt_pro_all_timer_init(),0==WpCdtPro.elementor_preview&&i(window).on("elementor/frontend/init",function(){i(".wpcdt-timer-circle").each(function(t){var e=i(this).find(".wpcdt-timer-js").attr("id");e+=" .wpcdt-clock-circle",setTimeout(function(){void 0!==e&&e&&jQuery("#"+e).TimeCircles().rebuild()},350)})}),i(document).on("click",".elementor-tab-title",function(){var t=i(this).attr("aria-controls"),t=i("#"+t).find(".wpcdt-timer-circle");i(t).each(function(t){var e=i(this).find(".wpcdt-timer-js").attr("id");e+=" .wpcdt-clock-circle",setTimeout(function(){jQuery("#"+e).TimeCircles().rebuild()},350)})}),i(document).on("click",".fl-accordion-button, .fl-tabs-label",function(){var t=i(this).attr("aria-controls"),t=i("#"+t).find(".wpcdt-timer-circle");i(t).each(function(t){var e=i(this).find(".wpcdt-timer-js").attr("id");e+=" .wpcdt-clock-circle",setTimeout(function(){jQuery("#"+e).TimeCircles().rebuild()},300)})}),i(document).on("click",".et_pb_toggle",function(){var t=i(this).find(".et_pb_toggle_content").find(".wpcdt-timer-circle");i(t).each(function(t){var e=i(this).find(".wpcdt-timer-js").attr("id");i("#"+(e+=" .wpcdt-clock-circle")).css({visibility:"hidden",opacity:0}),void 0!==e&&e&&(jQuery("#"+e).TimeCircles().rebuild(),i("#"+e).css({visibility:"visible",opacity:1}))})}),i(document).on("click",".vc_toggle",function(){var t=i(this).find(".vc_toggle_content .wpcdt-timer-circle");i(t).each(function(t){var e=i(this).find(".wpcdt-timer-js").attr("id");void 0!==(e+=" .wpcdt-clock-circle")&&e&&jQuery("#"+e).TimeCircles().rebuild()})}),i(document).on("click",".vc_tta-panel-title",function(){var t=i(this).closest(".vc_tta-panel").find(".wpcdt-timer-circle");i(t).each(function(t){var e=i(this).find(".wpcdt-timer-js").attr("id");void 0!==(e+=" .wpcdt-clock-circle")&&e&&jQuery("#"+e).TimeCircles().rebuild()})})}(jQuery);