(()=>{var t,e;tribe.events=tribe.events||{},tribe.events.apiSettingsAdmin=tribe.events.apiSettingsAdmin||{},t=jQuery,(e=tribe.events.apiSettingsAdmin).selectors={apiContainer:".tec-settings-api-application",accountDetailsContainer:".tec-settings-api-account-details",accountMessageContainer:".tec-api-accounts-messages",accountStatus:".tec-events-virtual-meetings-api-settings-switch__input.account-status",deleteAccount:".tec-settings-api-account-details__delete-account",refreshAccount:".tec-settings-api-account-details__account-refresh"},e.handleRefreshAccount=function(e){if(e.preventDefault(),!confirm(t(this).data("confirmation")))return;const n=t(this).data("apiRefresh");window.location=n},e.handleAccountStatus=function(){const n=t(this),c=n.data("ajaxStatusUrl");n.prop("disabled",!0),t.ajax(c,{contentType:"application/json",context:n,success:e.onAccountStatusSuccess})},e.onAccountStatusSuccess=function(n){t(this).closest(e.selectors.apiContainer).find(e.selectors.accountMessageContainer).html(n),t(this).prop("disabled",!1);const c=t(this).closest(e.selectors.accountDetailsContainer);c.find(e.selectors.refreshAccount).prop("disabled",(function(t,e){return!e})),c.find(e.selectors.deleteAccount).prop("disabled",(function(t,e){return!e}))},e.handleDeleteAccount=function(n){if(n.preventDefault(),!confirm(t(this).data("confirmation")))return;const c=t(this).data("ajaxDeleteUrl");t.ajax(c,{contentType:"application/json",context:t(this).closest(e.selectors.accountDetailsContainer),success:e.onAccountDeleteSuccess})},e.onAccountDeleteSuccess=function(n){t(this).closest(e.selectors.apiContainer).find(e.selectors.accountMessageContainer).html(n),t(".error",t(e.selectors.accountMessageContainer)).length>0||t(this).remove()},e.bindEvents=function(){t(e.selectors.apiContainer).on("click",e.selectors.refreshAccount,e.handleRefreshAccount).on("click",e.selectors.accountStatus,e.handleAccountStatus).on("click",e.selectors.deleteAccount,e.handleDeleteAccount)},e.ready=function(){e.bindEvents()},t(e.ready),window.tec=window.tec||{},window.tec.eventsPro=window.tec.eventsPro||{},window.tec.eventsPro.eventsVirtualApiSettings={}})();