STRATUS.registerNamespace("STRATUS.PublicRegistrations");STRATUS.PublicRegistrations.Event=function(){var n,t,h=["January","February","March","April","May","June","July","August","September","October","November","December"],i=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],u=["Su","Mo","Tu","We","Th","Fr","Sa"],c=864e5,f=function(n,i,r,u,f){var e={eventId:t,firstName:n,lastName:i,email:r,isResendEmail:f};STRATUS.Helpers.showProcessingMessage();$.ajax({url:STRATUS.Config.SiteUrl+"/PublicRegistrations/MatchRegistrant",type:"POST",data:e,dataType:"json",success:function(n){u(n)},complete:function(){STRATUS.Helpers.hideProcessingMessage()}})},r=function(n){var t=STRATUS.Validation.validateEmail(n);return t||STRATUS.Validation.setMessage("Please enter a valid email address.",{field:$("#email").parent()}),t},e=function(){return $("#name").nameEditor("validate")},o=function(){var i=STRATUS.QueryString.getFirstValue("linkString");i||(i=STRATUS.QueryString.getFirstValue("linkstring"));STRATUS.ClientStorage.setValue(i,{Name:STRATUS.Formatters.formatName(n.Name),IndividualId:n.IndividualId,FamilyId:n.FamilyId,Email:n.Email,Phone:n.Phone,NameParts:n.Name,RegisteredFamilyMembers:n.RegisteredFamilyMembers,RegistrationBatchId:n.RegistrationBatchId});window.location=STRATUS.Config.SiteUrl+"/Registrations/Registrants/"+t+"?linkString="+i+"&congregantView=true"},s=function(t,i){n.IndividualId=t.IndividualId;n.FamilyId=t.FamilyId;n.RegistrationBatchId=t.RegistrationBatchId;n.RegisteredFamilyMembers=t.RegisteredFamilyMembers;var u=t.SiteName&&t.SiteName!==""?t.SiteName:"the church";const r=STRATUS.Formatters.getPersonalizedTerm("church");t.CanLogin||t.IsRegistered||o();t.CanLogin&&(n.RegistrationMessage="We know you! Enter your password to sign in to Realm.",n.ShowSignInPrompt=!0);t.IsRegistered&&(t.CanLogin&&!i?n.RegistrationExistsMessage="We have a registration that matches your name and email address.  To manage your registration, enter your password to sign in to Realm.":(n.RegistrationExistsMessage="We have a registration that matches your name and email address. We have sent you an email confirmation if you need to make a payment or access your registration details. ",n.RegistrationExistsMessage=t.CanLogin?n.RegistrationExistsMessage+"You can also enter your password to sign in to Realm and manage your registration.":n.RegistrationExistsMessage+"For additional help with your registration, contact the "+r+"."))},l=function(n,t,i){var r={email:n,password:t};STRATUS.Helpers.showProcessingMessage();$.ajax({url:STRATUS.Config.SiteUrl+"/PublicRegistrations/AuthenticateRegistrant",type:"POST",data:r,dataType:"json",success:function(n){i(n)},complete:function(){STRATUS.Helpers.hideProcessingMessage()}})},a=function(n){n.Success?(STRATUS.Helpers.showProcessingMessage(),window.location=STRATUS.Config.SiteUrl+"/Registrations/Registrants/"+t+"?congregantView=true"):STRATUS.Validation.setMessage("Invalid Email or Password.",{field:$("#password").parent()})},v=function(){$("#toggle-remaining-icon").is(".icon-caret-down")?($("#remaining-occurrences").removeClass("hidden"),$("#toggle-remaining-text").text("Show less"),$("#toggle-remaining-icon").removeClass("icon-caret-down").addClass("icon-caret-up")):($("#remaining-occurrences").addClass("hidden"),$("#toggle-remaining-text").text("Show all"),$("#toggle-remaining-icon").removeClass("icon-caret-up").addClass("icon-caret-down"))},y=function(n,t,r,f,e,o,s,l){var a=new Date,k,w,g,nt,rt,tt,it;t>=0&&n>0?a=new Date(n,t,1):n>0?a=new Date(n,0,1):a.setDate(1);var ut=$('<div class="dpCalendar dpStaticCalendar"><\/div>'),ft=$('<table class="dpHeader not-responsive"><tr><td>'+h[t]+" "+n+"<\/td><\/tr><\/table>"),b=$('<table cols="7" class="dpBody not-responsive"><\/table>'),p=[];for(p.push("<thead>"),p.push("<tr>"),k=0;k<u.length;k++)p.push("<th>"),p.push(u[k]),p.push("<\/th>");for(p.push("<\/tr>"),p.push("<\/thead>"),b.append(p.join("")),w=$("<tr><\/tr>"),g=0;g<a.getDay();g++)w.append('<td class="no-hover">&nbsp;<\/td>');nt=null;do{var v=a.getDate(),d=a.getDay(),y=$('<td class="no-hover">'+v+"<\/td>");if(a>=o&&a<=s)if(r==="Weekly"&&e===i[d]&&y.addClass("highlight"),r==="Bi-Weekly"&&e===i[d])l||(l=new Date(a)),rt=Math.round((a.getTime()-l.getTime())/c),rt%2==0&&y.addClass("highlight");else if(r==="Monthly"&&e===i[d]){nt!==a.getMonth()&&(nt=a.getMonth());switch(f){case"First":v<=7&&y.addClass("highlight");break;case"Second":v>7&&v<=14&&y.addClass("highlight");break;case"Third":v>14&&v<=21&&y.addClass("highlight");break;case"Fourth":v>21&&v<=28&&y.addClass("highlight");break;case"Fifth":v>28&&y.addClass("highlight");break;case"Last":tt=new Date(a);tt.setDate(a.getDate()+7);tt.getMonth()!==a.getMonth()&&y.addClass("highlight")}}w.append(y);d===6&&(b.append(w),w=$("<tr><\/tr>"));a.setDate(v+1)}while(a.getDate()>1);if(a.getDay()>0)for(it=6;it>a.getDay();it--)w.append('<td class="no-hover">&nbsp;<\/td>');return w.html().length!==0&&b.append(w),$("#dates-container").append($("<li><\/li>").append(ut.append(ft).append(b))),l};return{init:function(i,u,h,c){t=i;c.TotalRegistrations=0;STRATUS.PublicRegistrations.ForgotPassword.init();$(document).on("click","#toggle-remaining-occurences",v);$(document).on("click","#forgot-password-dialog-link",function(){$("#forgot-password-dialog").lightBox("show")});$(document).on("click","#show-resend-registration-lightbox",function(){$("#resend-registration-lightbox").lightBox("show")});n=new Vue({el:"#event-page",data:{event:c,orgId:u,imageUrl:"",hasImage:!1,RegistrationMessage:'<p class="text-large text-bold text-margined">First, enter your own information below.<\/p><p class="text-small text-margined">'+(c.AcceptsNamedGuests||c.AcceptsUnnamedGuests?"You’ll enter information about the people attending this event on the next page.":"If you have a Realm account and log in, you can select family members to attend with you on the next page. If you continue as a guest, you can only register yourself.")+'<\/p> <p class="text-small"><a href="javascript: void(0);" id="show-resend-registration-lightbox">Already registered?<\/a><\/p>',Name:{},IndividualId:null,FamilyId:null,Email:"",Password:"",Phone:"",Matched:!1,Loading:!1,ShowSignInPrompt:!1,RegistrationExistsMessage:"",RegisteredFamilyMembers:null,RegistrationBatchId:null,RegisteredFamilMembers:null,IsPublicRegistrationAvailable:h},components:{"event-detail-component":STRATUS.Registrations.RegistrationEvent.eventDetailComponent},methods:{match:function(){var n=e(),t=r(this.Email);t&&n&&f(this.Name.FirstName,this.Name.LastName,this.Email,s,!1)},resendRegistration:function(){var n=e(),t=r(this.Email);t&&n&&f(this.Name.FirstName,this.Name.LastName,this.Email,this.resendRegistrationCallback,!0)},resendRegistrationCallback:function(n){if(!n.IsRegistered){STRATUS.Validation.setMessage("The email and name doesn't match an existing registration.");return}$("#resend-registration-lightbox").lightBox("hide");s(n,!0)},signin:function(){l(this.Email,this.Password,a)},isValidName:function(){this.ValidName=this.Name.FirstName.length>0&&this.Name.LastName.length>0},isValidEmail:function(){var n=r(this.Email);this.ValidEmail=n},continueAsGuest:function(){o()},setHasImage:function(n){const i=this,t=new XMLHttpRequest;t.open("GET",n,!0);t.responseType="blob";t.onreadystatechange=function(){t.readyState===4&&(i.hasImage=t.status===200)};t.send()},getImageUrl:function(){const n=this;n.imageUrl=STRATUS.Formatters.getImageUrl(n.event.EventId,18,{Redirect:!1});n.setHasImage(n.imageUrl)}},computed:{isSignInDisabled:function(){return this.Password.length>0&&STRATUS.Validation.validatePassword(this.Email,this.Password).length===0?!1:!0}},mounted:function(){this.$nextTick(function(){this.getImageUrl()})}})}}}();STRATUS.PublicRegistrations.ForgotPassword=function(){let n;return{init:function(){n=new Vue({el:"#forgot-password-dialog",methods:{forgotPassword:function(){this.validateForm()&&($("#sendEmail").prop("disabled",!0),$.ajax({url:STRATUS.Config.SiteUrl+"/Account/ForgotPassword",data:{Email:$("#emailAddress").val()},success:function(){$("#forgot-password-dialog").lightBox("hide");$("#emailSuccessForm").show()},complete:function(){$("#sendEmail").prop("disabled",!1);$.growler({content:"Please check your email. We are sending you instructions to reset your password.",type:"success"})}}))},validateForm:function(){var n=$("#emailAddress"),t=n.val();return(STRATUS.Validation.clearMessage(),$.trim(t).length==0)?(STRATUS.Validation.setMessage("Please enter an email address.",{field:n.parent()}),!1):STRATUS.Validation.validateEmail(t)?!0:(STRATUS.Validation.setMessage("Please enter a valid email address.",{field:n.parent()}),!1)}}});$("#sendEmail").click(n.forgotPassword)}}}()