1new function($){const toggleQuestionState=function(enable){const invisible=this.attr("data-invisible")=="1",disabled=this.attr("data-disabled")=="1";invisible||disabled?invisible&&!disabled?this.enable(enable):!invisible&&disabled&&this.show(enable):this.showAndEnable(enable)};$.fn.extend({toggleQuestion:function(enable){let hiddenBySectionCondition=!1;this.attr("data-hidden-by-condition",enable?null:"1");enable&&this.hasClass("form_question")&&this.closest(".form_page[data-hidden-by-condition]").length>0?(this.attr("data-hidden-by-section-condition","1").showAndEnable(!1),hiddenBySectionCondition=!0):this.attr("data-hidden-by-section-condition")=="1"&&this.attr("data-hidden-by-section-condition",null);hiddenBySectionCondition||toggleQuestionState.call(this,enable);enable&&this.hasClass("form_page")&&(this.children('.form_question[data-hidden-by-section-condition = "1"]').attr("data-hidden-by-section-condition",null).each(function(){toggleQuestionState.call($(this),enable)}),this.children('.form_question[data-hidden-by-condition = "1"]').each(function(){toggleQuestionState.call($(this),!1)}),this.find(".replicate_template").showAndEnable(!1));this.trigger("field_status_change")}});window.FormFiller=function(el){const _this=this,form=el;let inited=!1,fields={},serverLogicFunctions=[],initialLogicExecution=!1;const readOnlyStyle={border:"1px solid var(--fw-table-row-border, #cccccc)",color:"#666666"},replicateFormulaSelector='[data-formula *= "@*"],[data-formula *= "sum(*)"]',init=function(){if(inited!=!0&&form.data("init")!=!0){inited=!0;form.data("init",!0);const qs=form.find(".form_question");form.find("a.address_copy").on("click",function(){return copyAddress(this),!1});for(let i=0;i<qs.length;i++){const q=qs.eq(i);let rs;if(rs=q.attr("data-type")=="signature"?q.find("input[type=hidden]"):q.find("input[type=checkbox],input[type=radio],input[type=text],input[type=email],input[type=tel],input[type=file],select,textarea"),q.data("disabled")=="1")rs.prop("disabled",!0).attr("data-disabled","1").css(readOnlyStyle);else if(q.data("readonly")=="1"){rs.prop("readOnly",!0).css(readOnlyStyle).on("change",change);const rs2=q.find("input[type=checkbox],input[type=radio],input[type=file],select");rs2.length>0&&(rs2.prop("disabled",!0).attr("data-disabled","1"),rs2.each(function(){const rs2el=$(this);if(rs2el.prop("tagName")=="SELECT"&&rs2el.prop("multiple")){var opts=rs2el.find("option:selected"),i=0;opts.each(function(){var opt=$(this);i++;$('<input type="hidden" />').attr("name",rs2el.attr("name")).attr("id",rs2el.attr("id")+"_"+i.toString()+"_hidden").attr("value",opt.attr("value")).insertBefore(rs2el)})}else $('<input type="hidden" />').attr("name",rs2el.attr("name")).attr("id",rs2el.attr("id")+"_hidden").insertBefore(rs2el),rs2el.on("change",function(){var id=$(this).prop("id")+"_hidden",rshf=$(document.getElementById(id)),text;rshf.val($(this).val());text=$(this).text();$(this).is("select")&&(text=$(this).find("option:selected").text());rshf.attr("data-text",text);$(this).is("input[type=checkbox],input[type=radio]")&&($(this).prop("checked")?rshf.prop("disabled",!1):rshf.prop("disabled",!0).attr("data-disabled","1"))}).triggerHandler("change")}))}else{rs.on("click keyup change",change);q.data("required")=="1"&&rs.attr("required","required")}fields[q.data("export")==null?q.data("id"):q.data("export")]=q.data("id")}try{const utm=JSON.parse(sessionStorage.getItem("ping_utm")||"{}");for(let i of["utm_source","utm_medium","utm_term","utm_content","utm_campaign"])utm[i]!=null&&form.find('input[name = "'+i+'"]').length==0&&$('<input type="hidden" />').attr("name",i).val(utm[i]).appendTo(form)}catch{}const formElement=form.closest("form"),embedElement=formElement.attr("data-embed")!=null?document.getElementById(formElement.attr("data-embed")):null;formElement.on("ready",()=>{embedElement!=null&&embedElement.dispatchEvent(new CustomEvent("ready"))}).on("ready-payments",()=>{embedElement!=null&&embedElement.dispatchEvent(new CustomEvent("ready-payments"))}).trigger("ready").attr("data-ready","1")}},replicate=function(el){el=$(el);FW.Progress.Load();setTimeout(function(){var template,destination,form_id,form,scripts,i;try{template=el.parents("tbody").prevAll("tbody.replicate_template").eq(0);destination=el.closest("tbody");template.attr("data-count")==null&&template.attr("data-count",0);template.attr("data-index")==null&&template.attr("data-index",0);template.attr("data-count",parseFloat(template.attr("data-count"))+1);template.attr("data-index",parseFloat(template.attr("data-index"))+1);const templateUuid=template.attr("data-index"),template_html=$('<tbody class="replicate_destination" data-replicate_id="'+templateUuid+'" />').append($(template.html().replace(/_ID_/g,templateUuid)));template_html.find(".maxlength_enabled").removeClass("maxlength_enabled");template_html.find(".minlength_enabled").removeClass("minlength_enabled");template_html.enable();template_html.find(".replicate_delete").on("click",function(){return replicate_delete(this),!1});for(template_html.insertBefore(destination),form||(form_id=$(el).closest("form").find("[name='id']").val()||$(el).closest("form").find("[id^='form_page_']").has(".form_pages").attr("id").replace("form_page_",""),form=window["form_"+form_id]),scripts=template_html.find(".x-script"),template_html.find(".form_question").each(function(){var textel=$(this).find("input[type=checkbox],input[type=radio],input[type=text],input[type=email],input[type=tel],input[type=file],select,textarea");if(textel.data("readonly")!="1"&&textel.data("disabled")!="1")textel.on("click keyup change",change)}),initialLogicExecution=!0,i=0;i<scripts.length;i++)eval(scripts.eq(i).text());_this.initializeCalculatedFields(template_html);_this.initializeFieldLimits(template_html);initialLogicExecution=!1;el.closest("form").find(replicateFormulaSelector).trigger("recalculate");replicate_renumber(el.closest("table"));form.getForm().trigger("replicate")}finally{FW.Progress.Unload()}},1)},replicate_renumber=function(el){el=$(el);const tbodies=el.find("tbody.replicate_destination");for(var i=0;i<tbodies.length;i++)tbodies.eq(i).find(".replicate_number").text((i+1).toString());const template=el.find("tbody.replicate_template").eq(0),limit=template.attr("data-limit"),minlength=template.attr("data-minlength");if(template.attr("data-count",tbodies.length.toString()),limit!=null){const limitFloat=parseFloat(limit);el.find("tbody.replicate_insert_container").show(tbodies.length<limitFloat)}if(minlength!=null){const minlengthFloat=parseFloat(minlength);el.find(".replicate_delete").show(tbodies.length>minlengthFloat)}},replicate_delete=function(el){if(!confirm("Are you sure that you want to delete this entry?"))return!1;el=$(el);const table=el.parents("table").eq(0);return el.parents("tbody").eq(0).remove(),table.closest("form").find(replicateFormulaSelector).trigger("recalculate"),replicate_renumber(table),!1},resetPaymentTerminal=function(){const paymentIntentId=$("#payment_intent_id",form);if(paymentIntentId.length>0&&paymentIntentId.closest("form").data("token_set")==1){const setupIntentId=$("#setup_intent_id",form);let payment_status=$(".terminal_payment_status");payment_status.attr("data-complete","0").text("");setupIntentId.val("");paymentIntentId.val("");paymentIntentId.closest("form").data("token_set",0);$("#stripe_section,#paypal_section").showAndEnable(!0);$(".terminal_payment_status_container").hide()}},formatMoney=function(amt,currency){let displayAmount=currency=="USD"?$.formatNumber(Math.abs(amt),{format:"$#,##0.00",locale:"us"}):$.formatNumber(Math.abs(amt),{format:"#,##0.00",locale:"us"})+" "+currency;return amt<0&&(displayAmount="("+displayAmount+")"),displayAmount},initializePayments=function(){const terminalService=$("a.terminal_payment",form).attr("data-href"),resetReader=function(){const formData=new FormData;formData.append("cmd","prepare");navigator.sendBeacon(terminalService,formData)};$(".payment_question",form).each(function(){const payment_question=$(this).val();if(payment_question!=null){const formElement=form.closest("form"),mode=$("#"+payment_question+"_mode",form).val();if($("#"+payment_question+"_amount",form).addClass("payment_amount").on("change",function(){const currentState=JSON.stringify({enabled:$(this).is(":enabled"),value:$(this).val()});if($(this).data("currentState")!=currentState){$(this).data("currentState",currentState);let amt=parseFloat($(this).val());amt<0&&(amt=0);const currency=$("#"+payment_question+"_currency",form).val(),displayAmount=formatMoney(amt,currency);if($("#payment_display_"+payment_question,form).html(displayAmount),$("#"+payment_question+"_summary",form).val("Payment Due: "+$.formatNumber(amt,{format:"0.00",locale:"us"})+" "+currency),$(".form_paymentItemAmountDisplay").each(function(){const paymentAmount=parseFloat($(this).siblings(".form_paymentItemAmount").val());$(this).text(formatMoney(paymentAmount,currency))}),mode!="calculate"&&($("#due",form).val(amt).triggerHandler("change"),$(".displayAmount",form).html(displayAmount),$("#originalAmount",form).val(amt)),$("#"+payment_question+"_amount",form).closest(".form_question").attr("data-amount",amt),$("a.terminal_payment",form).length>0&&location.pathname.startsWith("/manage/")&&FW.getCookie("_terminal_reader")!=null){const cart=[];$(this).is(":enabled")&&$('.form_question[data-type = "paymentAmount"]:has(input.form_paymentAmount:enabled)',form).each(function(){const lineItem={qty:$(this).find(".form_paymentItemQuantity").length==1?parseFloat($(this).find(".form_paymentItemQuantity").val())||0:1,item:$(this).find(".form_paymentItemName").val()||"Item",amount:$(this).find(".form_paymentAmount").val()};lineItem.item!=null&&lineItem.qty>0&&cart.push(lineItem)});const hash=FW.getHashCode(amt.toString()+currency+JSON.stringify(cart));$(this).data("terminal-hash")!=hash&&($(this).data("terminal-hash",hash),resetPaymentTerminal(),$.ajax({url:$("a.terminal_payment",form).attr("data-href"),method:"POST",data:{cmd:"prepare",amount:amt,currency:currency,cart:JSON.stringify(cart)}}))}}}).trigger("change"),mode.includes("stripe"))formElement.on("submit",function(){if($('input.form_submit_parameters[name = "cmd"]').val()!="save"){$("input.payment_amount",form).trigger("recalculate");const amt=parseFloat($("#"+payment_question+"_amount",form).val());if($(".payment_stripe:enabled",form).length!==0&&amt!=0)return $("#paypal_order_no",form).val()||$("#dafpay_session",form).val()?void 0:($("#"+payment_question+"_mode",form).val("stripe"),formElement.data("token_set")==1&&($("#payment_token:enabled",form).val()||$("#payment_intent_id:enabled",form).val()||$("#setup_intent_id:enabled",form).val()))?void 0:(sendDataToStripe(function(response){response.error?(alert(response.error.message),FW.Progress.Unload()):formElement.fireNext()}),!1)}});if(mode.includes("paypal")&&$("#paypal_client_id",form).val()&&FW.Require(["js:https://www.paypal.com/sdk/js?disable-funding=card,credit&enable-funding=venmo&intent=capture&client-id="+$("#paypal_client_id",form).val()+"&merchant-id="+$("#paypal_merchant_id",form).val()],function(){paypal.Buttons({style:{layout:FW.isMobile()?"vertical":"horizontal",tagline:"false",color:"white",height:30},onInit:function(data,actions){$("#"+payment_question+"_amount",form).on("change",function(){var amt=$("#"+payment_question+"_amount",form).val();!amt||parseFloat(amt)<=0?actions.disable():actions.enable()}).triggerHandler("change")},createOrder:function(data,actions){return $("#stripe_section,#make_recurring",form).showAndEnable(!1),actions.order.create({purchase_units:[{amount:{value:$("#"+payment_question+"_amount",form).val()}}],intent:"CAPTURE"})},onCancel:function(){$("#stripe_section,#make_recurring",form).showAndEnable(!0)},onApprove:function(data){$("#payment_type",form).val("CC");$("#paypal_order_no",form).val(data.orderID);$("#"+payment_question+"_mode",form).val("paypal");$("#"+payment_question+"_amount",form).data("calc-final",$("#"+payment_question+"_amount",form).val());$("#payment_form",form).after("<p>Your payment information has been authorized and the payment will complete after clicking Submit.<\/p>")}}).render("#paypal-button-container")}
1),mode.includes("dafpay")&&FW.Require(["https://cdn.givechariot.com/chariot-connect.umd.js"],function(){const chariot=document.getElementById("chariot");chariot.onDonationRequest(async()=>({amount:parseFloat($("#due").val())*100}));chariot.addEventListener("CHARIOT_SUCCESS",({detail})=>{$("#payment_type",form).val("CC"),$("#dafpay_session",form).val(detail.workflowSessionId),$("#"+payment_question+"_mode",form).val("dafpay"),$("#stripe_section,#paypal_section,#make_recurring",form).showAndEnable(!1),$("#dafpay_section",form).hide(),$("#payment_form",form).after("<p>Your DAF information has been collected and will complete after clicking Submit.<\/p>")})}),mode=="calculate")formElement.on("submit",function(){$("input.payment_amount",form).trigger("recalculate")})}});$("a.terminal_payment",form).length>0&&location.pathname.startsWith("/manage/")&&window.addEventListener("unload",resetReader)},initializeCap=function(){const formElement=form.closest("form");if(formElement.find('input[name = "sk"]').length>0)formElement.on("submit",function(){const securityKeyElement=formElement.find('input[name = "sk"]'),securityKeyService=securityKeyElement.attr("data-service"),iframe=document.createElement("iframe"),eventListener=window.addEventListener("message",function(event){event.source===iframe.contentWindow&&(event.data.event==="cap.ready"?iframe.contentWindow.postMessage({event:"cap.solve"},"*"):event.data.event==="cap.error"?(console.error("Cap error:",event.data.error),alert("Error generating captcha token."),FW.Progress.Unload(),iframe.remove(),window.removeEventListener("message",eventListener)):event.data.event==="cap.solve"&&(securityKeyElement.val(event.data.result),formElement.fireNext(),iframe.remove(),window.removeEventListener("message",eventListener)))});return iframe.hidden=!0,iframe.src=securityKeyService,document.body.append(iframe),!1})};this.ready=function(){initializePayments();initializeCap()};this.filterArray=function(array,filterByArray){var arrayOut,i;for($.isArray(filterByArray)||(filterByArray=[filterByArray]),arrayOut=[],i=0;i<array.length;i++)filterByArray.indexOf(array[i])>-1&&arrayOut.push(array[i]);return arrayOut};this.appendServerLogic=function(event){serverLogicFunctions.push(event)};this.initializeReplicates=function(){$(".replicate_template",form).each(function(){var template=$(this),template_table,x,el,scripts,i;template.disable();template_table=template.closest("table");template_table.find(".replicate_insert").on("click",function(){return replicate(this),!1});template_table.find(".replicate_delete").on("click",function(){return replicate_delete(this),!1});const minlength=parseFloat(template.attr("data-minlength")||"0"),template_count=parseFloat(template.attr("data-count")||"0"),template_index=parseFloat(template.attr("data-index")||"0"),template_init=minlength>template_count?minlength:template_count;if(template_init>0)for(x=0;x<template_init;x++){if(el=$(".replicate_insert",template_table),el.length>0&&x>=template_count)replicate(el);else{const template_uuid=(template_index+x).toString(),template_html=$(template.html().replace(/_ID_/g,template_uuid));for(scripts=template_html.find(".x-script"),initialLogicExecution=!0,i=0;i<scripts.length;i++)eval(scripts.eq(i).text());initialLogicExecution=!1;el.closest("form").find(replicateFormulaSelector).trigger("recalculate")}x<=minlength&&$(".replicate_destination",template_table).eq(x).find(".replicate_delete").remove()}})};this.initializeLogic=function(){initialLogicExecution=!0;for(var i=0;i<serverLogicFunctions.length;i++)serverLogicFunctions[i]();form.find('.form_responses:has([data-handler-change="1"])').each(function(){$(this).find("[data-handler-change]:eq(0)").triggerHandler("change")});form.find('.form_responses [data-bubbling="1"]').attr("data-bubbling",null);form.find(".form_loading:eq(0)").hide();form.find(".form_pages:eq(0)").show();$(".form_action").show();initialLogicExecution=!1};this.getForm=function(){return form};this.getItem=function(selectorPrefix,selectorSuffix,args){let el=null;for(let i=0;i<args.length;i++){let el2=form.find(selectorPrefix+FW.escapeSelector(args[i])+selectorSuffix);el=el==null?el2:el.add(el2)}return el==null&&(el=$([])),el};
1this.getSection=function(){return this.getItem('.form_page[data-export = "','"]',arguments)};this.getSectionById=function(){return this.getItem('.form_page[data-id = "','"]',arguments)};this.getQuestion=function(){return this.getItem('.form_question[data-export = "','"]',arguments)};this.getQuestionById=function(){return this.getItem('.form_question[data-id = "','"]',arguments)};this.getElementById=function(){var item=this.getItem('[name ^= "form_','"]',arguments);return item&&item.length!=0||(item=this.getQuestionById(arguments[0]).find("[name]")),item};this.getElement=function(){var item=this.getItem('[name ^= "form_','"]',$.map(arguments,function(arr){return fields[arr]}));return item&&item.length!=0||(item=this.getQuestion(arguments[0]).find("[name]")),item};this.getValueById=function(id){let question=this.getQuestionById(id);var type=question.data("type"),dataType=question.data("datatype");let val=this.getValueArrayById(id);return val.length==0?null:type=="birthdate"||type=="date"||type=="calendar"||dataType=="int"||dataType=="real"||dataType=="date"||dataType=="datetime"?val[0]:val.join(",")};this.getValue=function(key,container){var val=this.getValueArray(key,container);return val.length==0?null:val.length==1?val[0]:val.join(",")};this.getText=function(key){var val=this.getTextArray(key);return val.length==0?null:val.length==1?val[0]:val.join(",")};this.getLocalDate=function(date){return new Date(date.getTime()+date.getTimezoneOffset()*6e4)};this.getValueArray=function(key,container){return this.getValueArrayById(fields[key],container)};this.getValueArrayForReplicate=function(key){var id=fields[key];id.indexOf("^")>=0&&(id=id.substr(0,id.indexOf("^")));var selector='[name ^= "form_'+id+'"]',allFields=$(selector),currFrm=this;return $.map(allFields,function(item){var currId=item.id;return currId=currId.replace("form_",""),currFrm.getValueById(currId)})};this.getTextArray=function(key){return this.getTextArrayById(fields[key])};this.getTextArrayById=function(id){return this.getValueArrayByIdValue(id,"text")};this.getValueArrayById=function(id){return this.getValueArrayByIdValue(id,"value")};this.getValueArrayByIdValue=function(id,valuetype,container){let question=this.getQuestionById(id);if(question.length==0)return[];container||(container=form);let type=question.data("type"),dataType=question.data("datatype");dataType||(dataType="text");let val2=[];if(type=="date"||type=="birthdate"){let field_val="";container.find('[name="form_'+id+'"]:enabled').val()?field_val=container.find('[name="form_'+id+'"]:enabled').val():container.find('[name="form_'+id+'_y"]:enabled').val()&&container.find('[name="form_'+id+'_m"]:enabled').val()&&container.find('[name="form_'+id+'_d"]:enabled').val()&&(field_val+=container.find('[name="form_'+id+'_y"]:enabled').val()+"-"+container.find('[name="form_'+id+'_m"]:enabled').val()+"-"+container.find('[name="form_'+id+'_d"]:enabled').val());try{field_val=this.getLocalDate(new Date(field_val))}catch(ex){}val2.push(field_val)}else if(type=="dateym"){let field_val="";container.find('[name="form_'+id+'"]:enabled').val()?field_val=container.find('[name="form_'+id+'"]:enabled').val():container.find('[name="form_'+id+'_y"]:enabled').val()&&container.find('[name="form_'+id+'_m"]:enabled').val()&&(field_val+=container.find('[name="form_'+id+'_y"]:enabled').val()+"-"+container.find('[name="form_'+id+'_m"]:enabled').val()+"-01");try{field_val=this.getLocalDate(new Date(field_val))}catch(ex){}val2.push(field_val)}else if(type=="datemd"){let field_val="";container.find('[name="form_'+id+'"]:enabled').val()?field_val=container.find('[name="form_'+id+'"]:enabled').val():container.find('[name="form_'+id+'_m"]:enabled').val()&&container.find('[name="form_'+id+'_d"]:enabled').val()&&(field_val+=(new Date).getFullYear().toString()+"-"+container.find('[name="form_'+id+'_m"]:enabled').val()+"-"+container.find('[name="form_'+id+'_d"]:enabled').val());try{field_val=this.getLocalDate(new Date(field_val))}catch(ex){}val2.push(field_val)}else if(type=="address"){let address={};address.street=container.find('[name = "form_'+id+'_street"]:enabled').val();address.region=container.find('[name = "form_'+id+'_region"]:enabled').val();address.country=container.find('[name = "form_'+id+'_country"]:e
1nabled').val();address.city=container.find('[name = "form_'+id+'_city"]:enabled').val();address.postal=container.find('[name = "form_'+id+'_postal"]:enabled').val();val2.push(address)}else if(type=="plugin:event"){let val=container.find('[name = "form_'+id+'_event"]:enabled');val=val.filter('input[type = "checkbox"]:checked,input[type = "hidden"]');val.each(function(){let event_value=new URLSearchParams($(this).val()).get("id");val2.push(event_value)})}else{let val=container.find('[name = "form_'+id+'"]:enabled');if(val.length==0&&(val=this.getQuestionById(id).find("[name]:enabled")),val.length>0){val=val.filter('input[type = "checkbox"]:checked,input[type = "radio"]:checked,input[type = "text"],input[type = "hidden"],input[type = "email"],input[type = "tel"],textarea,select');val.is("select")&&(val=val.find("option:selected"));let self=this;val.each(function(){var field_val=valuetype=="text"?$(this).attr("data-text"):$(this).val();if((dataType=="int"||dataType=="real")&&(field_val=field_val.replace(/[^\d.-]/g,"")),dataType=="int")field_val=parseInt(field_val,10);else if(dataType=="real")field_val=parseFloat(field_val);else if(type=="calendar"||dataType=="date"||dataType=="datetime")try{field_val=self.getLocalDate(new Date(field_val))}catch(ex){}val2.push(field_val)})}}return val2};this.getValueForCalculation=function(key,replicateId){var selected,newval;let question=null;question=replicateId?form.find('[data-replicate_id = "'+replicateId+'"] .form_question[data-export = "'+FW.escapeSelector(key)+'"]'):this.getQuestion(key);question.length>1&&question.has(":input:enabled").length>0&&(question=question.has(":input:enabled"));let val=0;if($.inArray(question.data("datatype"),["int","real"])>=0&&$.inArray(question.data("type"),["select","checkbox","radio","likert","text","selectable"])>=0){switch(question.data("type")){case"select":val=question.find("option:selected").val();val&&val.length>10&&(val=question.find("option:selected").text());break;case"checkbox":case"selectable":case"radio":selected=question.find("input:checked");val=selected.val();val&&val.length>10&&(val=question.find("label[for="+selected.prop("id")+"]").text());break;case"likert":selected=question.find("input:checked");val=selected.val();val&&val.length>10&&(val=selected.data("label"));break;case"text":val=question.find(":input").val()}if(val&&(val=val.replace(/[^\d.-]/g,"")),question.data("datatype")=="int")val=parseInt(val,10);else if(question.data("datatype")=="real")val=parseFloat(val);else if(question.data("datatype")=="date"||question.data("datatype")=="datetime")try{newval=self.getLocalDate(new Date(val));val=newval}catch(ex){}}else val=replicateId?this.getValue(key,form.find('[data-replicate_id = "'+replicateId+'"]')):this.getValue(key);return question.has(":input:enabled").length==0&&question.attr("data-hidden-by-condition")=="1"?typeof val=="number"?0:null:typeof val=="number"&&isNaN(val)?0:val};this.setValue=function(key,value){var val=form.find('[name = "form_'+fields[key]+'"]'),nodes=val.filter("input[type=text],input[type=email],input[type=tel],textarea"),i;if(nodes.length==1){nodes.val(value);return}for(nodes=val.filter("input[type=checkbox],input[type=radio],select"),nodes.is("select")&&(nodes=nodes.find("option")),i=0;i<nodes.length;i++)nodes.eq(i).val()==value&&(nodes.eq(i).prop("nodeName")=="OPTION"?nodes.eq(i).prop("selected",!0):nodes.eq(i).prop("checked",!0))};this.addCountdown=function(key,count,isWords){var el=this.getElement(key),helpName,countConfig;isWords||el.attr("maxlength",count);helpName=key.replace(/[ :]/g,"_");countConfig="{ help: '#"+helpName+"_maxlength'";countConfig+=isWords?", words: "+count+" }":" }";el.attr("data-maxlength",countConfig);el.after("<div id='"+helpName+"_maxlength' style='text-align: right; color: inherit; width:370px;'>"+count+" "+(isWords?"words":"characters")+" remaining<\/div>")};this.addCharacterCountdown=function(key,charCount){this.addCountdown(key,charCount,!1)};this.addWordCountdown=function(key,wordCount){this.addCountdown(key,wordCount,!0)};var copyAddress=function(el){el=$(el);$(".form_responses",$("#form_question_"+el.data("id"))).children().each(function(){if($(this).prop("id")){var copyfromfield=$("#"+$(this).prop("id").replace(el.data("id"),el.data("copy")));copyfromfield.length>0&&$(this).val(copyfromfield.val()).triggerHandler("change")}})};const change=function(event){var field,country,hasFile,hasText;const self=$(this),el=self.parents("div.form_question").eq(0);if(el.hasClass("required")){const el2=el.find(".form_responses"),type=el.data("type");if(type=="text"||type=="email"||type=="tel"||type=="signature"||type=="secret"){if(el2.find("input").val()=="")return}else if(type=="textarea"){if(el2.find("textarea").val()=="")return}else if(type=="select"||type=="multiselect"){if(el2.find("select").val()=="")return}else if(type=="checkbox"||type=="radio"||type=="likert"){if(el2.find("input:checked").length==0)return}else if(type=="birthdate"||type=="date"){if(field=el2.find("select"),field.eq(0).val()==""||field.eq(1).val()==""||field.eq(2).val()=="")return}else if(type=="dateym"||type=="datemd"){if(field=el2.find("select"),field.eq(0).val()==""||field.eq(1).val()=="")return}else if(type=="address"){if(country=el2.find("select:last").val(),el2.find("textarea").val()==""||el2.find("input[type=text]").eq(0).val()=="")return;if(country=="US"&&field==null&&(field=el2.find("select:visible").eq(0),field.val()==""))return}else if(type=="location"||type=="location_nopostal"){if(el2.find("input[type=text]").eq(0).val()=="")return}else if(type=="plugin:event"){if(el2.find("input:checked").length==0)return}else if(type=="plugin:material"){if(hasFile=el2.find("input[type=file]").eq(0).val(),hasText=el2.find("textarea").eq(0).val(),!(hasText||hasFile))return}else return;if(el2.find('[data-invalid-length = "true"]').length>0)return;el.removeClass("required");el.find('[aria-invalid = "true"]').attr("aria-invalid","false")}if(self.is("input")&&event.type=="change"){const mask=el.data("mask");mask!=null&&mask.length>0&&FW.ValidateMask(self,mask)}};this.Validate=function(silent){const reqs=form.find('.form_question[data-required = "1"],.form_question[data-mask]');let req_el=null,req_count=0,mask_count=0;for(let i=0;i<reqs.length;i++){const el=reqs.eq(i),el2=el.find(".form_responses"),type=el.data("type");let field=null;if(type=="selectable"||type=="signature"){if(!el2.is(":visible"))continue}else if(el2.find("input:enabled:visible,select:enabled:visible,textarea:enabled:visible").length==0)continue;if(el.data("required")==1){let req_hit=!0;if(type=="text"||type=="email"||type=="tel"||type=="signature"||type=="secret")field=el2.find("input"),field.val()!=""&&(req_hit=!1);else if(type=="textarea")field=el2.find("textarea"),field.val()!=""&&(req_hit=!1);else if(type=="select"||type=="multiselect")field=el2.find("select"),field.val()!=""&&el2.find("select").prop("selectedIndex")>-1&&(req_hit=!1);else if(type=="checkbox"||type=="radio"||type=="likert"||type=="selectable")el2.find("input:checked").length>0&&(req_hit=!1),field=el2.find("input").eq(0);else if(type=="birthdate"||type=="date")field=el2.find("select"),field.eq(0).val()!=""&&field.eq(1).val()!=""&&field.eq(2).val()!=""&&(req_hit=!1);else if(type=="dateym"||type=="datemd")field=el2.find("select"),field.eq(0).val()!=""&&field.eq(1).val()!=""&&(req_hit=!1);else if(type=="address"){field=el2.find("textarea");field.val()!=""&&(field=null);field==null&&(field=el2.find("input[type=text]").eq(0),field.val()!=""&&(field=null));const country=el2.find("select:last").val();country=="US"&&field==null&&(field=el2.find("select:visible").eq(0),field.val()!=""&&(field=null));field==null&&(req_hit=!1)}else if(type=="location"||type=="location_nopostal")field=el2.find("input[type=text]").eq(0),field.val()!=""&&(req_hit=!1);else if(type=="plugin:event")field=el2.find("input[type=checkbox]").eq(0),el2.find("input:checked").length>0&&(req_hit=!1);else if(type=="plugin:material")if(el2.find('[data-validate-fulfilled="1"]').length>0)req_hit=!1;else{field=el2.find("input[type=file]");let hasFile=field.eq(0).val();if(hasFile){const files=field.get(0).files;for(let f=0;f<files.length;f++)files[f].size==0&&(hasFile=null)}const hasText=el2.find("textarea").eq(0).val();(hasText||hasFile)&&(req_hit=!1)}else req_hit=!1;req_hit==!0&&(req_count++,el.addClass("required"),field.attr("aria-invalid","true"),req_el==null&&(req_el=field))}const isLengthInvalid=field!=null&&field.attr("data-invalid-length")=="true";if(el.data("mask")!=null||isLengthInvalid){const mask=el.data("mask");let req_hit=!1;if(mask!="")if(req_hit=!0,el.hasClass("form_text")){field=el2.find("input");var val=field.val();if(val=="")req_hit=!1;else{const result=FW.ValidateMask(field,mask);result==!0&&(req_hit=!1)}}else req_hit=!1;isLengthInvalid&&(req_hit=!0);req_hit==!0&&(mask_count++,el.addClass("required"),field.attr("aria-invalid","true"),req_el==null&&(req_el=field))}}
1return req_el==null?!0:silent==!0?!1:(FW.Dialog.Load($('<div class="dialog" style="width: 400px;"><div style="padding: 50px 25px;"><div role="alert" style="color: var(--fw-error-text, #ee0000); text-align: center; font-weight: bold;">'+(req_count==0?"":req_count.toString()+" required field"+(req_count==1?" was":"s were")+" not completed")+(req_count==0||mask_count==0?"":" and ")+(mask_count==0?"":mask_count.toString()+" field"+(mask_count==1?" was":"s were")+" not properly formatted")+".<\/div><\/div><\/div>"),{stack:!0}),window.setTimeout(function(){FW.Dialog.Unload();var el=req_el.parents(".form_question").eq(0),scroller=el.getVerticalScroller();scroller==null?req_el.focus():scroller.animate({scrollTop:scroller.prop("nodeName")=="HTML"||scroller.prop("nodeName")=="BODY"?el.offset().top-25:el.position().top-25+scroller.scrollTop()},500,function(){req_el.focus()})},2500),!1)};this.Submit=function(){return this.Validate()?(FW.Postback(form),!0):!1};this.applyConditionalLogicRecursive=function(el){el=$(el);el.find('.form_responses:has([data-handler-change="1"])').each(function(){var el2=$(this).find("[data-handler-change]:eq(0)");el2.attr("data-bubbling")!="1"&&(el2.attr("data-bubbling","1"),el2.triggerHandler("change"))});initialLogicExecution||window.setTimeout(function(){el.find('[data-bubbling = "1"]').attr("data-bubbling",null)},25)};this.applyConditionalPrompts=function(field){var fieldConditions,choicesToShow,filteredChoices,showQuestion,optionsToShow,possibleOptions;if(!(form.find(".form_pages.readOnly").length>0)&&(fieldConditions=$.grep(this.conditionalPromptConfig,function(item){return item.field==field}),fieldConditions!=null&&fieldConditions.length!=0)){fieldConditions=fieldConditions[0];choicesToShow=[];filteredChoices=[];$.each(fieldConditions.conditions,function(i,item){item.condition(_this)&&$.merge(choicesToShow,item.prompts);$.merge(filteredChoices,item.prompts)});var targetQuestion=this.getQuestionById(field),targetType=targetQuestion.data("type"),targetInput=targetType=="selectable"?"checkbox":targetType,target=this.getElementById(field);if(target.data("stack")!=!0){target.data("stack",!0);showQuestion=!1;switch(targetType){case"select":case"multiselect":optionsToShow=target.find("option").filter(function(){return $.inArray(this.value,choicesToShow)>=0});possibleOptions=target.find("option").filter(function(){return $.inArray(this.value,filteredChoices)>=0});optionsToShow.showOption();possibleOptions.not(optionsToShow).hideOption();target.hideOptionGroups();showQuestion=target.children("optgroup").addBack().children("option:not(:empty)").length>0;break;case"checkbox":case"radio":case"selectable":optionsToShow=target.filter(function(){return $.inArray(this.value,choicesToShow)>=0});possibleOptions=target.filter(function(){return $.inArray(this.value,filteredChoices)>=0});optionsToShow.parent().showAndEnable(!0);possibleOptions.not(optionsToShow).parent().showAndEnable(!1);showQuestion=targetQuestion.attr("data-hidden-by-condition")!="1"&&targetQuestion.find(":"+targetInput+":enabled").length>0}target.triggerHandler("change");showQuestion&&(targetQuestion.attr("data-hidden-by-condition")!="1"||targetQuestion.attr("data-hidden-by-conditional-prompts")=="1")?(targetQuestion.attr("data-hidden-by-conditional-prompts","0"),targetQuestion.show(!0)):showQuestion||(targetQuestion.attr("data-hidden-by-condition")!="1"&&targetQuestion.attr("data-hidden-by-conditional-prompts","1"),targetQuestion.show(!1));target.data("stack",!1)}}};this.getAllExportLabels=function(){var elements=form.find("[data-export]"),exports=elements.map(function(){return $(this).data("export").toString()}).get();return exports.sort(function(a,b){return b.length-a.length})};this.initializeCalculatedFields=function(context){form.find('.form_question[data-export ^= "sys:gift:amount"]:not(.form_paymentAmount)').each(function(){$(this).addClass("form_paymentAmount").find(":input").addClass("form_paymentAmount")});context==null&&(context=form.find("div.form_page[data-replicate != '1']"));const exportLabels=this.getAllExportLabels(),calculatedFields=context.find("[data-formula]"),frm=this;calculatedFields.each(function(i,item){frm.initializeCalculatedField(item,exportLabels,context)})};this.getExecutableFormula=function(formula,exports,driverFields,replicateDriverFields,replicateId,fieldType){return typeof formula=="str
1ing"&&(fieldType=="payment"&&formula.indexOf("sum(*)")>=0?formula=formula.replace(/sum\(\*\)/g,"frm.getAmountSum(true)"):formula.indexOf("sum(*)")>=0&&(formula=formula.replace(/sum\(\*\)/g,"frm.getAmountSum()")),formula.indexOf("translate(")>=0&&(formula=formula.replace(/translate\(/g,"frm.translate(")),formula.indexOf("sum(")>=0&&(formula=formula.replace(/sum\(/g,"frm.sum(")),formula.indexOf("count(")>=0&&(formula=formula.replace(/count\(/g,"frm.count(")),formula.indexOf("countWhere(")>=0&&(formula=formula.replace(/countWhere\(/g,"frm.countWhere(")),$.each(exports,function(i,exp){formula.indexOf("@"+exp)>=0&&(driverFields.push(exp),formula.indexOf("@"+exp+"_textlist")>=0&&(formula=formula.replace(new RegExp("@"+FW.escapeRegEx(exp+"_textlist"),"gi")," frm.getTextArray('"+exp+"') ")),formula.indexOf("@"+exp+"_text")>=0&&(formula=formula.replace(new RegExp("@"+FW.escapeRegEx(exp+"_text"),"gi")," frm.getText('"+exp+"') ")),formula.indexOf("@"+exp+"_exact")>=0&&(formula=formula.replace(new RegExp("@"+FW.escapeRegEx(exp+"_exact"),"gi")," frm.getValue('"+exp+"') ")),formula.indexOf("@"+exp+"_list")>=0&&(formula=formula.replace(new RegExp("@"+FW.escapeRegEx(exp+"_list"),"gi")," frm.getValueArray('"+exp+"') ")),formula.indexOf("@"+exp)>=0&&(formula=formula.replace(new RegExp("@"+FW.escapeRegEx(exp),"gi")," frm.getValueForCalculation('"+exp+"'"+(replicateId?" ,'"+replicateId+"'":"")+" ) ")));formula.indexOf("@*"+exp)>=0&&(replicateDriverFields.push(exp),formula.indexOf("@*"+exp)>=0&&(formula=formula.replace(new RegExp("@"+FW.escapeRegEx("*"+exp),"gi")," frm.getValueArrayForReplicate('"+ex
1p+"') ")))})),formula};this.initializeCalculatedField=function(fld,exports,context){const fieldType=$(fld).closest(".form_question").attr("data-type"),replicateId=context.data("replicate_id"),frm=this,driverFields=[],replicateDriverFields=[],originalFormula=$(fld).data("formula"),execFormula=this.getExecutableFormula(originalFormula,exports,driverFields,replicateDriverFields,replicateId,fieldType),calcHandler=function(){if(!initialLogicExecution){const self=$(this);if(self.data("calc-stack")!="1"){self.data("calc-stack","1");try{const result=eval(execFormula);if(typeof result!="number"||!isNaN(result)){if($(fld).data("calc-final")&&result!=$(fld).data("calc-final"))throw new Error("Calculated value is locked.");$(fld).val(result).trigger("change")}}catch(ex){alert("The following error occurred:\n"+ex.toString()+"\n\nwhile evaluating the formula:\n"+originalFormula)}self.data("calc-stack",null)}}};$(function(){if(originalFormula!=null&&typeof originalFormula=="string"&&originalFormula.indexOf("sum(*)")!=-1)frm.getForm().on("change","input.form_paymentAmount",calcHandler).on("field_status_change","div.form_question.form_paymentAmount",calcHandler).on("field_status_change",calcHandler);$.each(driverFields,function(i,drv){context.find('.form_question[data-export = "'+FW.escapeSelector(drv)+'"]').on("field_status_change",calcHandler);context.find('.form_question[data-export = "'+FW.escapeSelector(drv)+'"] .form_responses :input').on("change",calcHandler)});$.each(replicateDriverFields,function(i,drv){var id=fields[drv];id.indexOf("^")>=0&&(id=id.substr(0,id.indexOf("^")));frm.getForm().on("change",'[name ^= "form_'+id+'"]',calcHandler).on("field_status_change",".form_question_"+id,calcHandler)});$(fld).on("recalculate",calcHandler);calcHandler()})};this.getAmountSum=function(includeSums){let total=0;return form.find("input.form_paymentAmount:enabled"+(includeSums?"":':not([data-sum = "1"])')).each(function(){isNaN(this.value)||(total+=Number(this.value))}),total};this.sum=function(values){let total=0;return $.each(values,function(i,item){isNaN(item)||(total+=Number(item))}),total};this.count=function(values){let count=0;return $.each(values,function(i,item){item&&(count+=1)}),count};this.countWhere=function(values,target){let count=0;return $.each(values,function(i,item){item==target&&(count+=1)}),count};this.translate=function(translatorName,value){var translation;if(!this.translators||!this.translators[translatorName])return"";var translator=this.translators[translatorName],found=!1,result="";return translator.type=="int"&&(value=parseInt(value)),translator.type=="real"&&(value=parseFloat(value)),translation=$.grep(translator.translations,function(item){return translator.type=="string"?item.minValue==value:item.minValue<=value&&value<=item.maxValue}),translation&&translation.length>0&&(found=!0,result=translation[0].export),!found&&translator.default&&(result=translator.default),translator.resultType=="int"&&(result=parseInt(result)),translator.resultType=="real"&&(result=parseFloat(result)),(translator.resultType=="int"||translator.resultType=="real")&&isNaN(result)&&(result=0),result};this.initializeFieldLimits=function(context){const limitedFields=form.find("[data-limit]",context);limitedFields.each(function(i,item){_this.initializeFieldLimit(item)})};this.initializeFieldLimit=function(fld){fld=$(fld);const type=fld.data("type");if(type=="checkbox"||type=="plugin:event"||type=="selectable"){const limit=fld.data("limit");fld.find(":checkbox").on("change",function(){const numChecked=fld.find(":checkbox:checked").length;$(this).is(":checked")&&numChecked>parseInt(limit)&&(limit=="1"?fld.find(":checkbox:checked").not(this).prop("checked",!1):$(this).prop("checked",!1))})}};this.initializeCapacityCheck=function(domain,response){if(!(form.closest("form").find('.error[data-waitlist = "1"]').length>0)){const frm=this;let timeout=null;const initialTime=Date.now();let checkInProgress=!1;const checkCapacity=function(){if(!checkInProgress){checkInProgress=!0;timeout&&(window.clearTimeout(timeout),timeout=null);const formId=form.closest("form:visible").find('[name = "id"]').val();if(!document.hidden&&formId!=null&&!$(document.body).hasClass("progress")){const events=[];events.push(formId);$(".form_response > [data-event]").each(function(){events.push($(this).data("event"))});let attendees=0,registrants=1;const register_block=$('[name = "register_replicate"]');register_block.length>0&&(registrants=register_block.closest("div.form_page").find(".replicate_destination").length);attendees=frm.getElement("sys:guests").length>0?registrants+(Number(frm.getValue("sys:guests"))||0):frm.getElement("sys:attendees").length>0&&(Number(frm.getValue("sys:attendees"))||0)>0?registrants-1+Number(frm.getValue("sys:attendees")):registrants;const data={cmd:"fetch",ids:events.join(","),attendees:attendees,registrants:registrants};response&&(data.response=response);$.ajax({type:"POST",url:domain+"/register/form?cmd=counts&id="+formId,data:data,dataType:"json",success:function(result){$.each(result.results.results,function(i,item){if(item.id==formId)item.exceed=="1"&&(FW.Dialog.Load($('
1<div class="dialog" style="width: 400px;"><div class="content" style="padding: 50px 25px;"><div role="alert" style="color: var(--fw-error-text, #ee0000); text-align: center; font-weight: bold;">'+result.message+'<\/div><\/div><div class="action"><button class="default" onclick="FW.Dialog.Unload();" type="button">Close<\/button><\/div><\/div>')),window.clearTimeout(timeout));else{var rel_evt=$("[data-event='"+item.id+"']").closest("div.form_response");item.exceed=="1"?(rel_evt.addClass("full").find(":input").disable().addClass("disabled_full"),rel_evt.find("span.full_message").show()):(rel_evt.removeClass("full").find(":input.disabled_full").enable(),rel_evt.find("span.full_message").hide())}})},error:function(xhr,status,error){console.log(status,error)},complete:function(){checkInProgress=!1}})}const keepChecking=Date.now()-initialTime<9e5;keepChecking&&(timeout=window.setTimeout(checkCapacity,15e3))}};checkCapacity();frm.getElement("sys:guests").on("change",checkCapacity);frm.getElement("sys:attendees").on("change",checkCapacity);if(frm.getForm().find('[name = "register_replicate"]').length>0)frm.getForm().on("replicate",checkCapacity)}};init()}}(FW.$);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.