window.tec=window.tec||{},tec.classicEditorEvents=tec.classicEditorEvents||{},tec.classicEditorEvents.sync=tec.classicEditorEvents.sync||{},function(e,t){"use strict";t.selectors={activeType:"a.tribe-button-field.tribe-active",customDateContainer:".recurrence-custom-container",eventStartDate:"#EventStartDate",recurrence:".tribe-event-recurrence",recurrenceSameTimeSelect:".tribe-same-time-select",timeSelect:".tribe-same-time-select"},t.setRecurrenceSameTimeValue=function(){const c=document.querySelectorAll(t.selectors.recurrence);c.length&&c.forEach((function(c){const r=e(c),s=c.querySelector(":scope > .tribe-buttonset "+t.selectors.activeType);if(!s)return;const n=r.find(t.selectors.recurrenceSameTimeSelect);if(n.length&&!tec.classicEditorEvents.offStart.isRuleOffStart(c))if("Date"!==s.getAttribute("data-value"))"yes"!==n.val()&&n.val("yes").trigger("change");else{if("no"===n.val())return;n.val("no").trigger("change")}}))},t.setRecurrenceTimeSelectVisibility=function(){document.querySelectorAll(t.selectors.timeSelect).forEach((function(e){const c=e.closest(t.selectors.recurrence),r=e.closest(".recurrence-row");if(!c||!r)return;const s=c.getAttribute("data-recurrence-type"),n=tec.classicEditorEvents.offStart.isRuleOffStart(c);"Date"===s||n?r.style.removeProperty("display"):r.style.display="none"}))},t.setRuleTypeButtonsetVisibility=function(e){const c=document.querySelectorAll(".tribe-event-"+e+" > .tribe-buttonset");if(!c.length)return;const r=[],s=[];c.forEach((function(e){const c=e.querySelector(t.selectors.activeType);c&&("Date"===c.getAttribute("data-value")?s.push(e):r.push(e))})),r.length?(s.forEach((function(c){c.style.display="none";const r=c.closest(".tribe-event-"+e).querySelector(t.selectors.customDateContainer);r&&(r.style.paddingTop=0)})),r.forEach((function(c){c.style.removeProperty("display");const r=c.closest(".tribe-event-"+e).querySelector(t.selectors.customDateContainer);r&&r.style.removeProperty("padding-top")}))):c.forEach((function(c){c.style.removeProperty("display");const r=c.closest(".tribe-event-"+e).querySelector(t.selectors.customDateContainer);r&&r.style.removeProperty("padding-top")}))},t.setAddRuleButtonVisibility=function(e){const t=document.querySelectorAll(".tribe-event-"+e+' .tribe-recurrence-rule-type:not([value="Date"]):not([value=""])'),c=document.querySelector("#tribe-add-"+e);t.length>1?c.style.display="none":c.style.removeProperty("display")},t.syncRecurrenceState=function(){t.setRecurrenceSameTimeValue(),t.setRecurrenceTimeSelectVisibility(),t.setRuleTypeButtonsetVisibility("recurrence"),t.setAddRuleButtonVisibility("recurrence"),tec.classicEditorEvents.lockedOptions.syncLockedOptionsRuleState("recurrence"),tec.classicEditorEvents.offStart.syncOffStartRuleState("recurrence")}}(jQuery,tec.classicEditorEvents.sync),window.tec=window.tec||{},window.tec.eventsPro=window.tec.eventsPro||{},window.tec.eventsPro.customTablesV1=window.tec.eventsPro.customTablesV1||{},window.tec.eventsPro.customTablesV1.classicEditorEventsSync={};