469 lines
467 KiB
JavaScript
469 lines
467 KiB
JavaScript
|
||
function frmFrontFormJS(){let jsErrors=[];function triggerCustomEvent(el,eventName,data){if(typeof window.CustomEvent!=="function")return;const event=new CustomEvent(eventName);event.frmData=data;el.dispatchEvent(event)}function getFieldId(field,fullID){let nameParts,fieldId,isRepeating=false,fieldName="";if(field instanceof jQuery)field=field.get(0);fieldName=field.name;if(typeof fieldName==="undefined")fieldName="";if(fieldName===""){fieldName=field.getAttribute("data-name");if(typeof fieldName===
|
||
"undefined")fieldName="";if(fieldName!==""&&fieldName)return fieldName;return 0}nameParts=fieldName.replace("item_meta[","").replace("[]","").split("]");if(nameParts.length<1)return 0;nameParts=nameParts.filter(function(n){return n!==""});fieldId=nameParts[0];if(nameParts.length===1)return fieldId;if(nameParts[1]==="[form"||nameParts[1]==="[row_ids")return 0;if(document.querySelector('input[name="item_meta['+fieldId+'][form]"]')){fieldId=nameParts[2].replace("[","");isRepeating=true}if("other"===
|
||
fieldId)if(isRepeating)fieldId=nameParts[3].replace("[","");else fieldId=nameParts[1].replace("[","");if(fullID===true)if(fieldId===nameParts[0])fieldId=fieldId+"-"+nameParts[1].replace("[","");else fieldId=fieldId+"-"+nameParts[0]+"-"+nameParts[1].replace("[","");return fieldId}function disableSubmitButton($form){const form=$form instanceof jQuery?$form.get(0):$form;if(!form)return;form.querySelectorAll('input[type="submit"], input[type="button"], button[type="submit"], button.frm_save_draft').forEach(button=>
|
||
button.disabled=true)}function enableSubmitButton(form){form.querySelectorAll('input[type="submit"], input[type="button"], button[type="submit"]').forEach(button=>button.disabled=false)}function disableSaveDraft($form){const form=$form instanceof jQuery?$form.get(0):$form;if(!form)return;form.querySelectorAll("a.frm_save_draft").forEach(link=>link.style.pointerEvents="none")}function enableSaveDraft($form){const form=$form instanceof jQuery?$form.get(0):$form;if(!form)return;form.querySelectorAll(".frm_save_draft").forEach(saveDraftButton=>
|
||
{saveDraftButton.disabled=false;saveDraftButton.style.pointerEvents=""})}function validateForm(object){let errors=[];const vanillaJsObject="function"===typeof object.get?object.get(0):object;vanillaJsObject?.querySelectorAll(".frm_required_field").forEach(requiredField=>{const isVisible=requiredField.offsetParent!==null;if(!isVisible)return;requiredField.querySelectorAll("input, select, textarea").forEach(requiredInput=>{if(hasClass(requiredInput,"frm_optional")||hasClass(requiredInput,"ed_button"))return;
|
||
errors=checkRequiredField(requiredInput,errors)})});vanillaJsObject?.querySelectorAll("input,select,textarea").forEach(field=>{if(""===field.value){if("number"===field.type)checkValidity(field,errors);const isConfirmationField=field.name&&0===field.name.indexOf("item_meta[conf_");if(!isConfirmationField)return}validateFieldValue(field,errors,true);checkValidity(field,errors)});if(!hasInvisibleRecaptcha(object))errors=validateRecaptcha(object,errors);return errors}function checkValidity(field,errors){let fieldID;
|
||
if("object"!==typeof field.validity||false!==field.validity.valid)return;fieldID=getFieldId(field,true);if("undefined"===typeof errors[fieldID])errors[fieldID]=getFieldValidationMessage(field,"data-invmsg");if("function"===typeof field.reportValidity)field.reportValidity()}function hasClass(element,targetClass){return element.classList&&element.classList.contains(targetClass)}function maybeValidateChange(field){if(field.type==="url")maybeAddHttpsToUrl(field);const form=field.closest("form");if(form&&
|
||
hasClass(form,"frm_js_validate"))validateField(field)}function maybeAddHttpsToUrl(field){const url=field.value;const matches=url.match(/^(https?|ftps?|mailto|news|feed|telnet):/);if(field.value!==""&&matches===null)field.value="https://"+url}function validateField(field){let errors,key;errors=[];const fieldContainer=field.closest(".frm_form_field");if(!fieldContainer)return;if(hasClass(fieldContainer,"frm_required_field")&&!hasClass(field,"frm_optional"))errors=checkRequiredField(field,errors);if(errors.length<
|
||
1)validateFieldValue(field,errors,false);removeFieldError(fieldContainer);if(Object.keys(errors).length>0)for(key in errors)addFieldError(fieldContainer,key,errors)}function validateFieldValue(field,errors,onSubmit){if(field.type==="hidden");else if(field.type==="number")checkNumberField(field,errors);else if(field.type==="email")checkEmailField(field,errors,onSubmit);else if(field.type==="password")checkPasswordField(field,errors,onSubmit);else if(field.type==="url")checkUrlField(field,errors);else if(field.pattern!==
|
||
null)checkPatternField(field,errors);if("tel"===field.type&&shouldCheckConfirmField(field,onSubmit))confirmField(field,errors);triggerCustomEvent(document,"frm_validate_field_value",{field:field,errors:errors,onSubmit:onSubmit})}function checkRequiredField(field,errors){let tempVal,i,placeholder,val="",fieldID="",fileID=field.getAttribute("data-frmfile");if(field.type==="hidden"&&fileID===null&&!isAppointmentField(field)&&!isInlineDatepickerField(field))return errors;if(field.type==="checkbox"||field.type===
|
||
"radio")document.querySelectorAll('input[name="'+field.name+'"]').forEach(function(input){const requiredField=input.closest(".frm_required_field");if(!requiredField)return;const checkedInputs=requiredField.querySelectorAll("input:checked");checkedInputs.forEach(function(checkedInput){val=checkedInput.value})});else if(field.type==="file"||fileID){if(typeof fileID==="undefined"){fileID=getFieldId(field,true);fileID=fileID.replace("file","")}if(typeof errors[fileID]==="undefined")val=getFileVals(fileID);
|
||
fieldID=fileID}else{if(hasClass(field,"frm_pos_none"))return errors;val=jQuery(field).val();if(val===null)val="";else if(typeof val!=="string"){tempVal=val;val="";for(i=0;i<tempVal.length;i++)if(tempVal[i]!=="")val=tempVal[i]}if(hasClass(field,"frm_other_input")){fieldID=getFieldId(field,false);if(val==="")field=document.getElementById(field.id.replace("-otext",""))}else fieldID=getFieldId(field,true);if("function"!==typeof fieldID.replace)fieldID=fieldID.toString();if(hasClass(field,"frm_time_select"))fieldID=
|
||
fieldID.replace("-H","").replace("-m","");else if(isSignatureField(field)){if(val===""){const fieldContainer=field.closest(".frm_form_field");const outputField=fieldContainer?fieldContainer.querySelector('[name="'+field.getAttribute("name").replace("[typed]","[output]")+'"]'):null;val=outputField?outputField.value:""}fieldID=fieldID.replace("-typed","")}placeholder=field.getAttribute("data-frmplaceholder");if(placeholder!==null&&val===placeholder)val=""}if(val===""){if(fieldID==="")fieldID=getFieldId(field,
|
||
true);if(!(fieldID in errors))errors[fieldID]=getFieldValidationMessage(field,"data-reqmsg")}return errors}function isSignatureField(field){const name=field.getAttribute("name");return"string"===typeof name&&"[typed]"===name.substr(-7)}function isAppointmentField(field){return hasClass(field,"ssa_appointment_form_field_appointment_id")}function isInlineDatepickerField(field){return"hidden"===field.type&&"_alt"===field.id.substr(-4)&&hasClass(field.nextElementSibling,"frm_date_inline")}function getFileVals(fileID){let val=
|
||
"";const fileFields=document.querySelectorAll('input[name="file'+fileID+'"], input[name="file'+fileID+'[]"], input[name^="item_meta['+fileID+']"]');fileFields.forEach(function(field){if(val==="")val=field.value});return val}function checkUrlField(field,errors){let fieldID,url=field.value;if(url!==""&&!/^http(s)?:\/\/(?:localhost|(?:[\da-z\.-]+\.[\da-z\.-]+))/i.test(url)){fieldID=getFieldId(field,true);if(!(fieldID in errors))errors[fieldID]=getFieldValidationMessage(field,"data-invmsg")}}function shouldCheckConfirmField(field,
|
||
onSubmit){if(onSubmit)return true;if(0===field.id.indexOf("field_conf_"))return true;return false}function checkEmailField(field,errors,onSubmit){const fieldID=getFieldId(field,true),pattern=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i;if(""!==field.value&&pattern.test(field.value)===false)errors[fieldID]=getFieldValidationMessage(field,"data-invmsg");if(shouldCheckConfirmField(field,onSubmit))confirmField(field,
|
||
errors)}function checkPasswordField(field,errors,onSubmit){if(shouldCheckConfirmField(field,onSubmit))confirmField(field,errors)}function confirmField(field,errors){let value,confirmValue,firstField,fieldID=getFieldId(field,true),strippedId=field.id.replace("conf_",""),strippedFieldID=fieldID.replace("conf_",""),confirmField=document.getElementById(strippedId.replace("field_","field_conf_"));if(confirmField===null||typeof errors["conf_"+strippedFieldID]!=="undefined")return;if(fieldID!==strippedFieldID){firstField=
|
||
document.getElementById(strippedId);value=firstField.value;confirmValue=confirmField.value;if(value!==confirmValue)errors["conf_"+strippedFieldID]=getFieldValidationMessage(confirmField,"data-confmsg")}else validateField(confirmField)}function checkNumberField(field,errors){let fieldID,number=field.value;if(number!==""&&isNaN(number/1)!==false){fieldID=getFieldId(field,true);if(!(fieldID in errors))errors[fieldID]=getFieldValidationMessage(field,"data-invmsg")}}function checkPatternField(field,errors){let fieldID,
|
||
text=field.value,format=getFieldValidationMessage(field,"pattern");if(format!==""&&text!==""){fieldID=getFieldId(field,true);if(!(fieldID in errors))if("object"===typeof window.frmProForm&&"function"===typeof window.frmProForm.isIntlPhoneInput&&window.frmProForm.isIntlPhoneInput(field)){if(!window.frmProForm.validateIntlPhoneInput(field))errors[fieldID]=getFieldValidationMessage(field,"data-invmsg")}else{format=new RegExp("^"+format+"$","i");if(format.test(text)===false)errors[fieldID]=getFieldValidationMessage(field,
|
||
"data-invmsg")}}}function setSelectPlaceholderColor(){let selects=document.querySelectorAll(".form-field select"),styleElement=document.querySelector(".with_frm_style"),textColorDisabled=styleElement?getComputedStyle(styleElement).getPropertyValue("--text-color-disabled").trim():"",changeSelectColor;if(!selects.length||!textColorDisabled)return;changeSelectColor=function(select){if(select.options[select.selectedIndex]&&hasClass(select.options[select.selectedIndex],"frm-select-placeholder"))select.style.setProperty("color",
|
||
textColorDisabled,"important");else select.style.color=""};Array.prototype.forEach.call(selects,function(select){changeSelectColor(select);select.addEventListener("change",function(){changeSelectColor(select)})})}function hasInvisibleRecaptcha(object){if(isGoingToPrevPage(object))return false;const form=object instanceof jQuery?object.get(0):object;if(!form)return false;const recaptcha=form.querySelector('.frm-g-recaptcha[data-size="invisible"], .g-recaptcha[data-size="invisible"]');if(recaptcha){const recaptchaID=
|
||
recaptcha.dataset.rid;const alreadyChecked=grecaptcha.getResponse(recaptchaID);if(alreadyChecked.length===0)return recaptcha}return false}function executeInvisibleRecaptcha(invisibleRecaptcha){const recaptchaID=invisibleRecaptcha.dataset.rid;grecaptcha.reset(recaptchaID);grecaptcha.execute(recaptchaID)}function validateRecaptcha(form,errors){const formEl=form instanceof jQuery?form.get(0):form;if(!formEl)return errors;const recaptcha=formEl.querySelector(".frm-g-recaptcha");if(!recaptcha)return errors;
|
||
const recaptchaID=recaptcha.dataset.rid;let response;try{response=grecaptcha.getResponse(recaptchaID)}catch(e){if(formEl.querySelector('input[name="recaptcha_checked"]'))return errors;response=""}if(response.length===0){const fieldContainer=recaptcha.closest(".frm_form_field");if(fieldContainer&&fieldContainer.id){const fieldID=fieldContainer.id.replace("frm_field_","").replace("_container","");errors[fieldID]=""}}return errors}function getFieldValidationMessage(field,messageType){let msg=field.getAttribute(messageType);
|
||
if(null===msg)msg="";if(""!==msg&&shouldWrapErrorHtmlAroundMessageType(messageType))msg=wrapErrorHtml(msg,field);return msg}function wrapErrorHtml(msg,field){let errorHtml=field.getAttribute("data-error-html");if(null===errorHtml)return msg;errorHtml=errorHtml.replace(/\+/g,"%20");msg=decodeURIComponent(errorHtml).replace("[error]",msg);const fieldId=getFieldId(field,false);const split=fieldId.split("-");const fieldIdParts=field.id.split("_");fieldIdParts.shift();split[0]=fieldIdParts.join("_");const errorKey=
|
||
split.join("-");return msg.replace("[key]",errorKey)}function shouldWrapErrorHtmlAroundMessageType(type){return"pattern"!==type}function shouldJSValidate(object){if("function"===typeof object.get)object=object.get(0);let validate=hasClass(object,"frm_js_validate");if(validate&&typeof frmProForm!=="undefined"&&(frmProForm.savingDraft(object)||frmProForm.goingToPreviousPage(object)))validate=false;return validate}function getFormErrors(object,action){let data,success,error,shouldTriggerEvent;const fieldsets=
|
||
object.querySelectorAll(".frm_form_field");fieldsets.forEach(field=>field.classList.add("frm_doing_ajax"));data=jQuery(object).serialize()+"&action=frm_entries_"+action+"&nonce="+frm_js.nonce;shouldTriggerEvent=object.classList.contains("frm_trigger_event_on_submit");const doRedirect=response=>{jQuery(document).trigger("frmBeforeFormRedirect",[object,response]);if(!response.openInNewTab){window.location=response.redirect;return}const newTab=window.open(response.redirect,"_blank");if(!newTab&&response.fallbackMsg&&
|
||
response.content)response.content=response.content.trim().replace(/(<\/div><\/div>)$/," "+response.fallbackMsg+"</div></div>")};success=function(response){let defaultResponse,formID,replaceContent,pageOrder,formReturned,contSubmit,delay,$fieldCont,key,inCollapsedSection,frmTrigger;defaultResponse={content:"",errors:{},pass:false};if(response===null)response=defaultResponse;else{response=response.replace(/^\s+|\s+$/g,"");if(response.indexOf("{")===0)response=JSON.parse(response);else response=defaultResponse}if(typeof response.redirect!==
|
||
"undefined"){if(shouldTriggerEvent){triggerCustomEvent(object,"frmSubmitEvent");return}if(response.delay)setTimeout(function(){doRedirect(response)},1E3*response.delay);else doRedirect(response)}if("string"===typeof response.content&&response.content!==""){if(shouldTriggerEvent){triggerCustomEvent(object,"frmSubmitEvent",{content:response.content});return}removeSubmitLoading(jQuery(object));if(frm_js.offset!=-1)frmFrontForm.scrollMsg(jQuery(object),false);const formIdInput=object.querySelector('input[name="form_id"]');
|
||
formID=formIdInput?formIdInput.value:"";response.content=response.content.replace(/ frm_pro_form /g," frm_pro_form frm_no_hide ");replaceContent=jQuery(object).closest(".frm_forms");removeAddedScripts(replaceContent,formID);delay=maybeSlideOut(replaceContent,response.content);setTimeout(function(){afterFormSubmittedBeforeReplace(object,response);replaceContent.replaceWith(response.content);addUrlParam(response);if(typeof frmThemeOverride_frmAfterSubmit==="function"){const pageOrderInput=document.querySelector('input[name="frm_page_order_'+
|
||
formID+'"]');pageOrder=pageOrderInput?pageOrderInput.value:"";const tempDiv=document.createElement("div");tempDiv.innerHTML=response.content;const formReturnedInput=tempDiv.querySelector('input[name="form_id"]');formReturned=formReturnedInput?formReturnedInput.value:"";frmThemeOverride_frmAfterSubmit(formReturned,pageOrder,response.content,object)}afterFormSubmitted(object,response)},delay)}else if(Object.keys(response.errors).length){removeSubmitLoading(jQuery(object),"enable");contSubmit=true;removeAllErrors();
|
||
$fieldCont=null;for(key in response.errors){const fieldContEl=object.querySelector("#frm_field_"+key+"_container");$fieldCont=fieldContEl?jQuery(fieldContEl):jQuery();if($fieldCont.length){if(!$fieldCont.is(":visible")){inCollapsedSection=$fieldCont.closest(".frm_toggle_container");if(inCollapsedSection.length){frmTrigger=inCollapsedSection.prev();if(!frmTrigger.hasClass("frm_trigger"))frmTrigger=frmTrigger.prev(".frm_trigger");frmTrigger.trigger("click")}}if($fieldCont.is(":visible")){addFieldError($fieldCont,
|
||
key,response.errors);contSubmit=false}}}object.querySelectorAll(".frm-g-recaptcha, .g-recaptcha, .h-captcha").forEach(function(captchaEl){const recaptchaID=captchaEl.dataset.rid;if(typeof grecaptcha!=="undefined"&&grecaptcha)if(recaptchaID)grecaptcha.reset(recaptchaID);else grecaptcha.reset();if(typeof hcaptcha!=="undefined"&&hcaptcha)hcaptcha.reset()});if(window.turnstile)object.querySelectorAll(".frm-cf-turnstile").forEach(turnstileField=>turnstileField.dataset.rid&&turnstile.reset(turnstileField.dataset.rid));
|
||
jQuery(document).trigger("frmFormErrors",[object,response]);fieldsets.forEach(field=>field.classList.remove("frm_doing_ajax"));scrollToFirstField(object);if(contSubmit)object.submit();else{object.insertAdjacentHTML("afterbegin",response.error_message);checkForErrorsAndMaybeSetFocus()}}else{showFileLoading(object);object.submit()}};error=function(){object.querySelectorAll('input[type="submit"], input[type="button"]').forEach(button=>button.disabled=false);object.submit()};postToAjaxUrl(object,data,
|
||
success,error)}function postToAjaxUrl(form,data,success,error){let ajaxUrl,action,ajaxParams;ajaxUrl=frm_js.ajax_url;action=form.getAttribute("action");if("string"===typeof action&&-1!==action.indexOf("?action=frm_forms_preview"))ajaxUrl=action.split("?action=frm_forms_preview")[0];ajaxParams={type:"POST",url:ajaxUrl,data:data,success:success};if("function"===typeof error)ajaxParams.error=error;jQuery.ajax(ajaxParams)}function afterFormSubmitted(object,response){const tempDiv=document.createElement("div");
|
||
tempDiv.innerHTML=response.content;const formCompleted=tempDiv.querySelector(".frm_message");if(formCompleted)jQuery(document).trigger("frmFormComplete",[object,response]);else jQuery(document).trigger("frmPageChanged",[object,response])}function afterFormSubmittedBeforeReplace(object,response){const tempDiv=document.createElement("div");tempDiv.innerHTML=response.content;const formCompleted=tempDiv.querySelector(".frm_message");if(formCompleted)triggerCustomEvent(document,"frmFormCompleteBeforeReplace",
|
||
{object,response})}function removeAddedScripts(formContainer,formID){const endReplace=document.querySelectorAll(".frm_end_ajax_"+formID);if(endReplace.length){formContainer.nextUntil(".frm_end_ajax_"+formID).remove();endReplace.forEach(el=>el.remove())}}function maybeSlideOut(oldContent,newContent){let c,newClass="frm_slideout";if(newContent.includes(" frm_slide")){c=oldContent.children();if(newContent.includes(" frm_going_back"))newClass+=" frm_going_back";c.removeClass("frm_going_back");c.addClass(newClass);
|
||
return 300}return 0}function addUrlParam(response){let url;if(history.pushState&&typeof response.page!=="undefined"){url=addQueryVar("frm_page",response.page);window.history.pushState({html:response.html},"","?"+url)}}function addQueryVar(key,value){let kvp,i,x;key=encodeURI(key);value=encodeURI(value);kvp=document.location.search.substr(1).split("&");i=kvp.length;while(i--){x=kvp[i].split("=");if(x[0]==key){x[1]=value;kvp[i]=x.join("=");break}}if(i<0)kvp[kvp.length]=[key,value].join("=");return kvp.join("&")}
|
||
function addFieldError($fieldCont,key,jsErrors){let id,describedBy,roleString;const container=$fieldCont instanceof jQuery?$fieldCont.get(0):$fieldCont;if(!container||container.offsetParent===null)return;container.classList.add("frm_blank_field");const input=container.querySelector("input, select, textarea");id=getErrorElementId(key,input);describedBy=input?input.getAttribute("aria-describedby"):null;if(typeof frmThemeOverride_frmPlaceError==="function")frmThemeOverride_frmPlaceError(key,jsErrors);
|
||
else{let errorHtml;if(-1!==jsErrors[key].indexOf("<div"))errorHtml=jsErrors[key];else{roleString=frm_js.include_alert_role?'role="alert"':"";errorHtml='<div class="frm_error" '+roleString+' id="'+id+'">'+jsErrors[key]+"</div>"}container.insertAdjacentHTML("beforeend",errorHtml);if(input){if(!describedBy)describedBy=id;else if(!describedBy.includes(id)&&!describedBy.includes("frm_error_field_")){const errorFirst=input.dataset.errorFirst;if(errorFirst==="0")describedBy=describedBy+" "+id;else describedBy=
|
||
id+" "+describedBy}input.setAttribute("aria-describedby",describedBy)}}if(input)if(["radio","checkbox"].includes(input.type)){const group=input.closest('[role="radiogroup"], [role="group"]');if(group)group.setAttribute("aria-invalid","true")}else input.setAttribute("aria-invalid","true");jQuery(document).trigger("frmAddFieldError",[jQuery(container),key,jsErrors])}function getErrorElementId(key,input){if(isNaN(key)||!input||!input.id)return"frm_error_field_"+key;return"frm_error_"+input.id}function removeFieldError(fieldCont){const container=
|
||
fieldCont instanceof jQuery?fieldCont.get(0):fieldCont;if(!container)return;const errorMessage=container.querySelector(".frm_error");const errorId=errorMessage?errorMessage.id:"";const input=container.querySelector("input, select, textarea");let describedBy=input?input.getAttribute("aria-describedby"):null;container.classList.remove("frm_blank_field","has-error");if(input)if("true"===input.getAttribute("aria-invalid"))input.setAttribute("aria-invalid","false");else if(["radio","checkbox"].includes(input.type)){const group=
|
||
input.closest('[role="radiogroup"], [role="group"]');if(group)group.setAttribute("aria-invalid","false")}if(errorMessage)errorMessage.remove();if(input){input.removeAttribute("aria-describedby");if(describedBy){describedBy=describedBy.replace(errorId,"").trim();if(describedBy)input.setAttribute("aria-describedby",describedBy)}}}function removeAllErrors(){document.querySelectorAll(".form-field").forEach(field=>{field.classList.remove("frm_blank_field","has-error")});document.querySelectorAll(".form-field .frm_error").forEach(error=>
|
||
error.remove());document.querySelectorAll(".frm_error_style").forEach(error=>error.remove())}function scrollToFirstField(object){if("function"===typeof object.get)object=object.get(0);const field=object.querySelector(".frm_blank_field");if(field)frmFrontForm.scrollMsg(jQuery(field),object,true)}function showSubmitLoading($object){showLoadingIndicator($object);disableSubmitButton($object);disableSaveDraft($object)}function showLoadingIndicator($object){if(!$object.hasClass("frm_loading_form")&&!$object.hasClass("frm_loading_prev")){addLoadingClass($object);
|
||
$object.trigger("frmStartFormLoading")}}function addLoadingClass($object){const loadingClass=isGoingToPrevPage($object)?"frm_loading_prev":"frm_loading_form";$object.addClass(loadingClass)}function isGoingToPrevPage($object){return typeof frmProForm!=="undefined"&&frmProForm.goingToPreviousPage($object)}function removeSubmitLoading(_,enable,processesRunning){if(processesRunning>0)return;document.querySelectorAll(".frm_loading_form").forEach(function(form){form.classList.remove("frm_loading_form",
|
||
"frm_loading_prev");jQuery(form).trigger("frmEndFormLoading");if(enable==="enable"){enableSubmitButton(form);enableSaveDraft(form)}})}function showFileLoading(object){const loading=document.getElementById("frm_loading");if(loading===null)return;const fileInput=object.querySelector("input[type=file]");const fileval=fileInput?fileInput.value:"";if(fileval!=="")setTimeout(function(){jQuery(loading).fadeIn("slow")},2E3)}function confirmClick(){const message=this.dataset.frmconfirm;return confirm(message)}
|
||
function onHoneypotFieldChange(){const css=window.getComputedStyle(this).boxShadow;if(css&&css.match(/inset/))this.remove()}function changeFocusWhenClickComboFieldLabel(){let label;const comboInputsContainer=document.querySelectorAll(".frm_combo_inputs_container");comboInputsContainer.forEach(function(inputsContainer){if(!inputsContainer.closest(".frm_form_field"))return;label=inputsContainer.closest(".frm_form_field").querySelector(".frm_primary_label");if(!label)return;label.addEventListener("click",
|
||
function(){inputsContainer.querySelector(".frm_form_field:first-child input, .frm_form_field:first-child select, .frm_form_field:first-child textarea").focus()})})}function maybeFocusOnComboSubField(element){if("FIELDSET"!==element.nodeName)return false;if(!element.querySelector(".frm_combo_inputs_container"))return false;const comboSubfield=element.querySelector('[aria-invalid="true"]');if(comboSubfield){focusInput(comboSubfield);return true}return false}function checkForErrorsAndMaybeSetFocus(){let errors,
|
||
element,timeoutCallback;if(!frm_js.focus_first_error)return;errors=document.querySelectorAll(".frm_form_field .frm_error");if(!errors.length)return;element=errors[0];do{element=element.previousSibling;if(-1!==["input","select","textarea"].indexOf(element.nodeName.toLowerCase())){focusInput(element);break}if(maybeFocusOnComboSubField(element))break;if("undefined"!==typeof element.classList){if(element.classList.contains("html-active"))timeoutCallback=function(){const textarea=element.querySelector("textarea");
|
||
if(null!==textarea)textarea.focus()};else if(element.classList.contains("tmce-active"))timeoutCallback=function(){tinyMCE.activeEditor.focus()};else if(element.classList.contains("frm_opt_container")){const firstInput=element.querySelector("input");if(firstInput){focusInput(firstInput);break}}if("function"===typeof timeoutCallback){setTimeout(timeoutCallback,0);break}}}while(element.previousSibling)}function focusInput(input){if(input.offsetParent!==null)input.focus();else triggerCustomEvent(document,
|
||
"frmMaybeDelayFocus",{input})}function documentOn(event,selector,handler,options){if("undefined"===typeof options)options=false;document.addEventListener(event,function(e){let target;for(target=e.target;target&&target!=this;target=target.parentNode)if(target&&target.matches&&target.matches(selector)){handler.call(target,e);break}},options)}function initFloatingLabels(){let checkFloatLabel,checkDropdownLabel,runOnLoad,selector,floatClass;selector=".frm-show-form .frm_inside_container input, .frm-show-form .frm_inside_container select, .frm-show-form .frm_inside_container textarea";
|
||
floatClass="frm_label_float_top";checkFloatLabel=function(input){let container,shouldFloatTop,firstOpt;container=input.closest(".frm_inside_container");if(!container)return;shouldFloatTop=input.value||document.activeElement===input;container.classList.toggle(floatClass,shouldFloatTop);if("SELECT"===input.tagName){firstOpt=input.querySelector("option:first-child");if(shouldFloatTop){if(firstOpt.hasAttribute("data-label")){firstOpt.textContent=firstOpt.getAttribute("data-label");firstOpt.removeAttribute("data-label")}}else if(firstOpt.textContent){firstOpt.setAttribute("data-label",
|
||
firstOpt.textContent);firstOpt.textContent=""}}};checkDropdownLabel=function(){document.querySelectorAll(".frm-show-form .frm_inside_container:not(."+floatClass+") select").forEach(function(input){const firstOpt=input.querySelector("option:first-child");if(firstOpt.textContent){firstOpt.setAttribute("data-label",firstOpt.textContent);firstOpt.textContent=""}})};["focus","blur","change"].forEach(function(eventName){documentOn(eventName,selector,function(event){checkFloatLabel(event.target)},true)});
|
||
runOnLoad=function(firstLoad){if(firstLoad&&document.activeElement&&-1!==["INPUT","SELECT","TEXTAREA"].indexOf(document.activeElement.tagName))checkFloatLabel(document.activeElement);else if(firstLoad)document.querySelectorAll(".frm_inside_container").forEach(function(container){const input=container.querySelector("input, select, textarea");if(input&&""!==input.value)checkFloatLabel(input)});checkDropdownLabel()};runOnLoad(true);jQuery(document).on("frmPageChanged",function(event){runOnLoad()});document.addEventListener("frm_after_start_over",
|
||
function(event){runOnLoad()})}function shouldUpdateValidityMessage(target){if("INPUT"!==target.nodeName)return false;if(!target.dataset.invmsg)return false;if("text"!==target.getAttribute("type"))return false;if(target.classList.contains("frm_verify"))return false;return true}function maybeClearCustomValidityMessage(event,field){let key,isInvalid=false;if(!shouldUpdateValidityMessage(field))return;for(key in field.validity){if("customError"===key)continue;if("valid"!==key&&field.validity[key]===true){isInvalid=
|
||
true;break}}if(!isInvalid)field.setCustomValidity("")}function maybeShowNewTabFallbackMessage(){let messageEl;if(!window.frmShowNewTabFallback)return;messageEl=document.querySelector("#frm_form_"+frmShowNewTabFallback.formId+"_container .frm_message");if(!messageEl)return;messageEl.insertAdjacentHTML("beforeend"," "+frmShowNewTabFallback.message)}function setCustomValidityMessage(){let forms,length,index;forms=document.getElementsByClassName("frm-show-form");length=forms.length;for(index=0;index<
|
||
length;++index)forms[index].addEventListener("invalid",function(event){const target=event.target;if(shouldUpdateValidityMessage(target))target.setCustomValidity(target.dataset.invmsg)},true)}function enableSubmitButtonOnBackButtonPress(){window.addEventListener("pageshow",function(event){if(event.persisted){document.querySelectorAll(".frm_loading_form").forEach(function(form){enableSubmitButton(form)});removeSubmitLoading()}})}function destroyhCaptcha(){if(!window.hasOwnProperty("hcaptcha")||!document.querySelector(".frm-show-form .h-captcha"))return;
|
||
window.hcaptcha=null}function getUniqueKey(){const uniqueKey=Array.from(window.crypto.getRandomValues(new Uint8Array(8))).map(b=>b.toString(16).padStart(2,"0")).join("");const timestamp=Date.now().toString(16);return uniqueKey+"-"+timestamp}function animateScroll(start,end,duration){if(!window.hasOwnProperty("performance")||!window.hasOwnProperty("requestAnimationFrame")){document.documentElement.scrollTop=end;return}const startTime=performance.now();const step=currentTime=>{const progress=Math.min((currentTime-
|
||
startTime)/duration,1);document.documentElement.scrollTop=start+(end-start)*progress;if(progress<1)requestAnimationFrame(step)};requestAnimationFrame(step)}function maybeFixCaptchaLabel(captcha){const form=captcha.closest("form");if(!form)return;const label=form.querySelector('label[for="g-recaptcha-response"], label[for="cf-turnstile-response"]');const captchaResponse=form.querySelector('[name="g-recaptcha-response"], [name="cf-turnstile-response"]');if(label&&captchaResponse)label.htmlFor=captchaResponse.id}
|
||
return{init:function(){jQuery(document).off("submit.formidable",".frm-show-form");jQuery(document).on("submit.formidable",".frm-show-form",frmFrontForm.submitForm);jQuery(document).on("change",'.frm-show-form input[name^="item_meta"], .frm-show-form select[name^="item_meta"], .frm-show-form textarea[name^="item_meta"]',frmFrontForm.fieldValueChanged);jQuery(document).on("change",".frm_verify[id^=field_]",onHoneypotFieldChange);jQuery(document).on("click","a[data-frmconfirm]",confirmClick);checkForErrorsAndMaybeSetFocus();
|
||
changeFocusWhenClickComboFieldLabel();initFloatingLabels();maybeShowNewTabFallbackMessage();jQuery(document).on("frmAfterAddRow",setCustomValidityMessage);setCustomValidityMessage();jQuery(document).on("frmFieldChanged",maybeClearCustomValidityMessage);setSelectPlaceholderColor();jQuery(document).on("elementor/popup/show",frmRecaptcha);enableSubmitButtonOnBackButtonPress();jQuery(document).on("frmPageChanged",destroyhCaptcha)},getFieldId,renderCaptcha:function(captcha,captchaSelector){const rendered=
|
||
captcha.getAttribute("data-rid")!==null;if(rendered)return;const size=captcha.getAttribute("data-size");const params={sitekey:captcha.getAttribute("data-sitekey"),size:size,theme:captcha.getAttribute("data-theme")};if(size==="invisible"){const formID=captcha.closest("form")?.querySelector('input[name="form_id"]')?.value;const captchaLabel=captcha.closest(".frm_form_field")?.querySelector(".frm_primary_label");if(captchaLabel)captchaLabel.style.display="none";params.callback=function(token){frmFrontForm.afterRecaptcha(token,
|
||
formID)}}const activeCaptcha=getSelectedCaptcha(captchaSelector);const captchaContainer=typeof turnstile!=="undefined"&&turnstile===activeCaptcha?"#"+captcha.id:captcha.id;const captchaID=activeCaptcha.render(captchaContainer,params);captcha.setAttribute("data-rid",captchaID);maybeFixCaptchaLabel(captcha)},afterSingleRecaptcha:function(){const recaptcha=document.querySelector(".frm-show-form .g-recaptcha");const object=recaptcha?recaptcha.closest("form"):null;frmFrontForm.submitFormNow(object)},afterRecaptcha:function(_,
|
||
formID){const object=document.querySelector("#frm_form_"+formID+"_container form");frmFrontForm.submitFormNow(object)},submitForm:function(e){frmFrontForm.submitFormManual(e,this)},submitFormManual:function(e,object){if(document.body.classList.contains("wp-admin")&&!object.closest(".frmapi-form"))return;e.preventDefault();if(typeof frmProForm!=="undefined"&&typeof frmProForm.submitAllowed==="function"&&!frmProForm.submitAllowed(object))return;const errors=frmFrontForm.validateFormSubmit(object);if(Object.keys(errors).length!==
|
||
0)return;const invisibleRecaptcha=hasInvisibleRecaptcha(object);if(invisibleRecaptcha){showLoadingIndicator(jQuery(object));executeInvisibleRecaptcha(invisibleRecaptcha)}else{showSubmitLoading(jQuery(object));frmFrontForm.submitFormNow(object)}},submitFormNow:function(object){let hasFileFields,antispamInput,classList=object.className.trim().split(/\s+/gi);if(object.hasAttribute("data-token")&&null===object.querySelector('[name="antispam_token"]')){antispamInput=document.createElement("input");antispamInput.type=
|
||
"hidden";antispamInput.name="antispam_token";antispamInput.value=object.getAttribute("data-token");object.append(antispamInput)}const uniqueIDInput=document.createElement("input");uniqueIDInput.type="hidden";uniqueIDInput.name="unique_id";uniqueIDInput.value=getUniqueKey();object.append(uniqueIDInput);if(classList.includes("frm_ajax_submit")){const fileInputs=object.querySelectorAll('input[type="file"]');hasFileFields=Array.from(fileInputs).filter(input=>!!input.value).length;if(hasFileFields<1){const actionInput=
|
||
object.querySelector('input[name="frm_action"]');const action=actionInput?actionInput.value:"";frmFrontForm.checkFormErrors(object,action)}else object.submit()}else object.submit()},validateFormSubmit:function(object){const form=object instanceof jQuery?object.get(0):object;if(typeof tinyMCE!=="undefined"&&form&&form.querySelector(".wp-editor-wrap"))tinyMCE.triggerSave();jsErrors=[];if(shouldJSValidate(object)){frmFrontForm.getAjaxFormErrors(object);if(Object.keys(jsErrors).length)frmFrontForm.addAjaxFormErrors(object)}return jsErrors},
|
||
getAjaxFormErrors:function(object){let customErrors,key;const form=object instanceof jQuery?object.get(0):object;jsErrors=validateForm(object);if(typeof frmThemeOverride_jsErrors==="function"){const actionInput=form?form.querySelector('input[name="frm_action"]'):null;const action=actionInput?actionInput.value:"";customErrors=frmThemeOverride_jsErrors(action,object);if(Object.keys(customErrors).length)for(key in customErrors)jsErrors[key]=customErrors[key]}triggerCustomEvent(document,"frm_get_ajax_form_errors",
|
||
{formEl:object,errors:jsErrors});return jsErrors},addAjaxFormErrors:function(object){let key;const form=object instanceof jQuery?object.get(0):object;removeAllErrors();for(key in jsErrors){const fieldCont=form?form.querySelector("#frm_field_"+key+"_container"):null;if(fieldCont)addFieldError(fieldCont,key,jsErrors);else delete jsErrors[key]}scrollToFirstField(object);checkForErrorsAndMaybeSetFocus()},checkFormErrors:getFormErrors,checkRequiredField,showSubmitLoading,removeSubmitLoading,scrollToID:function(id){const object=
|
||
jQuery(document.getElementById(id));frmFrontForm.scrollMsg(object,false)},scrollMsg:function(id,object,animate){let newPos,m,b,screenTop,screenBottom,scrollObj="";if(typeof object==="undefined"){scrollObj=jQuery(document.getElementById("frm_form_"+id+"_container"));if(scrollObj.length<1)return}else if(typeof id==="string"){const formEl=object instanceof jQuery?object.get(0):object;const fieldEl=formEl?formEl.querySelector("#frm_field_"+id+"_container"):null;scrollObj=fieldEl?jQuery(fieldEl):jQuery()}else scrollObj=
|
||
id;jQuery(scrollObj).trigger("focus");newPos=scrollObj.offset().top;if(!newPos||frm_js.offset==="-1")return;newPos=newPos-frm_js.offset;m=getComputedStyle(document.documentElement).marginTop;b=getComputedStyle(document.body).marginTop;if(m||b)newPos=newPos-parseInt(m)-parseInt(b);if(newPos&&window.innerHeight){screenTop=document.documentElement.scrollTop||document.body.scrollTop;screenBottom=screenTop+window.innerHeight;if(newPos>screenBottom||newPos<screenTop){if(typeof animate==="undefined")document.documentElement.scrollTop=
|
||
newPos;else animateScroll(screenTop,newPos,500);return false}}},fieldValueChanged:function(e){const fieldId=frmFrontForm.getFieldId(this,false);if(!fieldId||typeof fieldId==="undefined")return;if(e.frmTriggered&&e.frmTriggered==fieldId)return;jQuery(document).trigger("frmFieldChanged",[this,fieldId,e]);if(e.selfTriggered!==true)maybeValidateChange(this)},escapeHtml:function(text){console.warn("DEPRECATED: function frmFrontForm.escapeHtml in v6.17");return text.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,
|
||
">").replace(/"/g,""").replace(/'/g,"'")},triggerCustomEvent:triggerCustomEvent,documentOn}}window.frmFrontForm=frmFrontFormJS();jQuery(document).ready(function(){frmFrontForm.init()});function frmRecaptcha(){frmCaptcha(".frm-g-recaptcha")}function frmHcaptcha(){frmCaptcha(".h-captcha")}function frmTurnstile(){frmCaptcha(".frm-cf-turnstile")}
|
||
function frmCaptcha(captchaSelector){if(".h-captcha"===captchaSelector){const captchaLabels=document.querySelectorAll('label[for="h-captcha-response"]');if(captchaLabels.length)captchaLabels.forEach(label=>{const captchaResponse=label.closest("form")?.querySelector('[name="h-captcha-response"]');if(captchaResponse)label.htmlFor=captchaResponse.id});return}let c;const captchas=document.querySelectorAll(captchaSelector);const cl=captchas.length;for(c=0;c<cl;c++){const closestForm=captchas[c].closest("form");
|
||
const formIsVisible=closestForm&&closestForm.offsetParent!==null;const captcha=captchas[c];if(!formIsVisible){const interval=setInterval(function(){if(closestForm&&closestForm.offsetParent!==null){frmFrontForm.renderCaptcha(captcha,captchaSelector);clearInterval(interval)}},400);continue}frmFrontForm.renderCaptcha(captcha,captchaSelector)}}
|
||
function getSelectedCaptcha(captchaSelector){if(captchaSelector===".frm-g-recaptcha")return grecaptcha;if(document.querySelector(".frm-cf-turnstile"))return turnstile;return hcaptcha}function frmAfterRecaptcha(token){frmFrontForm.afterSingleRecaptcha(token)};
|
||
function frmProFormJS(){let currentlyAddingRow=false;let action="";let processesRunning=0;const lookupQueues={};let hiddenSubmitButtons=[];let pendingDynamicFieldAjax=[];const pendingLookupFieldAjax=[];let listWrappersOriginal={};const intlPhoneInputs={};let autoId=0;function setNextPage(e){var closestButton;if(this.className.indexOf("frm_rootline_title")!==-1){closestButton=this.previousElementSibling;closestButton.click();return}if(this.className.indexOf("frm_rootline_single")!==-1){this.querySelector("input").click();
|
||
return}var $thisObj=jQuery(this);var thisType=$thisObj.attr("type");if(thisType!=="submit")e.preventDefault();var f=$thisObj.parents("form").first(),v="",d="",thisName=this.name;if(thisName==="frm_prev_page"||this.className.indexOf("frm_prev_page")!==-1){v=jQuery(f).find(".frm_next_page").attr("id").replace("frm_next_p_","");if(f.length)maybeAddEmptyHiddenInputsForCheckboxes(f.get(0))}else if(thisName==="frm_save_draft"||this.className.indexOf("frm_save_draft")!==-1)d=1;else if(this.className.indexOf("frm_page_skip")!==
|
||
-1){var goingTo=$thisObj.data("page");var formId=jQuery(f).find('input[name="form_id"]').val();var orderField=jQuery(f).find('input[name="frm_page_order_'+formId+'"]');jQuery(f).append('<input name="frm_last_page" type="hidden" value="'+orderField.val()+'" />');if(goingTo==="")orderField.remove();else orderField.val(goingTo)}else if(this.className.indexOf("frm_page_back")!==-1)v=$thisObj.data("page");if(1===d)resetTinyMceOnDraftSave();else resetTinyMceOnPageTurn();jQuery(".frm_next_page").val(v);
|
||
jQuery(".frm_saving_draft").val(d);if(thisType!=="submit")f.trigger("submit")}function maybeAddEmptyHiddenInputsForCheckboxes(form){form.querySelectorAll(".frm_opt_container").forEach(function(optContainer){var checkboxes,hiddenInput;checkboxes=optContainer.querySelectorAll('input[type="checkbox"]');if(checkboxes.length&&!jQuery(checkboxes).filter(":checked").length){hiddenInput=document.createElement("input");hiddenInput.setAttribute("type","hidden");hiddenInput.setAttribute("name",checkboxes[0].getAttribute("name"));
|
||
optContainer.appendChild(hiddenInput)}})}function resetTinyMceOnDraftSave(){jQuery(document).one("frmFormComplete",function(){jQuery(".wp-editor-area").each(function(){reInitializeRichText(this.id)})})}function resetTinyMceOnPageTurn(){var removeIds=[];jQuery(".frm_form_field .wp-editor-area").each(function(){removeIds.push(this.id)});jQuery(document).one("frmPageChanged",function(){var removeIndex,removeId;for(removeIndex=0;removeIndex<removeIds.length;++removeIndex){removeId=removeIds[removeIndex];
|
||
removeRichText(removeId)}checkConditionalLogic()})}function toggleSection(e){var $toggleContainer,togglingOn;if(e.key!==undefined){if(e.key!==" ")return}else if(e.keyCode!==undefined&&e.keyCode!==32)return;e.preventDefault();$toggleContainer=jQuery(this).parent().children(".frm_toggle_container");togglingOn="none"===$toggleContainer.get(0).style.display;if(togglingOn)$toggleContainer.show();triggerEvent(document,"frmBeforeToggleSection",{toggleButton:this});if(togglingOn)$toggleContainer.hide();$toggleContainer.slideToggle("fast");
|
||
if(togglingOn){this.className+=" active";this.setAttribute("aria-expanded","true")}else{this.className=this.className.replace(" active","");this.setAttribute("aria-expanded","false")}}function loadDateFields(){jQuery(document).on("focusin",".frm_date",triggerDateField);loadUniqueTimeFields()}function frmDatepickerPro(input,settings){if(input._flatpickr)return input._flatpickr;const _this=this;this.initAccessiblity=frmDatepickerPro.initAccessiblity;this.initMonthSelector=frmDatepickerPro.initMonthSelector;
|
||
this.initYearSelector=frmDatepickerPro.initYearSelector;this.parseFunctionConfig=frmDatepickerPro.parseFunctionConfig;this.getDateRange=frmDatepickerPro.getDateRange;this.callbacks=frmDatepickerPro.callbacks;this.getDefaultConfigs=frmDatepickerPro.getDefaultConfigs;this.isUsingACustomTheme=frmDatepickerPro.isUsingACustomTheme;this.getConfigs=function(){if("undefined"===typeof settings.datepickerJsOptions)return _this.getDefaultConfigs(settings,input);return{..._this.getDefaultConfigs(settings,input),
|
||
..._this.parseFunctionConfig(settings.datepickerJsOptions)}};return flatpickr(input,this.getConfigs())}frmDatepickerPro.getThemeType=function(){const themeFile=document.querySelector('link[href*="flatpickr/dist/themes/"]');const themeSelectors=[{name:"frm-dark",selector:"dark.css"},{name:"frm-material-blue",selector:"material_blue.css"},{name:"frm-material-green",selector:"material_green.css"},{name:"frm-material-orange",selector:"material_orange.css"},{name:"frm-material-red",selector:"material_red.css"},
|
||
{name:"frm-airbnb",selector:"airbnb.css"},{name:"frm-confetti",selector:"confetti.css"}];if(themeFile&&themeFile.href)for(const theme of themeSelectors)if(themeFile.href.includes(theme.selector))return theme.name;return""};frmDatepickerPro.themeType=frmDatepickerPro.getThemeType();frmDatepickerPro.isUsingACustomTheme=frmDatepickerPro.themeType!=="";frmDatepickerPro.callbacks={};frmDatepickerPro.callbacks.onOpen=function(selectedDates,dateStr,instance){instance.calendarContainer.classList.add("frm-datepicker",
|
||
"with_frm_style");if(frmDatepickerPro.isUsingACustomTheme)instance.calendarContainer.classList.add("frm-datepicker-custom-theme",frmDatepickerPro.themeType)};frmDatepickerPro.callbacks.onClose=function(selectedDates,dateStr,instance){if(!instance.config.inline){instance.calendarContainer.classList.remove("frm-datepicker","with_frm_style");if(frmDatepickerPro.isUsingACustomTheme)instance.calendarContainer.classList.remove("frm-datepicker-custom-theme",frmDatepickerPro.themeType)}triggerEvent(instance.input,
|
||
"frmFlatpickrClosed",{instance})};frmDatepickerPro.getDefaultConfigs=function(config,input){this.getSettings=function(){const result={};if(config.formidable_dates||config.options)return config;result.formidable_dates=config;result.options=config.datepickerOptions;return result};this.getDatesDisabled=function(settings){const disabledDates=settings?.formidable_dates?.datesDisabled||settings?.options?.datesDisabled;if(!Array.isArray(disabledDates))return[];return disabledDates.map(date=>new Date(date+
|
||
"T00:00:00"))};this.getInstanceElement=instance=>{if(instance.config.inline&&"INPUT"!==instance.element.nodeName){const fieldId=instance.element.dataset.fieldId;const element=document.querySelector(`input[name="item_meta[${fieldId}]"]`);if(element)return element;return instance.element}return instance.element};this.updateRangeFieldsOnChange=(mode,instance,dateStr,selectedDates)=>{if("range"!==mode)return;const fieldId=input.dataset.fieldId||input.dataset.rangeStartFieldId;const startDateField=document.querySelector(`input[data-field-id="${fieldId}"]`)||
|
||
document.querySelector(`input[type="hidden"][name="item_meta[${fieldId}]"]`);const [startDate,endDate]=selectedDates;const endDateField="undefined"!==typeof endDate?document.querySelector(`input[data-range-start-field-id="${fieldId}"]`):null;const instanceElement=this.getInstanceElement(instance);instanceElement.dataset.rangeValue=dateStr;if(instanceElement===startDateField&&null!==endDateField){instanceElement.value=flatpickr.formatDate(startDate,settings.options.fpDateFormat);endDateField.dataset.rangeValue=
|
||
dateStr;endDateField._flatpickr.setDate(dateStr);endDateField.value=flatpickr.formatDate(endDate,settings.options.fpDateFormat);endDateField.dispatchEvent(new Event("change",{bubbles:true}))}if(instanceElement===endDateField){instanceElement.value=flatpickr.formatDate(endDate,settings.options.fpDateFormat);startDateField.dataset.rangeValue=dateStr;startDateField._flatpickr.setDate(dateStr);startDateField.value=flatpickr.formatDate(startDate,settings.options.fpDateFormat)}};const settings=this.getSettings();
|
||
const mode=input.classList.contains("frm_date_range")||settings.formidable_dates&&settings.formidable_dates.isRangeEnabled?"range":"single";const inline=settings.formidable_dates&&settings.formidable_dates.inline;const showMonths=inline&&"range"===mode?2:1;const {min,max}=frmDatepickerPro.getDateRange(settings);const disabledDates=this.getDatesDisabled(settings);const firstDay=settings.options.firstDay||1;const flatpickrOptions={dateFormat:settings.options.fpDateFormat,inline:settings.formidable_dates&&
|
||
settings.formidable_dates.inline,minDate:min,maxDate:max,monthSelectorType:"true"===settings.options.changeMonth?"dropdown":"static",changeYear:settings.options.changeYear,closeOnSelect:true,showMonths:showMonths,locale:{...flatpickr.l10ns[settings.locale||settings.options.locale],firstDayOfWeek:firstDay},mode:mode,disable:[function(date){return settings.formidable_dates&&settings.formidable_dates.daysEnabled&&-1===settings.formidable_dates.daysEnabled.indexOf(date.getDay())},...(disabledDates?disabledDates:
|
||
[])],onReady:function(selectedDates,dateStr,instance){setTimeout(()=>frmDatepickerPro.setDefaultRangeValue(instance.element));if(instance.config.inline){instance.calendarContainer.classList.add("frm-datepicker","with_frm_style","frm_date_inline");if(frmDatepickerPro.isUsingACustomTheme)instance.calendarContainer.classList.add("frm-datepicker-custom-theme",frmDatepickerPro.themeType)}frmDatepickerPro.initMonthSelector(instance);frmDatepickerPro.initYearSelector(instance);frmDatepickerPro.initAccessiblity(instance)},
|
||
onChange:(selectedDates,dateStr,instance)=>{if(instance.config.inline){instance.config.altInputElement.value=dateStr;instance.config.altInputElement.dispatchEvent(new Event("change",{bubbles:true}))}this.updateRangeFieldsOnChange(mode,instance,dateStr,selectedDates)},onOpen:function(selectedDates,dateStr,instance){frmDatepickerPro.callbacks.onOpen(selectedDates,dateStr,instance)},onClose:frmDatepickerPro.callbacks.onClose,shorthandCurrentMonth:true,altInputClass:""};if(settings.formidable_dates&&
|
||
settings.formidable_dates.inline){flatpickrOptions.altInput=true;flatpickrOptions.altInputElement=document.querySelector(settings.options.altField)}return flatpickrOptions};frmDatepickerPro.setDefaultRangeValue=function(instanceElement){let input=instanceElement;if(instanceElement._flatpickr.config.inline){const fieldId=instanceElement.dataset.fieldId;input=document.querySelector(`input[name="item_meta[${fieldId}]"]`);input.dataset.fieldId=fieldId}if(!input.classList.contains("frm_date_range"))return null;
|
||
const startDate=input.dataset.rangeStartFieldId?document.querySelector(`input[data-field-id="${input.dataset.rangeStartFieldId}"]`):input;const startDateValue=startDate.value;const endDate=input.dataset.rangeStartFieldId?input:document.querySelector(`input[data-range-start-field-id="${input.dataset.fieldId}"]`);const endDateValue=endDate.value;if(instanceElement._flatpickr.config.inline){instanceElement._flatpickr.setDate(startDateValue+" to "+endDateValue);startDate.value=startDateValue;endDate.value=
|
||
endDateValue;return}if("undefined"===typeof startDate._flatpickr)return;startDate._flatpickr.setDate(startDateValue+" to "+endDateValue);startDate.value=startDateValue;endDate._flatpickr.setDate(startDateValue+" to "+endDateValue);endDate.value=endDateValue};frmDatepickerPro.initMonthSelector=function(instance){if("static"!==instance.config.monthSelectorType)return;instance.calendarContainer.classList.add("frm-date-no-month-select")};frmDatepickerPro.initYearSelector=function(instance){if("false"!==
|
||
instance.config.changeYear)return;instance.calendarContainer.classList.add("frm-date-no-year-select")};frmDatepickerPro.initAccessiblity=function(instance){this.init=function(){instance.calendarContainer.setAttribute("role","dialog");instance.calendarContainer.setAttribute("tabindex","0");this.prevButton();this.nextButton()};this.prevButton=function(){const prevArrow=instance.calendarContainer.querySelector(".flatpickr-prev-month");if(null===prevArrow)return;prevArrow.setAttribute("tabindex","0");
|
||
prevArrow.setAttribute("role","button");prevArrow.addEventListener("keydown",function(event){if(event.key==="Enter")prevArrow.click()})};this.nextButton=function(){const nextArrow=instance.calendarContainer.querySelector(".flatpickr-next-month");if(null===nextArrow)return;nextArrow.setAttribute("tabindex","0");nextArrow.setAttribute("role","button");nextArrow.addEventListener("keydown",function(event){if(event.key==="Enter")nextArrow.click()})};this.init()};frmDatepickerPro.getDateRange=function(optionsData){const dates=
|
||
{min:null,max:null};const [minYear,maxYear]=optionsData.options.yearRange.split(":");dates.min=new Date(minYear+"-01-01T00:00:00");dates.max=new Date(maxYear+"-12-31T23:59:59");if(!optionsData.formidable_dates)return dates;if(optionsData.formidable_dates.maximum_date_cond)if(optionsData.maxDate)dates.max=optionsData.maxDate;else dates.max=frmDatepickerPro.parseOffsetDate(optionsData.formidable_dates.maximum_date_val);if(optionsData.formidable_dates.minimum_date_cond)if(optionsData.minDate)dates.min=
|
||
optionsData.minDate;else dates.min=frmDatepickerPro.parseOffsetDate(optionsData.formidable_dates.minimum_date_val);return dates};frmDatepickerPro.parseOffsetDate=function(date){const cleanedDate=date.toLowerCase().replace(/\s+/g,"");const regex=/^([+-]\d+)(day|days|month|months|year|years)$/;const match=cleanedDate.match(regex);if(!match)return date;const [,number,unit]=match;const amount=parseInt(number);const currentDate=new Date;if(unit.startsWith("day")){currentDate.setDate(currentDate.getDate()+
|
||
amount);return currentDate}if(unit.startsWith("month")){currentDate.setMonth(currentDate.getMonth()+amount);return currentDate}if(unit.startsWith("year")){currentDate.setFullYear(currentDate.getFullYear()+amount);return currentDate}return currentDate};frmDatepickerPro.parseFunctionConfig=function(config){const parsed=JSON.parse(config);const stringToFunction=str=>{if(typeof str==="string"&&str.startsWith("function"))return(new Function("return "+str))();return str};Object.keys(parsed).forEach(key=>
|
||
{if(Array.isArray(parsed[key]))parsed[key]=parsed[key].map(item=>stringToFunction(item));else parsed[key]=stringToFunction(parsed[key])});return parsed};frmDatepickerPro.useFlatpickr=()=>window.frm_js&&window.frm_js.datepickerLibrary==="flatpickr";function triggerDateField(){if(this.className.indexOf("frm_custom_date")!==-1||typeof __frmDatepicker==="undefined")return;var dateFields=__frmDatepicker,id=this.id,idParts=id.split("-"),altID="";if(isRepeatingFieldByName(this.name))altID='input[id^="'+
|
||
idParts[0]+'"]';else altID='input[id^="'+idParts.join("-")+'"]';var optKey=0;for(var i=0;i<dateFields.length;i++)if(dateFields[i].triggerID==="#"+id||dateFields[i].triggerID==altID){optKey=i;break}if(dateFields[optKey].options.defaultDate!=="")dateFields[optKey].options.defaultDate=new Date(dateFields[optKey].options.defaultDate);if(frmDatepickerPro.useFlatpickr())new frmDatepickerPro(this,dateFields[optKey]);else{dateFields[optKey].options.beforeShow=frmProForm.addFormidableClassToDatepicker;dateFields[optKey].options.onClose=
|
||
frmProForm.removeFormidableClassFromDatepicker;jQuery(this).datepicker(jQuery.extend({},jQuery.datepicker.regional[dateFields[optKey].locale],dateFields[optKey].options))}}function loadDropzones(repeatRow){if(typeof __frmDropzone==="undefined")return;var uploadFields=__frmDropzone;for(var i=0;i<uploadFields.length;i++)loadDropzone(i,repeatRow)}function loadDropzone(i,repeatRow){var field,max,uploadedCount,form,uploadFields=__frmDropzone,uploadField=uploadFields[i],selector="#"+uploadField.htmlID+
|
||
"_dropzone",fieldName=uploadField.fieldName;if(typeof repeatRow!=="undefined"&&selector.indexOf("-0_dropzone")!==-1){selector=selector.replace("-0_dropzone","-"+repeatRow+"_dropzone");fieldName=fieldName.replace("[0]","["+repeatRow+"]");delete uploadField.mockFiles}field=jQuery(selector);if(field.length<1||field.hasClass("dz-clickable")||field.hasClass("dz-started"))return;max=uploadField.maxFiles;if(typeof uploadField.mockFiles!=="undefined"){uploadedCount=uploadField.mockFiles.length;if(max>0)max=
|
||
max-uploadedCount}form=field.closest("form");uploadField=uploadFields[i];field.dropzone({url:getAjaxUrl(form.get(0)),headers:{"Frm-Dropzone":1},addRemoveLinks:false,paramName:field.attr("id").replace("_dropzone",""),maxFilesize:uploadField.maxFilesize,minFilesize:uploadField.minFilesize,maxFiles:max,uploadMultiple:uploadField.uploadMultiple,hiddenInputContainer:field.parent()[0],dictDefaultMessage:uploadField.defaultMessage,dictFallbackMessage:uploadField.fallbackMessage,dictFallbackText:uploadField.fallbackText,
|
||
dictFileTooBig:uploadField.fileTooBig,dictFileTooSmall:uploadField.fileTooSmall,dictInvalidFileType:uploadField.invalidFileType,dictResponseError:uploadField.responseError,dictCancelUpload:uploadField.cancel,dictCancelUploadConfirmation:uploadField.cancelConfirm,dictRemoveFile:uploadField.remove,dictMaxFilesExceeded:uploadField.maxFilesExceeded,resizeMethod:"contain",resizeWidth:uploadField.resizeWidth,resizeHeight:uploadField.resizeHeight,thumbnailWidth:60,thumbnailHeight:60,timeout:uploadField.timeout,
|
||
previewTemplate:filePreviewHTML(uploadField),acceptedFiles:uploadField.acceptedFiles,fallback:function(){jQuery(this.element).closest("form").removeClass("frm_ajax_submit")},init:function(){var hidden,mockFileIndex,mockFileData,mockFile;hidden=field.parent().find(".dz-hidden-input");if(typeof hidden.attr("id")==="undefined")hidden.attr("id",uploadFields[i].label);this.on("thumbnail",function(file){if(file.size<1024*1024*this.options.minFilesize)if("function"===typeof file.rejectSize)file.rejectSize()});
|
||
this.on("sending",function(file,xhr,formData){if(isSpam(uploadFields[i].parentFormID,uploadField.checkHoneypot)){this.removeFile(file);alert(frm_js.file_spam);return false}else{formData.append("action","frm_submit_dropzone");formData.append("field_id",uploadFields[i].fieldID);formData.append("form_id",uploadFields[i].formID);formData.append("nonce",frm_js.nonce);if(form.get(0).hasAttribute("data-token"))formData.append("antispam_token",form.get(0).getAttribute("data-token"))}});this.on("processing",
|
||
function(){if(!this.options.uploadMultiple)this.removeEventListeners()});this.on("success",function(file,response){var mediaIDs,m,mediaID;mediaIDs=JSON.parse(response);for(m=0;m<mediaIDs.length;m++)if(uploadFields[i].uploadMultiple!==true){mediaID=mediaIDs[m];jQuery('input[name="'+fieldName+'"]').val(mediaID)}if(this.options.uploadMultiple===false)this.disable();clearErrorsOnUpload(file.previewElement)});this.on("successmultiple",function(files,response){var mediaIDs=JSON.parse(response);for(var m=
|
||
0;m<files.length;m++)jQuery(files[m].previewElement).append(getHiddenUploadHTML(uploadFields[i],mediaIDs[m],fieldName))});this.on("complete",function(file){var fileName,node,img,thumbnail;processesRunning--;if(form.length)removeSubmitLoading(form.get(0),uploadFields[i].formID,processesRunning);if(typeof file.mediaID==="undefined")return;if(uploadFields[i].uploadMultiple)jQuery(file.previewElement).append(getHiddenUploadHTML(uploadFields[i],file.mediaID,fieldName));fileName=file.previewElement.querySelectorAll("[data-dz-name]");
|
||
for(var _i=0,_len=fileName.length;_i<_len;_i++){node=fileName[_i];if(file.accessible)node.innerHTML='<a href="'+file.url+'" target="_blank" rel="noopener">'+file.name+"</a>";else node.innerHTML=file.name;if(file.ext){img=file.previewElement.querySelector(".dz-image img");if(null!==img){thumbnail=maybeGetExtensionThumbnail(file.ext);if(false!==thumbnail)img.setAttribute("src",thumbnail)}}}});this.on("addedfile",function(file){var ext,thumbnail;ext=file.name.split(".").pop();thumbnail=maybeGetExtensionThumbnail(ext);
|
||
processesRunning++;frmFrontForm.showSubmitLoading(form);if(false!==thumbnail)jQuery(file.previewElement).find(".dz-image img").attr("src",thumbnail)});function clearErrorsOnUpload(fileElement){var container=fileElement.closest(".frm_form_field");if(!container)return;container.classList.remove("frm_blank_field","has-error");container.querySelectorAll(".form-field .frm_error, .frm_error_style").forEach(function(error){if(error.parentNode)error.parentNode.removeChild(error)})}this.on("removedfile",function(file){var fileCount=
|
||
this.files.length;if(this.options.uploadMultiple===false&&fileCount<1)this.enable();if(file.accepted!==false&&uploadFields[i].uploadMultiple!==true)jQuery('input[name="'+fieldName+'"]').val("");if(file.accepted!==false&&typeof file.mediaID!=="undefined"){jQuery(file.previewElement).remove();fileCount=this.files.length;this.options.maxFiles=uploadFields[i].maxFiles-fileCount}});if(typeof uploadFields[i].mockFiles!=="undefined")for(mockFileIndex=0;mockFileIndex<uploadFields[i].mockFiles.length;mockFileIndex++){mockFileData=
|
||
uploadFields[i].mockFiles[mockFileIndex];mockFile={name:mockFileData.name,size:mockFileData.size,url:mockFileData.file_url,mediaID:mockFileData.id,accessible:mockFileData.accessible,ext:mockFileData.ext,type:mockFileData.type};this.emit("addedfile",mockFile);if(mockFile.accessible&&"string"===typeof mockFile.type&&0===mockFile.type.indexOf("image/"))this.emit("thumbnail",mockFile,mockFileData.url);this.emit("complete",mockFile);this.files.push(mockFile)}},accept:function(file,done){var message=this.options.dictFileTooSmall.replace("{{minFilesize}}",
|
||
this.options.minFilesize);file.rejectSize=function(){done(message)};return done()}})}function loadImask(containerId){if(!window.IMask)return;let inputs;if(containerId)inputs=document.querySelectorAll("#"+containerId+" input[data-frmmask]");else inputs=document.querySelectorAll("input[data-frmmask]");inputs.forEach(input=>{if(input.getAttribute("data-frm-imask-initialized"))return;input.setAttribute("data-frm-imask-initialized",1);const mask=IMask(input,{mask:input.dataset.frmmask,lazy:true,definitions:{"*":/[a-zA-Z0-9]/}});
|
||
input.addEventListener("change",()=>mask.updateValue());input.addEventListener("focus",()=>{mask.updateOptions({lazy:false});if(input.hasAttribute("maxlength")&&input.value.length>=input.maxLength){if(!input.hasAttribute("original-maxlength"))input.setAttribute("original-maxlength",input.maxLength);input.maxLength=parseInt(input.getAttribute("original-maxlength"))+1}if(""===mask.unmaskedValue)mask.alignCursor(0)});input.addEventListener("blur",()=>{input.value=input.value.trim();if(""===mask.unmaskedValue)mask.updateOptions({lazy:true});
|
||
if(input.hasAttribute("original-maxlength"))input.maxLength=parseInt(input.getAttribute("original-maxlength"))})})}function removeSubmitLoading(form,formId,processesRunning){var isFinalSubmitButton,enable;isFinalSubmitButton=form.querySelector(".frm_submit .frm_button_submit.frm_final_submit");enable=!isFinalSubmitButton||!submitButtonIsConditionallyDisabled(formId)?"enable":"";if(""===enable)jQuery(".frm_loading_form").find("a.frm_save_draft").css("pointer-events","");frmFrontForm.removeSubmitLoading(jQuery(form),
|
||
enable,processesRunning)}function submitButtonIsConditionallyDisabled(formId){return submitButtonIsConditionallyNotAvailable(formId)&&"disable"===__FRMRULES["submit_"+formId].hideDisable}function submitButtonIsConditionallyNotAvailable(formId){var hideFields=document.getElementById("frm_hide_fields_"+formId);return hideFields&&-1!==hideFields.value.indexOf('"frm_form_'+formId+'_container .frm_final_submit"')}function maybeGetExtensionThumbnail(ext){if(-1!==["jpg","jpeg","png"].indexOf(ext))return false;
|
||
if("pdf"===ext)return getProPluginUrl()+"/images/pdf.svg";if(-1!==ext.indexOf("xls"))return getProPluginUrl()+"/images/xls.svg";return getProPluginUrl()+"/images/doc.svg"}function getProPluginUrl(){var freePluginUrlSplitBySlashes=frm_js.images_url.split("/");freePluginUrlSplitBySlashes.pop();freePluginUrlSplitBySlashes.pop();freePluginUrlSplitBySlashes.push("formidable-pro");return freePluginUrlSplitBySlashes.join("/")}function filePreviewHTML(field){return'<div class="dz-preview dz-file-preview">\n'+
|
||
'<div class="dz-image"><img data-dz-thumbnail /></div>\n'+'<div class="dz-column">\n'+'<div class="dz-details">\n'+'<div class="dz-filename"><span data-dz-name></span></div>\n'+" "+'<div class="dz-size"><span data-dz-size></span></div>\n'+'<a class="dz-remove frm_remove_link" href="javascript:undefined;" data-dz-remove title="'+field.remove+'">'+'<svg width="16" height="16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="m11.5 4.5-7 7M4.5 4.5l7 7" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/></svg>'+
|
||
"</a>"+"</div>\n"+'<div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>\n'+'<div class="dz-error-message"><span data-dz-errormessage></span></div>\n'+"</div>\n"+"</div>"}function getHiddenUploadHTML(field,mediaID,fieldName){return'<input name="'+fieldName+'[]" type="hidden" value="'+mediaID+'" data-frmfile="'+field.fieldID+'" />'}function removeFile(){var fieldName=jQuery(this).data("frm-remove");fadeOut(jQuery(this).closest(".dz-preview"));var singleField=jQuery('input[name="'+
|
||
fieldName+'"]');if(singleField.length)singleField.val("")}function postToAjaxUrl(form,data,success,error,extraParams){var ajaxParams="object"===typeof extraParams?extraParams:{};ajaxParams.type="POST";ajaxParams.url=getAjaxUrl(form);ajaxParams.data=data;ajaxParams.success=success;if("function"===typeof error)ajaxParams.error=error;jQuery.ajax(ajaxParams)}function getAjaxUrl(form){var ajaxUrl,action;ajaxUrl=frm_js.ajax_url;action=form.getAttribute("action");if("string"===typeof action&&-1!==action.indexOf("?action=frm_forms_preview"))ajaxUrl=
|
||
action.split("?action=frm_forms_preview")[0];return ajaxUrl}function isSpam(formID,checkHoneypot){if(isHeadless())return true;return checkHoneypot&&isHoneypotSpam(formID)}function isHoneypotSpam(formID){var honeypotField=document.getElementById("frm_email_"+formID);if(honeypotField===null)honeypotField=document.getElementById("frm_form_"+formID+"_container")?.querySelector('.frm_verify[id^="field_"]');return honeypotField!==null&&honeypotField.value!==""}function isHeadless(){return window._phantom||
|
||
window.callPhantom||window.__phantomas||window.Buffer||window.emit||window.spawn}function showOtherText(){var type=this.type,other=false,select=false;if(type==="select-one"){select=true;var curOpt=this.options[this.selectedIndex];if(typeof curOpt!=="undefined"&&curOpt.className==="frm_other_trigger")other=true}else if(type==="select-multiple"){select=true;var allOpts=this.options;other=false;for(var i=0;i<allOpts.length;i++)if(allOpts[i].className==="frm_other_trigger")if(allOpts[i].selected){other=
|
||
true;break}}if(select){var otherField=jQuery(this).parent().children(".frm_other_input");if(otherField.length)if(other)otherField[0].className=otherField[0].className.replace("frm_pos_none","");else{if(otherField[0].className.indexOf("frm_pos_none")<1)otherField[0].className=otherField[0].className+" frm_pos_none";otherField[0].value=""}}else if(type==="radio"){if(jQuery(this).is(":checked")){jQuery(this).closest(".frm_radio").children(".frm_other_input").removeClass("frm_pos_none");jQuery(this).closest(".frm_radio").siblings().children(".frm_other_input").addClass("frm_pos_none").val("")}}else if(type===
|
||
"checkbox")if(this.checked)jQuery(this).closest(".frm_checkbox").children(".frm_other_input").removeClass("frm_pos_none");else jQuery(this).closest(".frm_checkbox").children(".frm_other_input").addClass("frm_pos_none").val("")}function setToggleAriaChecked(){this.nextElementSibling.setAttribute("aria-checked",this.checked?"true":"false")}function maybeCheckDependent(_,field,fieldId,e){var $field,originalEvent;$field=jQuery(field);checkFieldsWithConditionalLogicDependentOnThis(fieldId,$field);originalEvent=
|
||
getOriginalEvent(e);checkFieldsWatchingLookup(fieldId,$field,originalEvent);doCalculation(fieldId,$field)}function getOriginalEvent(e){var originalEvent;if(typeof e.originalEvent!=="undefined"||e.currentTarget.className.indexOf("frm_chzn")>-1||e.currentTarget.className.indexOf("frm_slimselect")>-1)originalEvent="value changed";else originalEvent="other";return originalEvent}function checkFieldsWithConditionalLogicDependentOnThis(fieldId,changedInput){if(typeof __FRMRULES==="undefined"||typeof __FRMRULES[fieldId]===
|
||
"undefined"||__FRMRULES[fieldId].dependents.length<1||changedInput===null||typeof changedInput==="undefined")return;var triggerFieldArgs=__FRMRULES[fieldId];var repeatArgs=getRepeatArgsFromFieldName(changedInput[0].name);pendingDynamicFieldAjax=[];for(var i=0,l=triggerFieldArgs.dependents.length;i<l;i++)hideOrShowFieldById(triggerFieldArgs.dependents[i],repeatArgs);processPendingAjax()}function processPendingAjax(){var fieldsToProcess,postData,data,formId,form;if(!pendingDynamicFieldAjax.length)return;
|
||
fieldsToProcess=pendingDynamicFieldAjax.slice();postData=[];for(data in fieldsToProcess)postData.push(fieldsToProcess[data].data);formId=fieldsToProcess[0].args.depFieldArgs.formId;function processDynamicField(html,depFieldArgs,onCurrentPage){var $fieldDiv,$optContainer,$listInputs,listVal;if(onCurrentPage){$fieldDiv=jQuery("#"+depFieldArgs.containerId);addLoadingIcon($fieldDiv);$optContainer=$fieldDiv.find(".frm_opt_container, .frm_data_container");$optContainer.html(html);$listInputs=$optContainer.children("input");
|
||
listVal=$listInputs.val();removeLoadingIcon($optContainer);if(""===html||""===listVal)hideDynamicField(depFieldArgs);else showDynamicField(depFieldArgs,$fieldDiv,$listInputs,true)}else updateHiddenDynamicListField(depFieldArgs,html)}function ajaxHandler(response){var i;for(i=0;i<fieldsToProcess.length;i++)processDynamicField("undefined"===typeof response[i]?"":response[i],fieldsToProcess[i].args.depFieldArgs,fieldsToProcess[i].args.onCurrentPage)}form=getFormById(formId);if(form)postToAjaxUrl(form,
|
||
{action:"frm_fields_ajax_get_data_arr",postData:postData},ajaxHandler,function(response){console.error(response)},{dataType:"json"})}function hideOrShowFieldById(fieldId,triggerFieldRepeatArgs){var depFieldArgs=getRulesForSingleField(fieldId);if(depFieldArgs===false||depFieldArgs.conditions.length<1)return;var childFieldDivIds=getAllFieldDivIds(depFieldArgs,triggerFieldRepeatArgs);var childFieldNum=childFieldDivIds.length;for(var i=0;i<childFieldNum;i++){depFieldArgs.containerId=childFieldDivIds[i];
|
||
addRepeatRow(depFieldArgs,childFieldDivIds[i]);hideOrShowSingleField(depFieldArgs)}}function getAllFieldDivIds(depFieldArgs,triggerFieldArgs){var childFieldDivs=[];if(depFieldArgs.isRepeating)if(triggerFieldArgs.repeatingSection!==""){var container="frm_field_"+depFieldArgs.fieldId+"-";container+=triggerFieldArgs.repeatingSection+"-"+triggerFieldArgs.repeatRow+"_container";childFieldDivs.push(container)}else childFieldDivs=getAllRepeatingFieldDivIds(depFieldArgs);else if(depFieldArgs.fieldType===
|
||
"submit")childFieldDivs.push(getSubmitButtonContainerID(depFieldArgs));else childFieldDivs.push("frm_field_"+depFieldArgs.fieldId+"_container");return childFieldDivs}function getSubmitButtonContainerID(depFieldArgs){return"frm_form_"+depFieldArgs.formId+"_container .frm_final_submit"}function getAllRepeatingFieldDivIds(depFieldArgs){var childFieldDivs=[],containerFieldId=getContainerFieldId(depFieldArgs);if(isFieldDivOnPage("frm_field_"+containerFieldId+"_container"))childFieldDivs=getRepeatingFieldDivIdsOnCurrentPage(depFieldArgs.fieldId);
|
||
else childFieldDivs=getRepeatingFieldDivIdsAcrossPage(depFieldArgs);return childFieldDivs}function getRepeatingFieldDivIdsOnCurrentPage(fieldId){var childFieldDivs=[],childFields=document.querySelectorAll(".frm_field_"+fieldId+"_container");for(var i=0,l=childFields.length;i<l;i++)childFieldDivs.push(childFields[i].id);return childFieldDivs}function getRepeatingFieldDivIdsAcrossPage(depFieldArgs){var childFieldDivs=[],containerFieldId=getContainerFieldId(depFieldArgs),fieldDiv="frm_field_"+depFieldArgs.fieldId+
|
||
"-"+containerFieldId+"-",allRows=document.querySelectorAll('[name="item_meta['+containerFieldId+'][row_ids][]"]');for(var i=0,l=allRows.length;i<l;i++)if(allRows[i].value!=="")childFieldDivs.push(fieldDiv+allRows[i].value+"_container");if(childFieldDivs.length<1)childFieldDivs.push(fieldDiv+"0_container");return childFieldDivs}function getContainerFieldId(depFieldArgs){var containerFieldId="";if(depFieldArgs.inEmbedForm!=="0")containerFieldId=depFieldArgs.inEmbedForm;else if(depFieldArgs.inSection!==
|
||
"0")containerFieldId=depFieldArgs.inSection;return containerFieldId}function addRepeatRow(depFieldArgs,childFieldDivId){if(depFieldArgs.isRepeating){var divParts=childFieldDivId.replace("_container","").split("-");depFieldArgs.repeatRow=divParts[2]}else depFieldArgs.repeatRow=""}function hideOrShowSingleField(depFieldArgs){var i,add,logicOutcomes=[],len=depFieldArgs.conditions.length;for(i=0;i<len;i++){add=checkLogicCondition(depFieldArgs.conditions[i],depFieldArgs);if(add!==null)logicOutcomes.push(add)}if(logicOutcomes.length)routeToHideOrShowField(depFieldArgs,
|
||
logicOutcomes)}function getRulesForSingleField(fieldId){if(typeof __FRMRULES==="undefined"||typeof __FRMRULES[fieldId]==="undefined")return false;return __FRMRULES[fieldId]}function checkLogicCondition(logicCondition,depFieldArgs){var fieldId=logicCondition.fieldId,logicFieldArgs=getRulesForSingleField(fieldId),fieldValue=getFieldValue(logicFieldArgs,depFieldArgs);if(fieldValue===null)return null;return getLogicConditionOutcome(logicCondition,fieldValue,depFieldArgs,logicFieldArgs)}function getFieldValue(logicFieldArgs,
|
||
depFieldArgs){var fieldValue="";if("name"===logicFieldArgs.fieldType)fieldValue=getValueFromNameField(logicFieldArgs,depFieldArgs);else if(logicFieldArgs.inputType==="radio"||logicFieldArgs.inputType==="checkbox"||logicFieldArgs.inputType==="toggle")fieldValue=getValueFromRadioOrCheckbox(logicFieldArgs,depFieldArgs);else if(logicFieldArgs.inputType==="date")fieldValue=getValueForDateField(logicFieldArgs,depFieldArgs);else fieldValue=getValueFromTextOrDropdown(logicFieldArgs,depFieldArgs);fieldValue=
|
||
cleanFinalFieldValue(fieldValue);return fieldValue}function getValueForDateField(logicFieldArgs,depFieldArgs){const fieldId=logicFieldArgs.fieldId;const fieldContainer=document.getElementById("frm_field_"+fieldId+"_container");if(fieldContainer&&fieldContainer.querySelector(".frm_date_inline")){const altField=fieldContainer.querySelector("#field_"+logicFieldArgs.fieldKey+"_alt");if(altField)return altField.value}return getValueFromTextOrDropdown(logicFieldArgs,depFieldArgs)}function getValueFromNameField(logicFieldArgs,
|
||
depFieldArgs){var inputName,inputs,nameValues;inputName=buildLogicFieldInputName(logicFieldArgs,depFieldArgs);inputs=document.querySelectorAll('[name^="'+inputName+'"]');nameValues=[];inputs.forEach(function(input){nameValues.push(input.value)});return nameValues.join(" ")}function getValueFromTextOrDropdown(logicFieldArgs,depFieldArgs){var logicFieldValue="";if(logicFieldArgs.isMultiSelect===true)return getValueFromMultiSelectDropdown(logicFieldArgs,depFieldArgs);var fieldCall="field_"+logicFieldArgs.fieldKey;
|
||
if(logicFieldArgs.isRepeating)fieldCall+="-"+depFieldArgs.repeatRow;var logicFieldInput=document.getElementById(fieldCall);if(logicFieldInput===null){logicFieldValue=parseTimeValue(logicFieldArgs,fieldCall);if(logicFieldValue==="")logicFieldValue=getValueFromMultiSelectDropdown(logicFieldArgs,depFieldArgs)}else logicFieldValue=logicFieldInput.value;return logicFieldValue}function parseTimeValue(logicFieldArgs,fieldCall){var logicFieldValue="";if(logicFieldArgs.fieldType==="time"){var hour=document.getElementById(fieldCall+
|
||
"_H");if(hour!==null){var minute=document.getElementById(fieldCall+"_m");logicFieldValue=hour.value+":"+minute.value;var pm=document.getElementById(fieldCall+"_A");if(logicFieldValue==":")logicFieldValue="";else if(pm!==null)logicFieldValue+=" "+pm.value}}return logicFieldValue}function getValueFromMultiSelectDropdown(logicFieldArgs,depFieldArgs){var inputName=buildLogicFieldInputName(logicFieldArgs,depFieldArgs),logicFieldInputs=document.querySelectorAll('[name^="'+inputName+'"]'),selectedVals=[];
|
||
if(logicFieldInputs.length==1&&logicFieldInputs[0].type!=="hidden"){selectedVals=jQuery('[name^="'+inputName+'"]').val();if(selectedVals===null)selectedVals=""}else selectedVals=getValuesFromCheckboxInputs(logicFieldInputs);return selectedVals}function getValueFromRadioOrCheckbox(logicFieldArgs,depFieldArgs){var logicFieldValue,inputName=buildLogicFieldInputName(logicFieldArgs,depFieldArgs),logicFieldInputs=document.querySelectorAll('input[name^="'+inputName+'"]');if(logicFieldInputs.length===0)return null;
|
||
if(logicFieldArgs.inputType==="checkbox"||logicFieldArgs.inputType==="toggle")logicFieldValue=getValuesFromCheckboxInputs(logicFieldInputs);else logicFieldValue=getValueFromRadioInputs(logicFieldInputs);return logicFieldValue}function buildLogicFieldInputName(logicFieldArgs,depFieldArgs){var inputName="";if(logicFieldArgs.isRepeating){var sectionId="";if(depFieldArgs.inEmbedForm!=="0")sectionId=depFieldArgs.inEmbedForm;else sectionId=depFieldArgs.inSection;var rowId=depFieldArgs.repeatRow;inputName=
|
||
"item_meta["+sectionId+"]["+rowId+"]["+logicFieldArgs.fieldId+"]"}else inputName="item_meta["+logicFieldArgs.fieldId+"]";return inputName}function getValuesFromCheckboxInputs(inputs){var checkedVals=[];for(var i=0,l=inputs.length;i<l;i++)if(inputs[i].type==="hidden"||inputs[i].checked)checkedVals.push(inputs[i].value);else if(typeof inputs[i].dataset.off!=="undefined")checkedVals.push(inputs[i].dataset.off);if(checkedVals.length===0)checkedVals=false;return checkedVals}function cleanFinalFieldValue(fieldValue){if(typeof fieldValue===
|
||
"undefined")fieldValue="";else if(typeof fieldValue==="string")fieldValue=fieldValue.trim();return fieldValue}function getLogicConditionOutcome(logicCondition,fieldValue,depFieldArgs,logicFieldArgs){var outcome;if(depFieldArgs.fieldType==="data"&&logicFieldArgs.fieldType==="data")outcome=getDynamicFieldLogicOutcome(logicCondition,fieldValue,depFieldArgs);else{const values=maybePrepareValuesCompared(logicCondition,fieldValue,depFieldArgs.formId);outcome=operators(logicCondition.operator,values.logicValue,
|
||
values.fieldValue)}return outcome}function getDynamicFieldLogicOutcome(logicCondition,fieldValue,depFieldArgs){var outcome=false;if(logicCondition.value==="")if(fieldValue===""||fieldValue.length==1&&fieldValue[0]==="")outcome=false;else outcome=true;else{const values=maybePrepareValuesCompared(logicCondition,fieldValue,depFieldArgs.formId);outcome=operators(logicCondition.operator,values.logicValue,values.fieldValue)}depFieldArgs.dataLogic=logicCondition;depFieldArgs.dataLogic.actualValue=fieldValue;
|
||
return outcome}function maybePrepareValuesCompared(logicCondition,fieldValue,formId){let logicValue=logicCondition.value;if("undefined"===typeof __FRMRULES||"undefined"===typeof __FRMRULES[logicCondition.fieldId])return{logicValue,fieldValue};const logicConditionFieldType=__FRMRULES[logicCondition.fieldId].fieldType;if("total"===logicConditionFieldType){const currency=getCurrency(formId);logicValue=preparePrice(logicCondition.value,currency);fieldValue=preparePrice(fieldValue,currency)}else if("date"===
|
||
logicConditionFieldType){const dateFormat=getDateFormatForField(logicCondition.fieldId);if(false!==dateFormat){logicValue=prepareDate(logicValue,dateFormat);fieldValue=prepareDate(fieldValue,dateFormat)}}return{logicValue,fieldValue}}function prepareDate(date,format){if("Y-m-d"===format)return date;const possibleSeparators=["/",".","-"];let separator=false;possibleSeparators.forEach(sep=>{if(format.includes(sep))separator=sep});if(separator===false)return date;const split=date.split(separator);if(3!==
|
||
split.length)return date;let yearPart,monthPart,dayPart;switch(format){case "Y/m/d":yearPart=split[0];monthPart=split[1];dayPart=split[2];break;case "n/j/Y":case "m/d/Y":monthPart=split[0];dayPart=split[1];yearPart=split[2];break;case "d/m/Y":case "d.m.Y":case "j/m/Y":case "j/n/Y":case "j-m-Y":default:dayPart=split[0];monthPart=split[1];yearPart=split[2];break}if(yearPart.length!==4)return date;if(monthPart.length<2)monthPart="0"+monthPart;if(dayPart.length<2)dayPart="0"+dayPart;return yearPart+"-"+
|
||
monthPart+"-"+dayPart}function getDateFormatForField(fieldId){if(!window.__frmDatepicker)return false;let fieldRule=false;__frmDatepicker.forEach(rule=>{if(!rule.fieldId||rule.fieldId===fieldId)fieldRule=rule});if(false===fieldRule)return false;return fieldRule.options.fpDateFormat}function operators(op,a,b){var theOperators;a=prepareLogicValueForComparison(a);b=prepareEnteredValueForComparison(a,b);if(typeof a==="string"&&a.indexOf(""")!="-1"&&operators(op,a.replace(""",'"'),b))return true;
|
||
theOperators={"==":function(c,d){return c===d},"!=":function(c,d){return c!==d},"<":function(c,d){return c>d},"<=":function(c,d){return c>=d},">":function(c,d){return c<d},">=":function(c,d){return c<=d},"LIKE":function(c,d){if(!d)return false;c=prepareLogicValueForLikeComparison(c);d=prepareEnteredValueForLikeComparison(c,d);return d.indexOf(c)!=-1},"not LIKE":function(c,d){if(!d)return true;c=prepareLogicValueForLikeComparison(c);d=prepareEnteredValueForLikeComparison(c,d);return d.indexOf(c)==
|
||
-1},"LIKE%":function(c,d){if(!d)return false;c=prepareLogicValueForLikeComparison(c);d=prepareEnteredValueForLikeComparison(c,d);if(Array.isArray(d))return false;return d.substr(0,c.length)===c},"%LIKE":function(c,d){if(!d)return false;c=prepareLogicValueForLikeComparison(c);d=prepareEnteredValueForLikeComparison(c,d);if(Array.isArray(d))return false;return d.substr(-c.length)===c}};if("function"!==typeof theOperators[op])op="==";return theOperators[op](a,b)}function prepareLogicValueForComparison(a){if(shouldParseFloat(a))a=
|
||
parseFloat(a);else if(typeof a==="string")a=a.trim();return a}function shouldParseFloat(value){return String(value).search(/^\s*(\+|-)?((\d+(\.\d+)?)|(\.\d+))\s*$/)!==-1}function prepareEnteredValueForComparison(a,b){if(typeof b==="undefined"||b===null||b===false)b="";if(Array.isArray(b)&&jQuery.inArray(String(a),b)>-1)b=a;if(typeof a==="number"&&typeof b==="string"&&shouldParseFloat(b))b=parseFloat(b);if(typeof b==="string")b=b.trim();return b}function prepareLogicValueForLikeComparison(val){return prepareValueForLikeComparison(val)}
|
||
function prepareEnteredValueForLikeComparison(logicValue,enteredValue){enteredValue=prepareValueForLikeComparison(enteredValue);var currentValue="";if(Array.isArray(enteredValue))for(var i=0,l=enteredValue.length;i<l;i++){currentValue=enteredValue[i].toLowerCase();if(currentValue.indexOf(logicValue)>-1){enteredValue=logicValue;break}}return enteredValue}function prepareValueForLikeComparison(val){if(typeof val==="string")val=val.toLowerCase();else if(typeof val==="number")val=val.toString();return val}
|
||
function routeToHideOrShowField(depFieldArgs,logicOutcomes){var onCurrentPage,action=getHideOrShowAction(depFieldArgs,logicOutcomes);if(depFieldArgs.fieldType==="submit")onCurrentPage=isSubmitButtonOnPage(depFieldArgs.containerId);else onCurrentPage=isFieldDivOnPage(depFieldArgs.containerId);if(action==="show")if(depFieldArgs.fieldType==="data"&&depFieldArgs.hasOwnProperty("dataLogic"))updateDynamicField(depFieldArgs,onCurrentPage);else showFieldAndSetValue(depFieldArgs,onCurrentPage);else hideFieldAndClearValue(depFieldArgs,
|
||
onCurrentPage)}function isFieldDivOnPage(containerId){var fieldDiv=document.getElementById(containerId);return fieldDiv!==null}function isSubmitButtonOnPage(container){var submitButton=document.querySelector("#"+container);return submitButton!=null}function getHideOrShowAction(depFieldArgs,logicOutcomes){if(depFieldArgs.anyAll==="any")if(logicOutcomes.indexOf(true)>-1)action=depFieldArgs.showHide;else action=reverseAction(depFieldArgs.showHide);else if(logicOutcomes.indexOf(false)>-1)action=reverseAction(depFieldArgs.showHide);
|
||
else action=depFieldArgs.showHide;return action}function reverseAction(action){if(action==="show")action="hide";else action="show";return action}function showFieldAndSetValue(depFieldArgs,onCurrentPage){if(isFieldCurrentlyShown(depFieldArgs.containerId,depFieldArgs.formId))return;removeFromHideFields(depFieldArgs.containerId,depFieldArgs.formId);if(depFieldArgs.fieldType==="submit"){if(onCurrentPage)showOrEnableSubmitButton(depFieldArgs);return}if(onCurrentPage){setValuesInsideFieldOnPage(depFieldArgs.containerId,
|
||
depFieldArgs);showFieldContainer(depFieldArgs.containerId);triggerEvent(document,"frmShowField");if(depFieldArgs.inputType==="rte")reInitializeRichText("field_"+depFieldArgs.fieldKey)}else setValuesInsideFieldAcrossPage(depFieldArgs)}function reInitializeRichText(fieldId){var isVisible="undefined"!==typeof tinyMCE.editors[fieldId]&&!tinyMCE.editors[fieldId].isHidden();if(!isVisible)return;removeRichText(fieldId);initRichText(fieldId)}function showOrEnableSubmitButton(depFieldArgs){if(depFieldArgs.hideDisable&&
|
||
depFieldArgs.hideDisable==="disable")enableButton("#"+depFieldArgs.containerId);else showFieldContainer(depFieldArgs.containerId);removeSubmitButtonFromHiddenList(depFieldArgs)}function removeSubmitButtonFromHiddenList(depFieldArgs){hiddenSubmitButtons=hiddenSubmitButtons.filter(function(button){return button!==depFieldArgs.formKey})}function enableButton(buttonSelector){var button=document.querySelector(buttonSelector);if(button&&!button.closest(".frm_loading_form"))button.disabled=false}function setValuesInsideFieldOnPage(container,
|
||
depFieldArgs){var inputs=getInputsInFieldOnPage(container),inContainer=depFieldArgs.fieldType==="divider"||depFieldArgs.fieldType==="form";setValueForInputs(inputs,inContainer,depFieldArgs.formId,"required")}function setValuesInsideFieldAcrossPage(depFieldArgs){var inputs=getInputsInFieldAcrossPage(depFieldArgs),inContainer=depFieldArgs.fieldType==="divider"||depFieldArgs.fieldType==="form"||depFieldArgs.isRepeating;setValueForInputs(inputs,inContainer,depFieldArgs.formId)}function getInputsInFieldOnPage(containerId){var container=
|
||
"string"===typeof containerId?document.getElementById(containerId):containerId;return container.querySelectorAll('select[name^="item_meta"], textarea[name^="item_meta"], input[name^="item_meta"]')}function getInputsInFieldAcrossPage(depFieldArgs){var inputs=[];if(depFieldArgs.fieldType==="divider")inputs=getInputsInHiddenSection(depFieldArgs);else if(depFieldArgs.fieldType==="form")inputs=getInputsInHiddenEmbeddedForm(depFieldArgs);else inputs=getHiddenInputs(depFieldArgs);return inputs}function getHiddenInputs(depFieldArgs){var name=
|
||
"";if(depFieldArgs.isRepeating){var containerFieldId=getContainerFieldId(depFieldArgs);name="item_meta["+containerFieldId+"]["+depFieldArgs.repeatRow+"]["+depFieldArgs.fieldId+"]"}else name="item_meta["+depFieldArgs.fieldId+"]";return document.querySelectorAll('[name^="'+name+'"]')}function setValueForInputs(inputs,inContainer,formId,setRequired){var input,prevInput,i;if(!inputs.length)return;for(i=0;i<inputs.length;i++){input=inputs[i];if(inContainer&&isChildInputConditionallyHidden(input,formId))continue;
|
||
if(setRequired==="required")maybeAddRequiredTag(input);if(skipSetValue(i,prevInput,inputs))continue;setDefaultValue(input,inContainer);maybeSetWatchingFieldValue(input);setShownProduct(input);maybeDoCalcForSingleField(input);prevInput=input}}function maybeAddRequiredTag(input){var isRequired,isOptional;if(input.type==="checkbox"||input.type==="radio"||input.type==="file")return;isRequired=input.parentElement.className.indexOf("frm_required_field");isOptional=input.className.indexOf("frm_optional");
|
||
if(isRequired>-1&&isOptional===-1)input.setAttribute("aria-required",true)}function skipSetValue(i,prevInput,inputs){var typeArray=["checkbox","radio"];if(i<1||typeof prevInput==="undefined")return false;if(null!==inputs[i].getAttribute("data-frmprice"))return false;var isOther=inputs[i].className.indexOf("frm_other_input")!==-1;return isOther||prevInput.name==inputs[i].name&&typeArray.indexOf(prevInput.type)>-1}function isChildInputConditionallyHidden(input,formId){var fieldDivPart=frmFrontForm.getFieldId(input,
|
||
true),fieldDivId="frm_field_"+fieldDivPart+"_container";return isFieldConditionallyHidden(fieldDivId,formId)}function showFieldContainer(containerId){var $container=jQuery("#"+containerId).show();if($container.hasClass("frm_inside_container")&&null===$container.find("select").val())$container.find("select").val("").trigger("change")}function hideFieldAndClearValue(depFieldArgs,onCurrentPage){if(isFieldConditionallyHidden(depFieldArgs.containerId,depFieldArgs.formId))return;addToHideFields(depFieldArgs.containerId,
|
||
depFieldArgs.formId);if(depFieldArgs.fieldType==="submit"){if(onCurrentPage)hideOrDisableSubmitButton(depFieldArgs);return}if(onCurrentPage){hideFieldContainer(depFieldArgs.containerId);clearInputsInFieldOnPage(depFieldArgs.containerId)}else clearInputsInFieldAcrossPage(depFieldArgs)}function hideOrDisableSubmitButton(depFieldArgs){if(depFieldArgs.containerId==undefined)depFieldArgs.containerId=getSubmitButtonContainerID(depFieldArgs);addSubmitButtonToHiddenList(depFieldArgs);if(depFieldArgs.hideDisable&&
|
||
depFieldArgs.hideDisable==="disable")disableButton("#"+depFieldArgs.containerId);else hideFieldContainer(depFieldArgs.containerId)}function addSubmitButtonToHiddenList(depFieldArgs){hiddenSubmitButtons.push(depFieldArgs.formKey)}function isOnPageSubmitButtonHidden(formKey){return hiddenSubmitButtons.indexOf(formKey)!==-1}function hidePreviouslyHiddenSubmitButton(submitContainerID){var formId=submitContainerID.replace("frm_form_","");formId=formId.replace("_container .frm_final_submit","");var depFieldArgs=
|
||
getRulesForSingleField("submit_"+formId);if(depFieldArgs)hideOrDisableSubmitButton(depFieldArgs)}function getFormKeyFromFormElementID(elementId){return elementId.replace("form_","")}function hideFieldContainer(containerId){jQuery("#"+containerId).hide()}function disableButton(buttonSelector){jQuery(buttonSelector).prop("disabled",true)}function jsonParse(str){try{var obj=JSON.parse(str);return obj}catch(e){return false}}function clearInputsInFieldOnPage(containerId){var inputs=getInputsInFieldOnPage(containerId);
|
||
clearValueForInputs(inputs,"required")}function clearInputsInFieldAcrossPage(depFieldArgs){var inputs=getInputsInFieldAcrossPage(depFieldArgs);clearValueForInputs(inputs)}function getInputsInHiddenSection(depFieldArgs){var inputs=[];if(depFieldArgs.fieldType==="divider")inputs=document.querySelectorAll('[data-sectionid="'+depFieldArgs.fieldId+'"]');return inputs}function getInputsInHiddenEmbeddedForm(depFieldArgs){return document.querySelectorAll('[id^="field_'+depFieldArgs.fieldKey+'-"]')}function changeSelectColor(select){if(select.options[select.selectedIndex]?.classList.contains("frm-select-placeholder")){const styleElement=
|
||
select.closest(".with_frm_style");const textColorDisabled=styleElement?getComputedStyle(styleElement).getPropertyValue("--text-color-disabled").trim():"";select.style.setProperty("color",textColorDisabled,"important")}}function clearValueForInputs(inputs,required,resetToDefault){var prevInput,blankSelect,valueChanged,l,i,input,defaultVal,reset,linkedRadioInput;if(inputs.length<1)return;valueChanged=true;l=inputs.length;for(i=0;i<l;i++){input=inputs[i];defaultVal=input.getAttribute("data-frmval");
|
||
reset=resetToDefault&&defaultVal;if(input.className.indexOf("frm_dnc")>-1||input.name.indexOf("[row_ids]")>-1){prevInput=input;continue}if(i>0&&prevInput.name!=input.name&&valueChanged===true)triggerChange(jQuery(prevInput));valueChanged=true;if(input.type==="radio"||input.type==="checkbox"){if(!reset)input.checked=false;else if("radio"===input.type)input.checked=defaultVal===input.value;else resetCheckboxInputToValue(input,defaultVal);maybeClearStarRatingInput(input)}else if(input.tagName==="SELECT")if(isSlimSelect(input))setSlimValue(input,
|
||
reset?defaultVal:"");else{if(!reset&&resetToDefault&&input.getAttribute("data-placeholder")){reset=true;defaultVal=""}if(!reset){blankSelect=input.selectedIndex===0&&input.options[0].text.trim()==="";if(blankSelect||input.selectedIndex===-1)valueChanged=false;else input.selectedIndex=-1}else valueChanged=resetSelectInputToValue(input,defaultVal);const chosenId=input.id.replace(/[^\w]/g,"_");const autocomplete=document.getElementById(chosenId+"_chosen");if(autocomplete!==null)jQuery(input).trigger("chosen:updated")}else if(input.type===
|
||
"range"){let sliderDefault=defaultVal;if(!reset){const min=parseFloat(input.getAttribute("min"));const max=parseFloat(input.getAttribute("max"));const mid=(max-min)/2+min;const step=parseFloat(input.getAttribute("step"),10);const midSteps=Math.round(mid/step);sliderDefault=midSteps*step;input.parentElement.querySelector(".frm_range_value").textContent=sliderDefault}input.value=sliderDefault;initRangeInput([input])}else if(input.getAttribute("data-frmprice")!==null)setHiddenProduct(input);else{if(!reset)input.value=
|
||
"";else input.value=defaultVal;linkedRadioInput=input.id.indexOf("-otext")>-1?document.getElementById(input.id.replace("-otext","")):null;if(linkedRadioInput&&linkedRadioInput.checked===false)input.classList.add("frm_pos_none");if(null!==input.getAttribute("data-frmfile"))clearDropzoneFiles(input);if(input.type==="hidden"&&input.closest(".frm_range_container "))resetRangeInput(input)}if(required==="required"){input.required=false;input.setAttribute("aria-required",false)}prevInput=inputs[i]}if(valueChanged===
|
||
true)triggerChange(jQuery(prevInput))}function resetRangeInput(input){const rangeContainer=input.parentElement;const rangeSliderWrapperClone=rangeContainer.querySelector(".frm-slider-wrapper").cloneNode(true);rangeContainer.querySelector("div:last-of-type").replaceChild(rangeSliderWrapperClone,rangeContainer.querySelector(".frm-slider-wrapper"));initializeRangeSlider(input,rangeContainer)}function setSlimValue(input,value){if(value.length&&"["===value[0]&&-1!==value.indexOf(",")&&"]"===value[value.length-
|
||
1]&&"multiple"===input.getAttribute("multiple"))value=JSON.parse(value);input.slim.setSelected(value)}function maybeClearStarRatingInput(input){var starGroup,checkedInput;if("radio"!==input.type||!input.matches(".frm-star-group input:last-of-type"))return;starGroup=input.closest(".frm-star-group");checkedInput=starGroup.querySelector("input:checked");if(checkedInput)updateStars(checkedInput);else clearStars(starGroup,true)}function resetCheckboxInputToValue(input,val){var i;val=jsonParse(val);if(!val)return;
|
||
for(i in val)if(val[i]===input.value){input.checked=true;return}input.checked=false}function resetSelectInputToValue(input,val){if(input.multiple)return resetMultiSelectInputToValue(input,val);var i,valueChanged=false,options=input.querySelectorAll("option");for(i=0;i<options.length;i++){if(val===options[i].value&&!options[i].selected){options[i].selected=true;valueChanged=true;continue}if(val!==options[i].value&&options[i].selected){options[i].selected=false;valueChanged=true}}return valueChanged}
|
||
function resetMultiSelectInputToValue(input,val){val=jsonParse(val);if(!val)return false;var i,contained,valueChanged=false,options=input.querySelectorAll("option");for(i=0;i<options.length;i++){contained=objectContainValue(val,options[i].value);if(contained&&!options[i].selected){options[i].selected=true;valueChanged=true;continue}if(!contained&&options[i].selected){options[i].selected=false;valueChanged=true}}return valueChanged}function objectContainValue(obj,val){var x;for(x in obj)if(obj[x]===
|
||
val)return true;return false}function clearDropzoneFiles(hiddenFileIdField){var dropzoneElement=hiddenFileIdField.nextElementSibling;if(dropzoneElement&&-1!==dropzoneElement.className.indexOf("frm_dropzone")&&"object"===typeof dropzoneElement.dropzone&&"function"===typeof dropzoneElement.dropzone.removeAllFiles)dropzoneElement.dropzone.removeAllFiles(true)}function isFieldCurrentlyShown(containerId,formId){return isFieldConditionallyHidden(containerId,formId)===false}function isFieldConditionallyHidden(containerId,
|
||
formId){var hidden=false,hiddenFields=getHiddenFields(formId);if(hiddenFields.indexOf(containerId)>-1)hidden=true;return hidden}function clearHideFields(){var hideFieldInputs=document.querySelectorAll('[id^="frm_hide_fields_"]');clearValueForInputs(hideFieldInputs)}function addToHideFields(htmlFieldId,formId){var hiddenFields=getHiddenFields(formId);if(hiddenFields.indexOf(htmlFieldId)>-1);else{hiddenFields.push(htmlFieldId);hiddenFields=JSON.stringify(hiddenFields);var frmHideFieldsInput=document.getElementById("frm_hide_fields_"+
|
||
formId);if(frmHideFieldsInput!==null)frmHideFieldsInput.value=hiddenFields}}function getAllHiddenFields(){var formId,i,hiddenFields=[],hideFieldInputs=document.querySelectorAll('*[id^="frm_hide_fields_"]'),formTotal=hideFieldInputs.length;for(i=0;i<formTotal;i++){formId=hideFieldInputs[i].id.replace("frm_hide_fields_","");hiddenFields=hiddenFields.concat(getHiddenFields(formId))}return hiddenFields}function getHiddenFields(formId){var hiddenFields=[];var frmHideFieldsInput=document.getElementById("frm_hide_fields_"+
|
||
formId);if(frmHideFieldsInput===null)return hiddenFields;hiddenFields=frmHideFieldsInput.value;if(hiddenFields)hiddenFields=JSON.parse(hiddenFields);else hiddenFields=[];return hiddenFields}function setDefaultValue(input,inContainer){var placeholder,isMultipleSelect,$input=jQuery(input),defaultValue=$input.data("frmval");if(typeof defaultValue==="undefined"&&input.classList.contains("wp-editor-area")){var defaultField=document.getElementById(input.id+"-frmval");if(defaultField!==null){defaultValue=
|
||
defaultField.value;var targetTinyMceEditor=tinymce.get(input.id);if(null!==targetTinyMceEditor)targetTinyMceEditor.setContent(defaultValue)}}else if(typeof defaultValue==="undefined"&&input.type==="hidden"){var $select=$input.next("select[disabled]");if($select.length>0)defaultValue=$select.data("frmval")}placeholder=defaultValue;defaultValue=setDropdownPlaceholder(defaultValue,input);if(placeholder!==defaultValue)placeholder=true;if(typeof defaultValue!=="undefined"){var numericKey=new RegExp(/\[\d*\]$/i);
|
||
if(input.type==="checkbox"||input.type==="radio")setCheckboxOrRadioDefaultValue(input.name,defaultValue);else if(input.type==="hidden"&&input.name.indexOf("[]")>-1)setHiddenCheckboxDefaultValue(input.name,defaultValue);else if(!inContainer&&input.type==="hidden"&&input.name.indexOf("][")>-1&&numericKey.test(input.name))setHiddenCheckboxDefaultValue(input.name.replace(numericKey,""),defaultValue);else{isMultipleSelect=false;if(placeholder&&"boolean"!==typeof placeholder&&input.tagName==="SELECT"&&
|
||
-1!==input.className.indexOf("frm_chzn"))placeholder=false;if("SELECT"===input.tagName&&"multiple"===input.getAttribute("multiple"))isMultipleSelect=true;if(defaultValue.constructor===Object)if(!isMultipleSelect){var addressType=input.getAttribute("name").split("[").slice(-1)[0];if(addressType!==null){addressType=addressType.replace("]","");defaultValue=defaultValue[addressType];if(typeof defaultValue==="undefined")defaultValue=""}}if(isMultipleSelect)selectMultiselectOptions(input,defaultValue);
|
||
else{if(typeof defaultValue==="object")defaultValue="["+defaultValue+"]";if(isSlimSelect(input)){if(""===defaultValue)maybeRemoveHiddenPlaceholder(input);input.slim.setSelected(defaultValue)}else if(input.classList.contains("frm_chzn")){if(""===defaultValue)maybeRemoveHiddenPlaceholder(input);jQuery(input).val(defaultValue).trigger("chosen:updated")}else{input.value=defaultValue;if("hidden"===input.type&&input.dataset.isRangeSliderInitialized)input.dispatchEvent(new Event("change"));if("range"===
|
||
input.type)input.dispatchEvent(new Event("input"))}}if("SELECT"===input.tagName)changeSelectColor(input)}if(!placeholder&&input.tagName==="SELECT"){maybeUpdateChosenOptions(input);if(input.value==="")setOtherSelectValue(input,defaultValue)}triggerChange($input)}else if("SELECT"===input.tagName)maybeRemoveHiddenPlaceholder(input)}function maybeRemoveHiddenPlaceholder(input){const hiddenPlaceholder=input.querySelector('option[value=""].frm_hidden.frm_hidden_placeholder');if(!hiddenPlaceholder)return false;
|
||
hiddenPlaceholder.remove();return true}function isSlimSelect(input){return input.classList.contains("frm_slimselect")&&"object"===typeof input.slim}function selectMultiselectOptions(select,values){if(isSlimSelect(select)&&"function"===typeof Object.values){select.slim.setSelected(Object.values(values));return}var valueKey,option;for(valueKey in values){option=select.querySelector('option[value="'+values[valueKey]+'"]');if(option)option.selected=true}}function setDropdownPlaceholder(defaultValue,input){var placeholder;
|
||
if(typeof defaultValue==="undefined"&&input.tagName==="SELECT"){placeholder=input.getAttribute("data-placeholder");if(placeholder!==null)defaultValue=""}return defaultValue}function setCheckboxOrRadioDefaultValue(inputName,defaultValue){var radioInputs=document.getElementsByName(inputName),isSet=false,firstInput=false;if(typeof defaultValue==="object")defaultValue=Object.keys(defaultValue).map(function(key){return defaultValue[key]});let hiddenFieldIndex=0;for(var i=0,l=radioInputs.length;i<l;i++){if(firstInput===
|
||
false)firstInput=radioInputs[i];if(radioInputs[i].type==="hidden"){if(Array.isArray(defaultValue)&&defaultValue[hiddenFieldIndex]!==null&&"undefined"!==typeof defaultValue[hiddenFieldIndex])radioInputs[i].value=defaultValue[hiddenFieldIndex];else radioInputs[i].value=defaultValue;hiddenFieldIndex++;isSet=true}else if(radioInputs[i].value==defaultValue||Array.isArray(defaultValue)&&defaultValue.indexOf(radioInputs[i].value)>-1){radioInputs[i].checked=true;isSet=true;if(radioInputs[i].type==="radio")break}}if(!isSet&&
|
||
firstInput!==false)setOtherValueLimited(firstInput,defaultValue)}function setHiddenCheckboxDefaultValue(inputName,defaultValue){var hiddenInputs=jQuery('input[name^="'+inputName+'"]').get();if(typeof defaultValue==="object")defaultValue=Object.keys(defaultValue).map(function(key){return defaultValue[key]});if(Array.isArray(defaultValue))for(var i=0,l=defaultValue.length;i<l;i++)if(i in hiddenInputs)hiddenInputs[i].value=defaultValue[i];else;else if(hiddenInputs[0]!==null&&typeof hiddenInputs[0]!==
|
||
"undefined")hiddenInputs[0].value=defaultValue}function removeFromHideFields(htmlFieldId,formId){var hiddenFields=getHiddenFields(formId);var itemIndex=hiddenFields.indexOf(htmlFieldId);if(itemIndex>-1){hiddenFields.splice(itemIndex,1);hiddenFields=JSON.stringify(hiddenFields);var frmHideFieldsInput=document.getElementById("frm_hide_fields_"+formId);frmHideFieldsInput.value=hiddenFields}}function checkFieldsWatchingLookup(fieldId,changedInput,originalEvent){if(typeof __FRMLOOKUP==="undefined"||typeof __FRMLOOKUP[fieldId]===
|
||
"undefined"||__FRMLOOKUP[fieldId].dependents.length<1||changedInput===null||typeof changedInput==="undefined")return;var triggerFieldArgs=__FRMLOOKUP[fieldId];var parentRepeatArgs=getRepeatArgsFromFieldName(changedInput[0].name);for(var i=0,l=triggerFieldArgs.dependents.length;i<l;i++)updateWatchingFieldById(triggerFieldArgs.dependents[i],parentRepeatArgs,originalEvent)}function updateWatchingFieldById(fieldId,parentRepeatArgs,originalEvent){var childFieldArgs=getLookupArgsForSingleField(fieldId);
|
||
if(childFieldArgs===false||childFieldArgs.parents.length<1)return;if(childFieldArgs.fieldType==="lookup")updateLookupFieldOptions(childFieldArgs,parentRepeatArgs);else if(originalEvent==="value changed")updateWatchingFieldValue(childFieldArgs,parentRepeatArgs)}function updateLookupFieldOptions(childFieldArgs,parentRepeatArgs){var childFieldElements=[];if(parentRepeatArgs.repeatRow!=="")childFieldElements=getRepeatingFieldDivOnCurrentPage(childFieldArgs,parentRepeatArgs);else childFieldElements=getAllFieldDivsOnCurrentPage(childFieldArgs);
|
||
for(var i=0,l=childFieldElements.length;i<l;i++){addRepeatRow(childFieldArgs,childFieldElements[i].id);updateSingleLookupField(childFieldArgs,childFieldElements[i])}processPendingLookups()}function processPendingLookups(){const unprocessedPendingLookups=getUnprocessedPendingLookups();if(!unprocessedPendingLookups.length)return;const formId=unprocessedPendingLookups[0].childFieldArgs.formId;const allFormIds=[];const batchSize=20;const batches=Math.ceil(unprocessedPendingLookups.length/batchSize);for(let batchNumber=
|
||
0;batchNumber<batches;++batchNumber){const start=batchNumber*batchSize;const end=start+batchSize;const currentBatch=unprocessedPendingLookups.slice(start,end);currentBatch.forEach(function(pendingLookup){pendingLookup.pending=false;allFormIds.push(pendingLookup.childFieldArgs.formId)});postToAjaxUrl(getFormById(formId),{action:"frm_replace_lookup_field_options_arr",postData:currentBatch.map(pendingLookup=>pendingLookup.childFieldArgs),nonce:frm_js.nonce},function(newOptionsByFieldId){allFormIds.forEach(enableFormAfterLookup);
|
||
Object.entries(newOptionsByFieldId).forEach(entry=>{const key=entry[0];const newOptions=entry[1];const optionLabels="undefined"!==typeof newOptionsByFieldId[key+"_label"]?newOptionsByFieldId[key+"_label"]:[];currentBatch.forEach(function(pendingLookup){if(!isNaN(key)&&pendingLookup.childFieldArgs.unique===parseInt(key))pendingLookup.callback(newOptions,optionLabels)})})},false,{dataType:"json"})}}function getUnprocessedPendingLookups(){return pendingLookupFieldAjax.filter(pendingLookup=>pendingLookup.pending)}
|
||
function getRepeatingFieldDivOnCurrentPage(childFieldArgs,parentRepeatArgs){var childFieldDivs=[],selector="frm_field_"+childFieldArgs.fieldId+"-";selector+=parentRepeatArgs.repeatingSection+"-"+parentRepeatArgs.repeatRow+"_container";var container=document.getElementById(selector);if(container!==null)childFieldDivs.push(container);return childFieldDivs}function updateWatchingFieldValue(childFieldArgs,parentRepeatArgs){var childFieldElements=getAllTextFieldInputs(childFieldArgs,parentRepeatArgs);
|
||
for(var i=0,l=childFieldElements.length;i<l;i++){addRepeatRowForInput(childFieldElements[i].name,childFieldArgs);updateSingleWatchingField(childFieldArgs,childFieldElements[i])}}function getLookupArgsForSingleField(fieldId){if(typeof __FRMLOOKUP==="undefined"||typeof __FRMLOOKUP[fieldId]==="undefined")return false;return __FRMLOOKUP[fieldId]}function updateSingleLookupField(childFieldArgs,childElement){childFieldArgs.parentVals=getParentLookupFieldVals(childFieldArgs);if(childFieldArgs.inputType===
|
||
"select")maybeReplaceSelectLookupFieldOptions(childFieldArgs,childElement);else if(childFieldArgs.inputType==="radio"||childFieldArgs.inputType==="checkbox")maybeReplaceCbRadioLookupOptions(childFieldArgs,childElement);else if(childFieldArgs.inputType==="data")maybeReplaceLookupList(childFieldArgs,childElement)}function updateSingleWatchingField(childFieldArgs,childElement){childFieldArgs.parentVals=getParentLookupFieldVals(childFieldArgs);if(currentLookupHasQueue(childElement.id)){addLookupToQueueOfTwo(childFieldArgs,
|
||
childElement);return}addLookupToQueueOfTwo(childFieldArgs,childElement);maybeInsertValueInFieldWatchingLookup(childFieldArgs,childElement)}function getAllTextFieldInputs(childFieldArgs,parentRepeatArgs){var selector="field_"+childFieldArgs.fieldKey;if(childFieldArgs.isRepeating)if(parentRepeatArgs.repeatingSection!=="")selector='[id="'+selector+"-"+parentRepeatArgs.repeatRow+'"]';else selector='[id^="'+selector+'-"]';else selector='[id="'+selector+'"]';return document.querySelectorAll(selector)}function maybeSetWatchingFieldValue(input){var fieldId=
|
||
frmFrontForm.getFieldId(input,false),childFieldArgs=getLookupArgsForSingleField(fieldId);if(childFieldArgs===false||childFieldArgs.fieldType==="lookup")return;updateSingleWatchingField(childFieldArgs,input)}function getAllFieldDivsOnCurrentPage(childFieldArgs){var childFieldDivs=[];if(childFieldArgs.isRepeating)childFieldDivs=document.querySelectorAll(".frm_field_"+childFieldArgs.fieldId+"_container");else{var container=document.getElementById("frm_field_"+childFieldArgs.fieldId+"_container");if(container!==
|
||
null)childFieldDivs.push(container)}return childFieldDivs}function getParentLookupFieldVals(childFieldArgs){var parentFieldArgs,parentVals=[],parentIds=childFieldArgs.parents,parentValue=false;for(var i=0,l=parentIds.length;i<l;i++){parentFieldArgs=getLookupArgsForSingleField(parentIds[i]);parentValue=getFieldValue(parentFieldArgs,childFieldArgs);if(parentValue===""||parentValue===false){parentVals=false;break}parentVals[i]=parentValue}return parentVals}function getValueFromRadioInputs(radioInputs){var radioValue=
|
||
false,l=radioInputs.length;for(var i=0;i<l;i++)if(radioInputs[i].type==="hidden"||radioInputs[i].checked){radioValue=radioInputs[i].value;break}return radioValue}function maybeReplaceSelectLookupFieldOptions(childFieldArgs,childDiv){var childSelect=childDiv.getElementsByTagName("SELECT")[0];if(childSelect===null)return;var currentValue=childSelect.value;if(childFieldArgs.parentVals===false){childSelect.options.length=1;childSelect.value="";maybeUpdateChosenOptions(childSelect);if(currentValue!=="")triggerChange(jQuery(childSelect),
|
||
childFieldArgs.fieldKey)}else{disableLookup(childSelect);disableFormPreLookup(childFieldArgs.formId);getLookupValues(childFieldArgs,function(newOptions,optionLabels){replaceSelectLookupFieldOptions(childFieldArgs,childSelect,newOptions,optionLabels);triggerLookupOptionsLoaded(jQuery(childDiv));enableFormAfterLookup(childFieldArgs.formId)})}}function maybeUpdateChosenOptions(childSelect){if(childSelect.className.indexOf("frm_chzn")>-1&&jQuery().chosen)jQuery(childSelect).trigger("chosen:updated")}
|
||
function disableLookup(childSelect){childSelect.className=childSelect.className+" frm_loading_lookup";childSelect.disabled=true;maybeUpdateChosenOptions(childSelect)}function disableFormPreLookup(formId){processesRunning++;if(processesRunning===1){var form=getFormById(formId);if(form!==null)frmFrontForm.showSubmitLoading(jQuery(form))}}function enableFormAfterLookup(formId){var form;processesRunning--;if(processesRunning<=0){form=getFormById(formId);if(form!==null)removeSubmitLoading(form,formId,
|
||
processesRunning)}}function getFormById(formId){var form=document.querySelector("#frm_form_"+formId+"_container form");if(form===null){form=document.getElementById("frm_form_"+formId+"_container");if(form!==null)form=form.closest("form")}return form}function enableLookup(childSelect,isReadOnly){if(isReadOnly===false)childSelect.disabled=false;childSelect.className=childSelect.className.replace(" frm_loading_lookup","")}function isMultiSelect(element){return element.tagName.toLowerCase()==="select"&&
|
||
element.multiple}function getSelectedOptions(element){if(isSlimSelect(element))return element.slim.getSelected();if(!isMultiSelect(element))return element.value;var i,option,selectedOptions=[];for(i=0;i<element.options.length;i++){option=element.options[i];if(option.selected)selectedOptions.push(option.value)}return selectedOptions}function setSelectedOptions(element,values){var option;if(!isMultiSelect(element)){element.value=values;return}Array.from(element.options).forEach(function(option){option.selected=
|
||
false});values.forEach(function(value){option=element.querySelector('option[value="'+value+'"]');if(option)option.selected=true})}function replaceSelectLookupFieldOptions(fieldArgs,childSelect,newOptions,optionLabels){var origVal,i,optsLength,newOption,optionData;origVal=getSelectedOptions(childSelect);for(i=childSelect.options.length;i>0;i--)childSelect.remove(i);optsLength=newOptions.length;optionData=[];if(childSelect.options.length>0&&""===childSelect.options[0].value)optionData.push({text:childSelect.options[0].textContent,
|
||
value:childSelect.options[0].value,placeholder:true});for(i=0;i<optsLength;i++){const optionLabel=optionLabels[i]||newOptions[i];newOption=new Option(optionLabel,newOptions[i],false,false);childSelect.options[i+1]=newOption;optionData.push(newOption)}if(childSelect.slim)childSelect.slim.setData(optionData);setSelectLookupVal(childSelect,origVal);enableLookup(childSelect,fieldArgs.isReadOnly);maybeUpdateChosenOptions(childSelect);if(getSelectedOptions(childSelect).toString()!==origVal.toString())triggerChange(jQuery(childSelect),
|
||
fieldArgs.fieldKey)}function setSelectLookupVal(childSelect,origVal){if(isSlimSelect(childSelect)){if(!valueIsSingleItemArrayWithEmptyString(origVal))setSlimValue(childSelect,origVal);return}setSelectedOptions(childSelect,origVal);if(childSelect.value===""){var defaultValue=childSelect.getAttribute("data-frmval");if(defaultValue!==null)childSelect.value=defaultValue}if(childSelect.value==="")childSelect.value=""}function valueIsSingleItemArrayWithEmptyString(value){return Array.isArray(value)&&1===
|
||
value.length&&""===value[0]}function maybeReplaceCbRadioLookupOptions(childFieldArgs,childDiv){if(childFieldArgs.parentVals===false){var inputs=childDiv.getElementsByTagName("input");maybeHideRadioLookup(childFieldArgs,childDiv);clearValueForInputs(inputs)}else replaceCbRadioLookupOptions(childFieldArgs,childDiv)}function replaceCbRadioLookupOptions(childFieldArgs,childDiv){var optContainer,inputs,currentValue,defaultValue,form,data,success;optContainer=childDiv.getElementsByClassName("frm_opt_container")[0];
|
||
inputs=optContainer.getElementsByTagName("input");currentValue="";addLoadingIconJS(childDiv,optContainer);if(childFieldArgs.inputType=="radio")currentValue=getValueFromRadioInputs(inputs);else currentValue=getValuesFromCheckboxInputs(inputs);defaultValue=jQuery(inputs[0]).data("frmval");disableFormPreLookup(childFieldArgs.formId);form=getFormById(childFieldArgs.formId);data={action:"frm_replace_cb_radio_lookup_options",parent_fields:childFieldArgs.parents,parent_vals:childFieldArgs.parentVals,field_id:childFieldArgs.fieldId,
|
||
container_field_id:getContainerFieldId(childFieldArgs),row_index:childFieldArgs.repeatRow,current_value:currentValue,default_value:defaultValue,nonce:frm_js.nonce};success=function(newHtml){var input;optContainer.innerHTML=newHtml;removeLoadingIconJS(childDiv,optContainer);if(inputs.length==1&&inputs[0].value==="")maybeHideRadioLookup(childFieldArgs,childDiv);else{maybeShowRadioLookup(childFieldArgs,childDiv);maybeSetDefaultCbRadioValue(childFieldArgs,inputs,defaultValue)}input=inputs[0];triggerChange(jQuery(input),
|
||
childFieldArgs.fieldKey);triggerLookupOptionsLoaded(jQuery(childDiv));enableFormAfterLookup(childFieldArgs.formId)};postToAjaxUrl(form,data,success)}function maybeReplaceLookupList(childFieldArgs,childDiv){var inputs=childDiv.getElementsByTagName("input"),content=inputs[0].previousElementSibling;if(childFieldArgs.parentVals===false){maybeHideRadioLookup(childFieldArgs,childDiv);if(typeof content!=="undefined")content.innerHTML=""}else getLookupValues(childFieldArgs,function(response,optionLabels){content.innerHTML=
|
||
optionLabels.length?optionLabels.join(", "):response.join(", ");inputs[0].value=response;maybeShowRadioLookup(childFieldArgs,childDiv);triggerLookupOptionsLoaded(jQuery(childDiv))})}function getLookupValues(childFieldArgs,callback){disableFormPreLookup(childFieldArgs.formId);const pendingLookupArgs={formId:childFieldArgs.formId,fieldId:childFieldArgs.fieldId,parents:childFieldArgs.parents,parentVals:childFieldArgs.parentVals,unique:getAutoId()};pendingLookupFieldAjax.push({childFieldArgs:pendingLookupArgs,
|
||
callback,pending:true})}function getAutoId(){return autoId++}function triggerLookupOptionsLoaded($fieldDiv){$fieldDiv.trigger("frmLookupOptionsLoaded")}function maybeSetDefaultCbRadioValue(childFieldArgs,inputs,defaultValue){if(defaultValue===undefined)return;var currentValue=false;if(childFieldArgs.inputType==="radio")currentValue=getValueFromRadioInputs(inputs);else currentValue=getValuesFromCheckboxInputs(inputs);if(currentValue!==false||inputs.length<1)return;var inputName=inputs[0].name;setCheckboxOrRadioDefaultValue(inputName,
|
||
defaultValue)}function maybeHideRadioLookup(childFieldArgs,childDiv){if(isFieldConditionallyHidden(childDiv.id,childFieldArgs.formId))return;hideFieldContainer(childDiv.id);addToHideFields(childDiv.id,childFieldArgs.formId)}function maybeShowRadioLookup(childFieldArgs,childDiv){if(isFieldCurrentlyShown(childDiv.id,childFieldArgs.formId))return;var logicArgs=getRulesForSingleField(childFieldArgs.fieldId);if(logicArgs===false||logicArgs.conditions.length<1){removeFromHideFields(childDiv.id,childFieldArgs.formId);
|
||
showFieldContainer(childDiv.id)}else{logicArgs.containerId=childDiv.id;logicArgs.repeatRow=childFieldArgs.repeatRow;hideOrShowSingleField(logicArgs)}}function maybeInsertValueInFieldWatchingLookup(childFieldArgs,childInput){if(isChildInputConditionallyHidden(childInput,childFieldArgs.formId)){checkQueueAfterLookupCompleted(childInput.id);return}if(childFieldArgs.parentVals===false){var newValue=childInput.getAttribute("data-frmval");if(newValue===null)newValue="";insertValueInFieldWatchingLookup(childFieldArgs,
|
||
childInput,newValue);checkQueueAfterLookupCompleted(childInput.id)}else{disableFormPreLookup(childFieldArgs.formId);postToAjaxUrl(getFormById(childFieldArgs.formId),{action:"frm_get_lookup_text_value",parent_fields:childFieldArgs.parents,parent_vals:childFieldArgs.parentVals,field_id:childFieldArgs.fieldId,nonce:frm_js.nonce},function(newValue){if(!isChildInputConditionallyHidden(childInput,childFieldArgs.formId)&&childInput.value!=newValue)insertValueInFieldWatchingLookup(childFieldArgs.fieldKey,
|
||
childInput,newValue);enableFormAfterLookup(childFieldArgs.formId);checkQueueAfterLookupCompleted(childInput.id)})}}function currentLookupHasQueue(elementId){return elementId in lookupQueues&&lookupQueues[elementId].length>0}function addLookupToQueueOfTwo(childFieldArgs,childInput){var elementId=childInput.id;if(elementId in lookupQueues){if(lookupQueues[elementId].length>=2)lookupQueues[elementId]=lookupQueues[elementId].slice(0,1)}else lookupQueues[elementId]=[];lookupQueues[elementId].push({childFieldArgs:childFieldArgs,
|
||
childInput:childInput})}function checkQueueAfterLookupCompleted(elementId){removeLookupFromQueue(elementId);doNextItemInLookupQueue(elementId)}function removeLookupFromQueue(elementId){lookupQueues[elementId].shift()}function doNextItemInLookupQueue(elementId){if(!currentLookupHasQueue(elementId))return;const childFieldArgs=lookupQueues[elementId][0].childFieldArgs;const childInput=lookupQueues[elementId][0].childInput;updateParentValsForLookup(childInput.name,childFieldArgs);maybeInsertValueInFieldWatchingLookup(childFieldArgs,
|
||
childInput)}function updateParentValsForLookup(childInputName,childFieldArgs){if(!childInputName)return;childFieldArgs.repeatRow=getRepeatArgsFromFieldName(childInputName).repeatRow;childFieldArgs.parentVals=getParentLookupFieldVals(childFieldArgs)}function decodeEntities(string){var decoded=string.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'");return decoded}function insertValueInFieldWatchingLookup(fieldKey,childInput,newValue){childInput.value=
|
||
decodeEntities(newValue);triggerChange(jQuery(childInput),fieldKey)}function addRepeatRowForInput(fieldName,childFieldArgs){var repeatArgs=getRepeatArgsFromFieldName(fieldName);if(repeatArgs.repeatRow!=="")childFieldArgs.repeatRow=repeatArgs.repeatRow;else childFieldArgs.repeatRow=""}function updateDynamicField(depFieldArgs,onCurrentPage){var depFieldArgsCopy=cloneObjectForDynamicFields(depFieldArgs);if(depFieldArgsCopy.inputType==="data")updateDynamicListData(depFieldArgsCopy,onCurrentPage);else if(onCurrentPage)updateDynamicFieldOptions(depFieldArgsCopy)}
|
||
function cloneObjectForDynamicFields(depFieldArgs){var dataLogic={actualValue:depFieldArgs.dataLogic.actualValue,fieldId:depFieldArgs.dataLogic.fieldId};var dynamicFieldArgs={fieldId:depFieldArgs.fieldId,fieldKey:depFieldArgs.fieldKey,formId:depFieldArgs.formId,containerId:depFieldArgs.containerId,repeatRow:depFieldArgs.repeatRow,dataLogic:dataLogic,children:"",inputType:depFieldArgs.inputType};return dynamicFieldArgs}pendingDynamicFieldAjax=[];function updateDynamicListData(depFieldArgs,onCurrentPage){var $fieldDiv;
|
||
if(onCurrentPage){$fieldDiv=jQuery("#"+depFieldArgs.containerId);addLoadingIcon($fieldDiv)}pendingDynamicFieldAjax.push({args:{depFieldArgs:depFieldArgs,onCurrentPage:onCurrentPage},data:{entry_id:depFieldArgs.dataLogic.actualValue,current_field:depFieldArgs.fieldId,hide_id:depFieldArgs.containerId,on_current_page:onCurrentPage,nonce:frm_js.nonce}})}function updateDynamicFieldOptions(depFieldArgs){var $fieldDiv=jQuery("#"+depFieldArgs.containerId),$fieldInputs=$fieldDiv.find('select[name^="item_meta"], input[name^="item_meta"]'),
|
||
prevValue=getFieldValueFromInputs($fieldInputs),defaultVal=$fieldInputs.data("frmval"),editingEntry=$fieldDiv.closest("form").find('input[name="id"]').val();addLoadingIcon($fieldDiv);postToAjaxUrl(getFormById(depFieldArgs.formId),{action:"frm_fields_ajax_data_options",trigger_field_id:depFieldArgs.dataLogic.fieldId,entry_id:depFieldArgs.dataLogic.actualValue,field_id:depFieldArgs.fieldId,default_value:defaultVal,container_id:depFieldArgs.containerId,editing_entry:editingEntry,prev_val:prevValue,nonce:frm_js.nonce},
|
||
function(html){var $optContainer=$fieldDiv.find(".frm_opt_container, .frm_data_container");$optContainer.html(html);var $dynamicFieldInputs=$optContainer.find('select, input[type="checkbox"], input[type="radio"]');removeLoadingIcon($optContainer);if(html===""||$dynamicFieldInputs.length<1)hideDynamicField(depFieldArgs);else{var valueChanged=dynamicFieldValueChanged(depFieldArgs,$dynamicFieldInputs,prevValue);showDynamicField(depFieldArgs,$fieldDiv,$dynamicFieldInputs,valueChanged)}})}function dynamicFieldValueChanged(depFieldArgs,
|
||
$dynamicFieldInputs,prevValue){var newValue=getFieldValueFromInputs($dynamicFieldInputs);return prevValue!==newValue}function updateHiddenDynamicListField(depFieldArgs,newValue){var inputId="field_"+depFieldArgs.fieldKey;if(depFieldArgs.repeatRow!=="")inputId+="-"+depFieldArgs.repeatRow;var listInput=document.getElementById(inputId);if(listInput===null)return;listInput.value=newValue;if(isFieldConditionallyHidden(depFieldArgs.containerId,depFieldArgs.formId))removeFromHideFields(depFieldArgs.containerId,
|
||
depFieldArgs.formId);triggerChange(jQuery(listInput))}function addLoadingIcon($fieldDiv){var currentHTML=$fieldDiv.html();if(currentHTML.indexOf("frm-loading-img")>-1);else{var loadingIcon='<span class="frm-loading-img"></span>';$fieldDiv.html(currentHTML+loadingIcon);var $optContainer=$fieldDiv.find(".frm_opt_container, .frm_data_container");$optContainer.hide()}}function addLoadingIconJS(fieldDiv,optContainer){var currentHTML=fieldDiv.innerHTML;if(currentHTML.indexOf("frm-loading-img")>-1);else{optContainer.classList.add("frm_hidden");
|
||
var loadingIcon=document.createElement("span");loadingIcon.setAttribute("class","frm-loading-img");fieldDiv.insertBefore(loadingIcon,optContainer.nextSibling)}}function removeLoadingIcon($optContainer){$optContainer.parent().children(".frm-loading-img").remove();$optContainer.show()}function removeLoadingIconJS(fieldDiv,optContainer){var loadingIcon=fieldDiv.getElementsByClassName("frm-loading-img")[0];if(loadingIcon!==null&&loadingIcon!==undefined)loadingIcon.parentNode.removeChild(loadingIcon);
|
||
optContainer.classList.remove("frm_hidden")}function getFieldValueFromInputs($inputs){var fieldValue=[],currentValue="";$inputs.each(function(){currentValue=this.value;if(this.type==="radio"||this.type==="checkbox"){if(this.checked===true)fieldValue.push(currentValue)}else if(currentValue!=="")fieldValue.push(currentValue)});if(fieldValue.length===0)fieldValue="";return fieldValue}function hideDynamicField(depFieldArgs){hideFieldAndClearValue(depFieldArgs,true)}function showDynamicField(depFieldArgs,
|
||
$fieldDiv,$fieldInputs,valueChanged){if(isFieldConditionallyHidden(depFieldArgs.containerId,depFieldArgs.formId)){removeFromHideFields(depFieldArgs.containerId,depFieldArgs.formId);$fieldDiv.show()}if($fieldInputs.hasClass("frm_chzn")||$fieldInputs.hasClass("frm_slimselect"))loadAutocomplete();if(valueChanged===true)triggerChange($fieldInputs)}function triggerCalc(){if(typeof __FRMCALC==="undefined")return;var triggers=__FRMCALC.triggers;if(triggers)jQuery(triggers.join()).trigger({type:"change",
|
||
selfTriggered:true});triggerCalcWithoutFields()}function triggerCalcWithoutFields(){var calcs=__FRMCALC.calc,vals=[];for(var fieldKey in calcs)if(calcs[fieldKey].fields.length<1&&calcs[fieldKey].calc){var totalField=document.getElementById("field_"+fieldKey);if(totalField!==null&&!isChildInputConditionallyHidden(totalField,calcs[fieldKey].form_id))doSingleCalculation(__FRMCALC,fieldKey,vals)}}function doCalculation(fieldId,triggerField){if(typeof __FRMCALC==="undefined")return;var allCalcs=__FRMCALC,
|
||
calc=allCalcs.fields[fieldId],vals=[];if(typeof calc==="undefined")return;var keys=calc.total;var len=keys.length;var pages=getStartEndPage(allCalcs.calc[keys[0]]);for(var i=0,l=len;i<l;i++){var totalOnPage=isTotalFieldOnPage(allCalcs.calc[keys[i]],pages);if(totalOnPage&&isTotalFieldConditionallyHidden(allCalcs.calc[keys[i]],triggerField.attr("name"))===false)doSingleCalculation(allCalcs,keys[i],vals,triggerField)}}function getStartEndPage(thisField){var formId=thisField.form_id,formContainer=document.getElementById("frm_form_"+
|
||
formId+"_container");if(formContainer===null&&thisField.in_section){var fieldContainer=document.getElementById("frm_field_"+thisField.in_section+"_container");if(fieldContainer===null)return[];formContainer=closest(fieldContainer,function(el){return el.tagName==="FORM"});formId=formContainer.elements.namedItem("form_id").value}var hasPreviousPage=formContainer.getElementsByClassName("frm_next_page");var hasAnotherPage=document.getElementById("frm_page_order_"+formId);var pages=[];if(hasPreviousPage.length>
|
||
0)pages.start=hasPreviousPage[0];if(hasAnotherPage!==null)pages.end=hasAnotherPage;return pages}function closest(el,fn){return el&&(fn(el)?el:closest(el.parentNode,fn))}function isTotalFieldOnPage(calcDetails,pages){if(typeof pages.start!=="undefined"||typeof pages.end!=="undefined"){var hiddenTotalField=jQuery('input[type=hidden][name*="['+calcDetails.field_id+']"]');if(hiddenTotalField.length)return isHiddenTotalOnPage(hiddenTotalField,pages)}return true}function isHiddenTotalOnPage(hiddenTotalField,
|
||
pages){var onPage,hiddenParent=hiddenTotalField.closest(".frm_form_field");if(hiddenParent.length)return true;var totalPos=hiddenTotalField.index();var isAfterStart=true;var isBeforeEnd=true;if(typeof pages.start!=="undefined")isAfterStart=jQuery(pages.start).index()<totalPos;if(typeof pages.end!=="undefined")isBeforeEnd=jQuery(pages.end).index()>totalPos;onPage=isAfterStart&&isBeforeEnd;if(!onPage)onPage=hiddenTotalField.closest(".do-calculation").length>0;return onPage}function isTotalFieldConditionallyHidden(calcDetails,
|
||
triggerFieldName){var hidden=false,fieldId=calcDetails.field_id,formId=calcDetails.form_id,hiddenFields=getHiddenFields(formId);if(hiddenFields.length<1)return hidden;if(calcDetails.inSection==="0"&&calcDetails.inEmbedForm==="0")hidden=isNonRepeatingFieldConditionallyHidden(fieldId,hiddenFields);else{var repeatArgs=getRepeatArgsFromFieldName(triggerFieldName);if(isNonRepeatingFieldConditionallyHidden(fieldId,hiddenFields))hidden=true;else if(isRepeatingFieldConditionallyHidden(fieldId,repeatArgs,
|
||
hiddenFields))hidden=true;else if(calcDetails.inSection!=="0"&&calcDetails.inEmbedForm!=="0")hidden=isRepeatingFieldConditionallyHidden(calcDetails.inSection,repeatArgs,hiddenFields);else if(calcDetails.inSection!=="0")hidden=isNonRepeatingFieldConditionallyHidden(calcDetails.inSection,hiddenFields);else if(calcDetails.inEmbedForm!=="0")hidden=isNonRepeatingFieldConditionallyHidden(calcDetails.inEmbedForm,hiddenFields)}return hidden}function isNonRepeatingFieldConditionallyHidden(fieldId,hiddenFields){var htmlID=
|
||
"frm_field_"+fieldId+"_container";return hiddenFields.indexOf(htmlID)>-1}function isRepeatingFieldConditionallyHidden(fieldId,repeatArgs,hiddenFields){var hidden=false;if(repeatArgs.repeatingSection){var fieldRepeatId="frm_field_"+fieldId+"-"+repeatArgs.repeatingSection;fieldRepeatId+="-"+repeatArgs.repeatRow+"_container";hidden=hiddenFields.indexOf(fieldRepeatId)>-1}return hidden}function maybeShowCalculationsErrorAlert(err,fieldKey,thisFullCalc){var alertMessage="";if(!jQuery("form").hasClass("frm-admin-viewing"))return;
|
||
alertMessage+=frm_js.calc_error+" "+fieldKey+":\n\n";alertMessage+=thisFullCalc+"\n\n";if(err.message)alertMessage+=err.message+"\n\n";alert(alertMessage)}function treatAsUTC(date){var copy=new Date(date.valueOf());copy.setMinutes(copy.getMinutes()-copy.getTimezoneOffset());return copy}function normalizeDate(date){switch(typeof date){case "number":return new Date(date*864E5);case "string":return new Date(date);default:return date}}function calculateDateDifference(a,b,format,fieldId,compareId){a=normalizeDate(a);
|
||
b=normalizeDate(b);switch(format){case "days":{if("function"===typeof window.frmCalcDateDifferenceDays&&fieldId&&compareId)return window.frmCalcDateDifferenceDays(treatAsUTC(a),treatAsUTC(b),fieldId,compareId);return Math.floor((treatAsUTC(b)-treatAsUTC(a))/864E5)}case "years":default:{var years=b.getFullYear()-a.getFullYear();if(b.getMonth()<a.getMonth()||b.getMonth()===a.getMonth()&&b.getDate()<a.getDate())years--;return years}}}function getTotalOrCalcField(triggerField,fieldKey){const form=document.contains(triggerField[0])?
|
||
triggerField.closest("form"):jQuery(`#frm_field_${triggerField[0].dataset.sectionid}_container`).closest("form");return form.find(fieldKey)}function doSingleCalculation(allCalcs,fieldKey,vals,triggerField){var currency,total,dec,updatedTotal,totalField,thisCalc=allCalcs.calc[fieldKey],thisFullCalc=thisCalc.calc,fieldInfo={triggerField:triggerField,inSection:false,thisFieldCall:'input[id^="field_'+fieldKey+'-"]'};if(typeof triggerField!=="undefined"&&triggerField&&triggerField.length)totalField=getTotalOrCalcField(triggerField,
|
||
"#field_"+fieldKey);else totalField=jQuery(document.getElementById("field_"+fieldKey));if(totalField.get(0)?.dataset.minGap)return;if(totalField.attr("type")==="range")return;if(totalField.length<1&&typeof triggerField!=="undefined"){fieldInfo.inSection=true;fieldInfo.thisFieldId=objectSearch(allCalcs.fieldsWithCalc,fieldKey);totalField=getSiblingField(fieldInfo)}if(totalField===null||totalField.length<1)return;thisFullCalc=getValsForSingleCalc(thisCalc,thisFullCalc,allCalcs,vals,fieldInfo);total=
|
||
"";dec="";if("function"===typeof window["frmProGetCalcTotal"+thisCalc.calc_type])total=window["frmProGetCalcTotal"+thisCalc.calc_type].call(thisCalc,thisFullCalc,{totalField});else if(thisCalc.calc_type==="text")total=thisFullCalc;else{if("date"===thisCalc.calc_type)return;dec=thisCalc.calc_dec;if(thisFullCalc.indexOf(").toFixed(")>-1){var calcParts=thisFullCalc.split(").toFixed(");if(isNumeric(calcParts[1])){dec=calcParts[1];thisFullCalc=thisFullCalc.replace(").toFixed("+dec,"")}}thisFullCalc=trimNumericCalculation(thisFullCalc);
|
||
if(thisFullCalc!=="")try{total=parseFloat(eval(thisFullCalc))}catch(err){maybeShowCalculationsErrorAlert(err,fieldKey,thisFullCalc)}if(typeof total==="undefined"||isNaN(total))total=0;if(isNumeric(dec)&&total!=="")total=total.toFixed(dec)}if(thisCalc.is_currency===true&&isNumeric(total)){currency=getCurrencyFromCalcRule(thisCalc);if(currency.decimals>0){total=Math.round10(total,currency.decimals);total=maybeAddTrailingZeroToPrice(total,currency);dec=currency.decimals}}if(totalField.val()===total){setDisplayedTotal(totalField,
|
||
total,currency);return}updatedTotal=false;if((isNumeric(dec)||thisCalc.is_currency)&&["number","text"].indexOf(totalField.attr("type"))>-1){if(total.toString().slice(-1)=="0"&&navigator.userAgent.toLowerCase().indexOf("firefox")>-1)totalField[0].setAttribute("type","text");if(totalField.parent().is(".frm_input_group.frm_with_box.frm_hidden")&&"string"===typeof total){updatedTotal=true;totalField.val(total.replace(",","."))}}if(!updatedTotal)totalField.val(total);triggerEvent(document,"frmCalcUpdatedTotal",
|
||
{totalField:totalField,total:total});if(triggerField===null||typeof triggerField==="undefined"||totalField.attr("name")!=triggerField.attr("name"))totalField.trigger({type:"change",selfTriggered:true,frmTriggered:fieldKey});setDisplayedTotal(totalField,total,currency)}function setDisplayedTotal(totalField,total,currency){var prepend,append,showTotal=totalField.parent().prev();if(!showTotal.hasClass("frm_total_formatted"))return;prepend=showTotal.data("prepend");append=showTotal.data("append");if(typeof prepend===
|
||
"undefined")prepend="";if(typeof append==="undefined")append="";if(typeof currency==="object"){total=formatCurrency(total,currency);if(currency.symbol_left===prepend)prepend="";if(currency.symbol_right===append)append=""}if(prepend!=="")prepend='<span class="frm_inline_pre">'+prepend+"</span>";if(append!=="")append='<span class="frm_inline_pre">'+append+"</span>";showTotal.html(prepend+'<span class="frm_inline_total">'+total+"</span>"+append)}function getValsForSingleCalc(thisCalc,thisFullCalc,allCalcs,
|
||
vals,fieldInfo){var fCount,f,field,date,findVar;fCount=thisCalc.fields.length;for(f=0;f<fCount;f++){field={triggerField:fieldInfo.triggerField,thisFieldId:thisCalc.fields[f],inSection:fieldInfo.inSection,valKey:fieldInfo.inSection+""+thisCalc.fields[f],thisField:allCalcs.fields[thisCalc.fields[f]],thisFieldCall:"input"+allCalcs.fieldKeys[thisCalc.fields[f]],formID:thisCalc.form_id};field=getCallForField(field,allCalcs);if(!thisCalc.calc_type){field.valKey="num"+field.valKey;vals=getCalcFieldId(field,
|
||
allCalcs,vals);if(typeof vals[field.valKey]==="undefined"||isNaN(vals[field.valKey])){vals[field.valKey]=0;if(field.thisField.type==="date"){date=tryToGetDateValue(field);if(null!==date)vals[field.valKey]=Math.floor(date.getTime()/864E5);else thisFullCalc=""}}else if(0===vals[field.valKey]&&field.thisField.type==="date"&&dateValueShouldBeClearedForDateCalculation(field,fieldInfo))thisFullCalc=""}else{field.valKey="text"+field.valKey;vals=getTextCalcFieldId(field,vals);if(typeof vals[field.valKey]===
|
||
"undefined")vals[field.valKey]=""}if(thisCalc.calc_type==="text")thisFullCalc=replaceShortcodesWithShowOptions(thisFullCalc,vals,field);findVar="["+field.thisFieldId+"]";findVar=findVar.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1");thisFullCalc=thisFullCalc.replace(new RegExp(findVar,"g"),vals[field.valKey])}return thisFullCalc}function replaceShortcodesWithShowOptions(fullCalc,vals,field){fullCalc=replaceShowShortcode(fullCalc,vals,field,"label",function(){return getOptionLabelsFromValues(vals[field.valKey],
|
||
field)});Array.prototype.forEach.call(["first","middle","last"],function(nameFieldPart){fullCalc=replaceNameShortcode(fullCalc,vals,field,nameFieldPart)});return fullCalc}function replaceNameShortcode(fullCalc,vals,field,show){var valueCallback=function(){var match=false;document.querySelectorAll(field.thisFieldCall).forEach(function(input){if(show===input.id.substr(-show.length))match=input});return match?match.value:""};return replaceShowShortcode(fullCalc,vals,field,show,valueCallback)}function replaceShowShortcode(fullCalc,
|
||
vals,field,show,valueCallback){var findVar;findVar="["+field.thisFieldId+" show="+show+"]";if(-1===fullCalc.indexOf(findVar))return fullCalc;vals[field.valKey+show]=valueCallback();findVar=findVar.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1");fullCalc=fullCalc.replace(new RegExp(findVar,"g"),vals[field.valKey+show]);return fullCalc}function tryToGetDateValue(field){var $element=jQuery(field.thisField.key);return $element.hasClass("hasDatepicker")?$element.datepicker("getDate"):null}function dateValueShouldBeClearedForDateCalculation(field,
|
||
fieldInfo){if(fieldInfo.triggerField!==null){if(fieldInfo.triggerField.is("input")){if(datepickerFieldShouldBeClearedForDateCalculation(fieldInfo.triggerField))return fieldShouldBeClearedForDateCalculation(field.thisFieldCall,field.thisField.key);return""===fieldInfo.triggerField.val()}return fieldInfo.triggerField.is("div")&&fieldInfo.triggerField.end().is("input")&&""===fieldInfo.triggerField.end().val()}else if(fieldShouldBeClearedForDateCalculation(field.thisFieldCall,field.thisField.key))return true;
|
||
return false}function datepickerFieldShouldBeClearedForDateCalculation(field){var dateValue=field.hasClass("hasDatepicker")?field.datepicker("getDate"):null;return null!==dateValue&&-72E6!==dateValue.getTime()}function fieldShouldBeClearedForDateCalculation(fieldCall,fieldKey){return 0===fieldCall.indexOf("input")&&0===fieldKey.indexOf("[id=")&&""===jQuery(fieldKey).val()}function getOptionLabelsFromValues(value,field){var fieldId,options,split,labels,length,index;fieldId=field.thisFieldId;if("undefined"===
|
||
typeof __FRMCALC.options||"undefined"===typeof __FRMCALC.options[fieldId])return value;options=__FRMCALC.options[fieldId];if("checkbox"===field.thisField.type){split=value.split(", ");labels=[];length=split.length;for(index=0;index<length;++index)if("undefined"!==typeof options[split[index]])labels.push(options[split[index]]);return labels.join(", ")}return"undefined"!==typeof options[value]?options[value]:""}function trimNumericCalculation(numericCalc){var lastChar=numericCalc.charAt(numericCalc.length-
|
||
1);if(lastChar==="+"||lastChar==="-")numericCalc=numericCalc.substr(0,numericCalc.length-1);return numericCalc}function getCallForField(field,allCalcs){if(field.thisField.type==="checkbox"||field.thisField.type==="radio"||field.thisField.type==="scale"||field.thisField.type==="star")field.thisFieldCall=field.thisFieldCall+":checked,"+field.thisFieldCall+"[type=hidden]";else if(field.thisField.type==="select"||field.thisField.type==="time")field.thisFieldCall="select"+allCalcs.fieldKeys[field.thisFieldId]+
|
||
" option:selected,"+field.thisFieldCall+"[type=hidden]";else if(field.thisField.type==="textarea")field.thisFieldCall=field.thisFieldCall+",textarea"+allCalcs.fieldKeys[field.thisFieldId];return field}function maybeDoCalcForSingleField(fieldInput){if(typeof __FRMCALC==="undefined")return;if(!fieldCanDoCalc(fieldInput.type))return;var allCalcs=__FRMCALC,fieldKey=getFieldKey(fieldInput.id,fieldInput.name),triggerField=maybeGetTriggerField(fieldInput),vals=[];if(allCalcs.calc[fieldKey]===undefined)return;
|
||
doSingleCalculation(allCalcs,fieldKey,vals,triggerField)}function fieldCanDoCalc(fieldType){return-1!==["text","hidden","number","textarea"].indexOf(fieldType)}function getFieldKey(fieldHtmlId,fieldName){var fieldKey=fieldHtmlId.replace("field_",""),newFieldKey="";if(isRepeatingFieldByName(fieldName)){var fieldKeyParts=fieldKey.split("-");for(var i=0;i<fieldKeyParts.length-1;i++)if(newFieldKey==="")newFieldKey=fieldKeyParts[i];else newFieldKey=newFieldKey+"-"+fieldKeyParts[i];fieldKey=newFieldKey}return fieldKey}
|
||
function maybeGetTriggerField(fieldInput){var triggerField=null;if(isRepeatingFieldByName(fieldInput.name))if(fieldInput.type!=="hidden")triggerField=jQuery(fieldInput).closest(".frm_form_field");else triggerField=jQuery(fieldInput);return triggerField}function isRepeatingFieldByName(fieldName){var fieldNameParts=fieldName.split("][");return fieldNameParts.length>=3}function getCalcFieldId(field,allCalcs,vals){if(typeof vals[field.valKey]!=="undefined"&&vals[field.valKey]!==0)return vals;vals[field.valKey]=
|
||
0;var currency,calcField=getCalcField(field);if(calcField===false)return vals;calcField.each(function(){var thisVal=getOptionValue(field.thisField,this);if(field.thisField.type==="date"){var d=getDateFieldValue(allCalcs.date,thisVal);if(d!==null)vals[field.valKey]=Math.ceil(d/(1E3*60*60*24))}else if("data"===field.thisField.type){vals[field.valKey]=0;if(""!==thisVal)if("SELECT"===this.tagName)vals[field.valKey]=parseFloat(this.querySelector('option[value="'+thisVal+'"]').textContent);else if(null!==
|
||
this.closest(".frm_checkbox")){vals[field.valKey]=0;jQuery(this.closest(".frm_opt_container").querySelectorAll("input:checked")).each(function(){vals[field.valKey]+=parseFloat(this.parentNode.textContent)})}else vals[field.valKey]=parseFloat(this.parentNode.textContent)}else if(this.hasAttribute("data-frmprice")||field.thisField.type==="total"||this.classList.contains("frm-has-number-format")){currency=getCurrency(field.formID);vals[field.valKey]+=parseFloat(!currency?thisVal:preparePrice(thisVal,
|
||
currency))}else{var n=thisVal;if(n!==""&&n!==0){n=n.trim();n=parseFloat(n.replace(/,/g,"").match(/-?[\d\.e]+$/))}if(typeof n==="undefined"||isNaN(n)||n==="")n=0;vals[field.valKey]+=n}});return vals}function getTextCalcFieldId(field,vals){if(typeof vals[field.valKey]!=="undefined"&&vals[field.valKey]!=="")return vals;vals[field.valKey]="";var calcField=getCalcField(field);if(calcField===false)return vals;var count=0;var sep="";calcField.each(function(){var thisVal=getOptionValue(field.thisField,this);
|
||
thisVal=thisVal.trim();sep=getCalcSep(field,count);if(thisVal!==""){vals[field.valKey]+=sep+thisVal;count++}});return vals}function getCalcSep(field,count){var sep="";if(count>0){if(field.thisField.type==="time")if(count==1)sep=":";else{if(count==2)sep=" "}else sep=", ";var customSep=jQuery(document).triggerHandler("frmCalSeparation",[field.thisField,count]);if(typeof customSep!=="undefined")sep=customSep}return sep}function getCalcField(field){var calcField;if(field.inSection===false){if("name"===
|
||
field.thisField.type)return getOffScreenFieldForName(field);if("undefined"!==typeof field.triggerField&&field.triggerField&&field.triggerField.length)calcField=getTotalOrCalcField(field.triggerField,field.thisFieldCall);else calcField=jQuery(field.thisFieldCall);if(!calcField.length&&-1!==["date","data"].indexOf(field.thisField.type)){calcField=jQuery(field.thisField.key);if(!calcField.length&&"data"===field.thisField.type)calcField=jQuery(field.thisField.key.replace('="',"^=").replace('"]',"-")+
|
||
"]:checked")}}else calcField=getSiblingField(field);if(calcField===null||typeof calcField==="undefined"||calcField.length<1)calcField=false;if(calcField.length>1)calcField=filterCalcField(calcField,field.thisFieldId);return calcField}function filterCalcField($calcField,thisFieldId){return $calcField.filter(function(){var target="OPTION"===this.nodeName?this.closest("select"):this;return target&&target.name&&target.name.indexOf(thisFieldId)!==-1})}function getOffScreenFieldForName(field){var nameParts,
|
||
input;nameParts=[];document.querySelectorAll(field.thisFieldCall).forEach(function(input){nameParts.push(input.value)});input=document.createElement("input");input.value=nameParts.join(" ");return jQuery(input)}function getDateFieldValue(dateFormat,thisVal){var d=0;if(!thisVal);else if(typeof jQuery.datepicker==="undefined"){var splitAt="-";if(dateFormat.indexOf("/")>-1)splitAt="/";var year="",month="",day="",formatPieces=dateFormat.split(splitAt),datePieces=thisVal.split(splitAt);for(var i=0;i<formatPieces.length;i++)if(formatPieces[i]===
|
||
"y"){var currentYear=(new Date).getFullYear()+15;var currentYearPlusFifteen=currentYear.toString().substr(2,2);if(datePieces[i]>currentYearPlusFifteen)year="19"+datePieces[i];else year="20"+datePieces[i]}else if(formatPieces[i]==="yy")year=datePieces[i];else if(formatPieces[i]==="m"||formatPieces[i]==="mm"){month=datePieces[i];if(month.length<2)month="0"+month}else if(formatPieces[i]==="d"||formatPieces[i]==="dd"){day=datePieces[i];if(day.length<2)day="0"+day}d=Date.parse(year+"-"+month+"-"+day)}else d=
|
||
jQuery.datepicker.parseDate(dateFormat,thisVal);return d}function getSiblingField(field){if(typeof field.triggerField==="undefined")return null;var fields=null,container=field.triggerField.closest(".frm_repeat_sec, .frm_repeat_inline, .frm_repeat_grid"),repeatArgs=getRepeatArgsFromFieldName(field.triggerField.attr("name")),siblingFieldCall=field.thisFieldCall.replace("[id=","[id^=").replace(/-"]/g,"-"+repeatArgs.repeatRow+'"]');if(container.length||repeatArgs.repeatRow!==""){if(container.length)fields=
|
||
container.find(siblingFieldCall+","+siblingFieldCall.replace("input[","select["));else fields=jQuery(siblingFieldCall);if(fields===null||typeof fields==="undefined"||fields.length<1)fields=uncheckedSiblingOrOutsideSection(field,container,siblingFieldCall)}else fields=getNonSiblingField(field);return fields}function uncheckedSiblingOrOutsideSection(field,container,siblingFieldCall){var fields=null;if(siblingFieldCall.indexOf(":checked")){var inSection=container.find(siblingFieldCall.replace(":checked",
|
||
""));if(inSection.length<1)fields=getNonSiblingField(field)}else fields=getNonSiblingField(field);return fields}function getNonSiblingField(field){var nonSiblingField=jQuery(field.thisFieldCall+","+field.thisFieldCall.replace("input[","select["));if(!nonSiblingField.length&&"input["===field.thisFieldCall.substr(0,6))if("undefined"!==typeof field.triggerField&&field.triggerField.is("div")&&field.triggerField.hasClass("frm_form_field"))nonSiblingField=field.triggerField.find(field.thisFieldCall.replace("input[",
|
||
"textarea["));else nonSiblingField=jQuery(field.thisFieldCall.replace("input[","textarea["));return nonSiblingField}function getOptionValue(thisField,currentOpt){var thisVal;if(isOtherOption(thisField,currentOpt))thisVal=getOtherValueAnyField(thisField,currentOpt);else if(currentOpt.type==="checkbox"||currentOpt.type==="radio")if(currentOpt.checked)thisVal=currentOpt.hasAttribute("data-frmprice")?currentOpt.dataset.frmprice:currentOpt.value;else thisVal=currentOpt.dataset.off;else if(currentOpt.hasAttribute("data-frmprice"))thisVal=
|
||
currentOpt.dataset.frmprice;else if(isCurrencyFormatField(thisField)){const fieldKey=thisField.key.replace('[id="field_',"").replace('"]',"");const calcRule=window.__FRMCALC?.calc?.[fieldKey];thisVal=jQuery(currentOpt).val();if(!calcRule)return thisVal;const resultFieldKey=thisField.total[0];const totalField=resultFieldKey?window.__FRMCALC?.calc?.[resultFieldKey]:false;if(!totalField||totalField.calc_type!=="text"){const isNegative="-"===thisVal.charAt(0);const currency=getCurrencyFromCalcRule(calcRule);
|
||
thisVal=""+preparePrice(thisVal,currency);if(isNegative)thisVal="-"+thisVal}}else thisVal=jQuery(currentOpt).val();if(typeof thisVal==="undefined")thisVal="";return thisVal}function isCurrencyFormatField(field){const fieldKey=field.key.replace('[id="field_',"").replace('"]',"");const isCalcField=window.__FRMCALC?.calc?.[fieldKey]?.is_currency;return isCalcField?true:false}function isOtherOption(thisField,currentOpt){var isOtherOpt=false;if(currentOpt.type==="hidden"){if(getOtherValueLimited(currentOpt)!==
|
||
"")isOtherOpt=true}else if(thisField.type==="select"){var optClass=currentOpt.className;if(optClass&&optClass.indexOf("frm_other_trigger")>-1)isOtherOpt=true}else if(thisField.type==="checkbox"||thisField.type==="radio")if(currentOpt.id.indexOf("-other_")>-1&¤tOpt.id.indexOf("-otext")<0)isOtherOpt=true;return isOtherOpt}function getOtherValueLimited(currentOpt){var otherVal="",otherText=document.getElementById(currentOpt.id+"-otext");if(otherText!==null&&otherText.value!=="")otherVal=otherText.value;
|
||
return otherVal}function getOtherValueAnyField(thisField,currentOpt){var otherVal=0;if(thisField.type==="select")if(currentOpt.type==="hidden")if(isCurrentOptRepeating(currentOpt));else otherVal=getOtherValueLimited(currentOpt);else otherVal=getOtherSelectValue(currentOpt);else if(thisField.type==="checkbox"||thisField.type==="radio")if(currentOpt.type==="hidden");else otherVal=getOtherValueLimited(currentOpt);return otherVal}function isCurrentOptRepeating(currentOpt){var isRepeating=false,parts=
|
||
currentOpt.name.split("[");if(parts.length>2)isRepeating=true;return isRepeating}function getOtherSelectValue(currentOpt){var fields=getOtherSelects(currentOpt);return fields.val()}function setOtherSelectValue(thisField,value){var i,fields=getOtherSelects(thisField);if(fields.length<1)return;fields.val(value);for(i=0;i<thisField.options.length;i++)if(thisField.options[i].className.indexOf("frm_other_trigger")!==-1)thisField.options[i].selected=true}function getOtherSelects(currentOpt){return jQuery(currentOpt).closest(".frm_other_container").find(".frm_other_input")}
|
||
function setOtherValueLimited(thisField,value){var otherText,baseId,parentInput,i=0,idParts=thisField.id.split("-");idParts.pop();baseId=idParts.join("-");otherText=document.querySelectorAll("[id^="+baseId+"-other][id$=otext]");if(otherText.length>0)for(i=0;i<otherText.length;i++)if(otherText[i].value===""){otherText[i].value=value;parentInput=document.getElementById(otherText[i].id.replace("-otext",""));if(parentInput!==null)parentInput.checked=true}}function savingDraftEntry(object){var isDraft=
|
||
false,savingDraft=jQuery(object).find(".frm_saving_draft");if(savingDraft.length)isDraft=savingDraft.val();return isDraft}function goingToPrevPage(object){var goingBack=false,nextPage=jQuery(object).find(".frm_next_page");if(nextPage.length&&nextPage.val()){var formID=jQuery(object).find('input[name="form_id"]').val();var prevPage=jQuery(object).find('input[name="frm_page_order_'+formID+'"]');if(prevPage.length)prevPage=parseInt(prevPage.val());else prevPage=0;if(!prevPage||parseInt(nextPage.val())<
|
||
prevPage)goingBack=true}return goingBack}function afterFormSubmitted(event,form){checkConditionalLogic("pageLoad");doEditInPlaceCleanUp(form);checkFieldsOnPage();maybeShowMoreStepsButton()}function afterPageChanged(){checkFieldsOnPage();addTopAddRowBtnForRepeater();maybeDisableCheckboxesWithLimit();calcProductsTotal();maybeShowMoreStepsButton();triggerChangeOnCalcTriggers();maybeAddIntlTelInput(document.querySelectorAll(".frm-intl-tel-input"));initRangeInput(document.querySelectorAll(".with_frm_style input[type=range]"));
|
||
initFormatFieldValueNumbers()}function triggerChangeOnCalcTriggers(){if("undefined"===typeof __FRMCALC||"undefined"===typeof __FRMCALC.fieldKeys)return;Object.values(__FRMCALC.fieldKeys).forEach(function(key){jQuery(key+":not(label):not([type=hidden])").each(function(){jQuery(this).trigger({type:"change",selfTriggered:true})})})}function generateGoogleTables(graphs,graphType){for(var num=0;num<graphs.length;num++)generateSingleGoogleTable(graphs[num],graphType)}function generateSingleGoogleTable(opts,
|
||
type){google.load("visualization","1.0",{packages:[type],callback:function(){compileGoogleTable(opts)}})}function compileGoogleTable(opts){var data=new google.visualization.DataTable,showID=false;if(jQuery.inArray("id",opts.options.fields)!==-1){showID=true;data.addColumn("number",frm_js.id)}var colCount=opts.fields.length;var type="string";for(var i=0,l=colCount;i<l;i++){var thisCol=opts.fields[i];type=getGraphType(thisCol);data.addColumn(type,thisCol.name)}var showEdit=false;if(opts.options.edit_link){showEdit=
|
||
true;data.addColumn("string",opts.options.edit_link)}var showDelete=false;if(opts.options.delete_link){showDelete=true;data.addColumn("string",opts.options.delete_link)}var col=0;if(opts.entries!==null){var entryCount=opts.entries.length;data.addRows(entryCount);var row=0;for(var e=0,len=entryCount;e<len;e++){col=0;var entry=opts.entries[e];if(showID){data.setCell(row,col,entry.id);col++}for(var field=0,fieldCount=colCount;field<fieldCount;field++){var thisEntryCol=opts.fields[field];type=getGraphType(thisEntryCol);
|
||
var fieldVal=entry.metas[thisEntryCol.id];if(type==="number"&&(fieldVal===null||fieldVal===""))fieldVal=0;else if(type==="boolean")if(fieldVal===null||fieldVal=="false"||fieldVal===false)fieldVal=false;else fieldVal=true;data.setCell(row,col,fieldVal);col++}if(showEdit){if(typeof entry.editLink!=="undefined")data.setCell(row,col,'<a href="'+entry.editLink+'">'+opts.options.edit_link+"</a>");else data.setCell(row,col,"");col++}if(showDelete)if(typeof entry.deleteLink!=="undefined")data.setCell(row,
|
||
col,'<a href="'+entry.deleteLink+'" class="frm_delete_link" data-frmconfirm="'+opts.options.confirm+'">'+opts.options.delete_link+"</a>");else data.setCell(row,col,"");row++}}else{data.addRows(1);col=0;for(i=0,l=colCount;i<l;i++){if(col>0)data.setCell(0,col,"");else data.setCell(0,col,opts.options.no_entries);col++}}var chart=new google.visualization.Table(document.getElementById("frm_google_table_"+opts.options.form_id));chart.draw(data,opts.graphOpts)}function generateGoogleGraphs(graphs){var l,
|
||
i;l=graphs.length;for(i=0;i<l;i++){generateSingleGoogleGraph(graphs[i]);if("string"===typeof graphs[i].options.width&&"%"===graphs[i].options.width.substr(-1))addResponsiveGraphListener(graphs[i])}}function addResponsiveGraphListener(graphData){window.addEventListener("resize",function(){generateSingleGoogleGraph(graphData)})}function generateSingleGoogleGraph(graphData){google.charts.load("current",{packages:[graphData.package]});google.charts.setOnLoadCallback(function(){compileGoogleGraph(graphData)})}
|
||
function compileGoogleGraph(graphData){var data=new google.visualization.DataTable;data=google.visualization.arrayToDataTable(graphData.data);var chartDiv=document.getElementById("chart_"+graphData.graph_id);if(chartDiv===null)return;var type=graphData.type.charAt(0).toUpperCase()+graphData.type.slice(1);if(type!=="Histogram"&&type!=="Table")type+="Chart";var chart=new google.visualization[type](chartDiv);chart.draw(data,graphData.options);jQuery(document).trigger("frmDrawChart",[chart,"chart_"+graphData.graph_id,
|
||
data])}function getGraphType(field){var type="string";if(field.type==="number")type="number";else if(field.type==="checkbox"||field.type==="select"){var optCount=field.options.length;if(field.type==="select"&&field.options[0]==="")if(field.field_options.post_field==="post_status")optCount=3;else optCount=optCount-1;if(optCount==1)type="boolean"}return type}function removeRow(){if(!confirmRowRemoval())return;var rowNum=jQuery(this).data("key"),sectionID=jQuery(this).data("parent"),id="frm_section_"+
|
||
sectionID+"-"+rowNum,thisRow=jQuery(this).parents('div[id^="frm_section_"]'),fields=thisRow.find("input, select, textarea, .frm_html_container"),formId=jQuery(this).closest("form").find('input[name="form_id"]').val();thisRow.fadeOut("slow",function(){const repeaterRow=thisRow[0].closest(".frm_section_heading");if(repeaterRow.querySelectorAll(".frm_repeat_sec, .frm_repeat_inline, .frm_repeat_grid")?.length===1)repeaterRow.querySelector(".frm_hidden_container.frm_repeat_buttons.frm_hidden").style.display=
|
||
"inline-block";thisRow.remove();fields.each(function(){var fieldID;if(this.matches(".frm_html_container"))fieldID=getHtmlFieldID(this);else fieldID=frmFrontForm.getFieldId(this,false);if(this.type!="file")doCalculation(fieldID,jQuery(this));var container="frm_field_"+fieldID+"-"+sectionID+"-"+rowNum+"_container";removeFromHideFields(container,formId);if(this.classList.contains("wp-editor-area"))removeRichText(this.id)});showAddButton(sectionID);maybeHideRemoveButtons(sectionID);if(typeof frmThemeOverride_frmRemoveRow===
|
||
"function")frmThemeOverride_frmRemoveRow(id,thisRow);jQuery(document).trigger("frmAfterRemoveRow")});return false}function maybeHideRemoveButtons(sectionID){var sectionContainer,repeatButtons,minRows,currentRows;sectionContainer=document.querySelector("#frm_field_"+sectionID+"_container");if(!sectionContainer)return;repeatButtons=sectionContainer.querySelector(".frm_repeat_buttons[data-repeat-min]");if(!repeatButtons||!repeatButtons.dataset.repeatMin)return;minRows=repeatButtons.dataset.repeatMin;
|
||
currentRows=document.querySelectorAll(".frm_repeat_"+sectionID).length;if(currentRows<=minRows)hideRemoveButtons(sectionID)}function getHtmlFieldID(field){var parentIDParts;parentIDParts=field.id.split("_");if(parentIDParts.length<3)return 0;parentIDParts=parentIDParts[2];parentIDParts=parentIDParts.split("-");if(!parentIDParts.length)return 0;return parentIDParts[0]}function confirmRowRemoval(){if(!frm_js.repeaterRowDeleteConfirmation)return true;return confirm(frm_js.repeaterRowDeleteConfirmation)}
|
||
function hideAddButton(sectionID){getRepeaterAddButtons(sectionID).forEach(function(button){button.classList.add("frm_hide_add_button")})}function showAddButton(sectionID){getRepeaterAddButtons(sectionID).forEach(function(button){button.classList.remove("frm_hide_add_button")})}function getRepeaterAddButtons(sectionID){return getFieldContainerChildren(sectionID,".frm_add_form_row")}function hideRemoveButtons(sectionID){getRepeaterRemoveButtons(sectionID).forEach(function(button){button.classList.add("frm_hide_remove_button")})}
|
||
function showRemoveButtons(sectionID){getRepeaterRemoveButtons(sectionID).forEach(function(button){button.classList.remove("frm_hide_remove_button")})}function getRepeaterRemoveButtons(sectionID){return getFieldContainerChildren(sectionID,".frm_remove_form_row")}function getFieldContainer(fieldD){return document.getElementById("frm_field_"+fieldD+"_container")}function getFieldContainerChildren(fieldID,childSelector){var container=getFieldContainer(fieldID);if(!container)return[];return container.querySelectorAll(childSelector)}
|
||
function addRow(){var thisBtn,id,i,numberOfSections,lastRowIndex,stateField,state,form,data,success,error,extraParams;if(currentlyAddingRow===true)return false;currentlyAddingRow=true;thisBtn=jQuery(this);id=thisBtn.data("parent");i=0;numberOfSections=jQuery(".frm_repeat_"+id).length;if(numberOfSections>0){lastRowIndex=false;document.querySelectorAll(".frm_repeat_"+id).forEach(function(element){var strippedId=element.id.replace("frm_section_"+id+"-",""),parsedId;if(!strippedId.length||"i"===strippedId[0])return;
|
||
parsedId=parseInt(strippedId);if(parsedId&&(false===lastRowIndex||parsedId>lastRowIndex))lastRowIndex=parsedId});if(false===lastRowIndex)i=1;else i=lastRowIndex+1}stateField=document.querySelector('input[name="frm_state"]');state=null!==stateField?stateField.value:"";form=jQuery(this).closest("form").get(0);data={action:"frm_add_form_row",field_id:id,i:i,numberOfSections:numberOfSections,nonce:frm_js.nonce,frm_state:state};triggerEvent(form,"frmBeforeNewRepeaterRow",data);success=function(r){var html,
|
||
item,checked,fieldID,fieldObject,repeatArgs,j,inputRanges;if(r.html){html=r.html;item=jQuery(html).addClass("frm-fade-in");const repeaterSection=thisBtn[0].closest(".frm_section_heading");const toggleContainer=repeaterSection.querySelector(".frm_toggle_container.frm_grid_container");if(toggleContainer)toggleContainer.append(item[0]);else repeaterSection.append(item[0]);const repeatButtons=repeaterSection.querySelector(".frm_hidden_container.frm_repeat_buttons.frm_hidden");if(repeatButtons)repeatButtons.style.display=
|
||
"none";inputRanges=item[0].querySelectorAll("input[type=range]");for(j=0;j<inputRanges.length;j++)handleSliderEvent.call(inputRanges[j]);if(r.is_repeat_limit_reached)hideAddButton(id);if(!r.passes_repeat_min_check)hideRemoveButtons(id);else showRemoveButtons(id);checked=["other"];repeatArgs={repeatingSection:id.toString(),repeatRow:i.toString()};jQuery(html).find("input, select, textarea").each(function(){if(this.name==="")return true;if(this.type==="file")fieldID=this.name.replace("file","").split("-")[0];
|
||
else fieldID=this.name.replace("item_meta[","").split("]")[2].replace("[","");if(jQuery.inArray(fieldID,checked)==-1){if(this.id===false||this.id==="")return;fieldObject=jQuery("#"+this.id);checked.push(fieldID);hideOrShowFieldById(fieldID,repeatArgs);updateWatchingFieldById(fieldID,repeatArgs,"value changed");checkFieldsWithConditionalLogicDependentOnThis(fieldID,fieldObject);checkFieldsWatchingLookup(fieldID,fieldObject,"value changed");doCalculation(fieldID,fieldObject);maybeDoCalcForSingleField(fieldObject.get(0))}});
|
||
jQuery(html).find(".frm_html_container").each(function(){var fieldID=this.id.replace("frm_field_","").split("-")[0];checked.push(fieldID);hideOrShowFieldById(fieldID,repeatArgs)});maybeAddIntlTelInput(item.find(".frm-intl-tel-input").get());if(item.closest(".with_frm_style").length>0)initRangeInput(item.find("input[type=range]").get());initFormatFieldValueNumbers();loadDropzones(repeatArgs.repeatRow);loadSliders();loadAutocomplete();loadImask();jQuery(html).find(".frm_html_container").each(function(){var fieldID=
|
||
this.id.replace("frm_field_","").split("-")[0];checked.push(fieldID);hideOrShowFieldById(fieldID,repeatArgs)});jQuery(html).find(".wp-editor-area").each(function(){initRichText(this.id)})}if(typeof frmThemeOverride_frmAddRow==="function")frmThemeOverride_frmAddRow(id,r);jQuery(document).trigger("frmAfterAddRow");handleRangeSliders();triggerEvent(document,"frmAfterAddRepeaterRow",{repeater:item.get(0)});jQuery(".frm_repeat_"+id).each(function(i){this.style.zIndex=999-i});currentlyAddingRow=false};
|
||
error=function(){currentlyAddingRow=false};extraParams={dataType:"json"};postToAjaxUrl(form,data,success,error,extraParams);return false}function triggerToggleClickOnSpace(e){if(32===e.which)this.click()}function removeRichText(id){tinymce.EditorManager.execCommand("mceRemoveEditor",true,id)}function initRichText(id){var key=Object.keys(tinyMCEPreInit.mceInit)[0],orgSettings=tinyMCEPreInit.mceInit[key],newValues={selector:"#"+id,body_class:orgSettings.body_class.replace(key,id)},newSettings=Object.assign({},
|
||
orgSettings,newValues);tinymce.init(newSettings)}function editEntry(){var $edit=jQuery(this),entryId=$edit.data("entryid"),prefix=$edit.data("prefix"),postId=$edit.data("pageid"),formId=$edit.data("formid"),cancel=$edit.data("cancel"),fields=$edit.data("fields"),excludeFields=$edit.data("excludefields"),startPage=$edit.data("startpage"),$cont=jQuery(document.getElementById(prefix+entryId)),orig=$cont.html();$cont.html('<span class="frm-loading-img" id="'+prefix+entryId+'"></span><div class="frm_orig_content" style="display:none">'+
|
||
orig+"</div>");jQuery.ajax({type:"POST",url:getUrlForInPlaceEdit(),dataType:"html",data:{action:"frm_entries_edit_entry_ajax",post_id:postId,entry_id:entryId,id:formId,nonce:frm_js.nonce,fields:fields,exclude_fields:excludeFields,start_page:startPage},success:function(html){$cont.children(".frm-loading-img").replaceWith(html);$edit.removeClass("frm_inplace_edit").addClass("frm_cancel_edit");$edit.html(cancel);checkConditionalLogic("editInPlace");if(typeof frmFrontForm.fieldValueChanged==="function")jQuery(document).on("change",
|
||
'.frm-show-form input[name^="item_meta"], .frm-show-form select[name^="item_meta"], .frm-show-form textarea[name^="item_meta"]',frmFrontForm.fieldValueChanged);checkFieldsOnPage(prefix+entryId);triggerEvent(document,"frmInPlaceEdit")}});return false}function getUrlForInPlaceEdit(){var url=frm_js.ajax_url,queryParams=getQueryParamsForInPlaceEdit();Array.prototype.forEach.call(Object.keys(queryParams),function(queryParamKey){url+=-1===url.indexOf("?")?"?":"&";url+=queryParamKey+"="+queryParams[queryParamKey]});
|
||
return url}function getQueryParamsForInPlaceEdit(){var queryParams,queryString,pairs,keysToSkip,length,i,pair,key,value;queryParams={};queryString=window.location.search.substring(1);pairs=queryString.split("&");keysToSkip=["action","start_page","nonce","post_id","entry_id","id","fields","doing_wp_cron"];length=pairs.length;for(i=0;i<length;i++){pair=pairs[i].split("=");key=decodeURIComponent(pair[0]);if(-1!==keysToSkip.indexOf(key))continue;value=decodeURIComponent(pair[1]);if(queryParams.hasOwnProperty(key))if(Array.isArray(queryParams[key]))queryParams[key].push(value);
|
||
else queryParams[key]=[queryParams[key],value];else queryParams[key]=value}return queryParams}function cancelEdit(event){event.preventDefault();const $cancelLink=jQuery(this);const prefix=$cancelLink.data("prefix");const entryId=$cancelLink.data("entryid");const $cont=jQuery(document.getElementById(prefix+entryId));$cont.children(".frm_forms").replaceWith("");$cont.children(".frm_orig_content").fadeIn("slow").removeClass("frm_orig_content");switchCancelToEdit($cancelLink)}function switchCancelToEdit($link){var label=
|
||
$link.data("edit");$link.removeClass("frm_cancel_edit").addClass("frm_inplace_edit");$link.html(label)}function deleteEntry(){var entryId,prefix,$link=jQuery(this),confirmText=$link.data("deleteconfirm");if(confirm(confirmText)){entryId=$link.data("entryid");prefix=$link.data("prefix");$link.replaceWith('<span class="frm-loading-img" id="frm_delete_'+entryId+'"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_destroy",entry:entryId,nonce:frm_js.nonce},success:function(html){if(html.replace(/^\s+|\s+$/g,
|
||
"")==="success"){var container=jQuery(document.getElementById(prefix+entryId));container.fadeOut("slow",function(){container.remove()});jQuery(document.getElementById("frm_delete_"+entryId)).fadeOut("slow");jQuery(document).trigger("frmEntryDeleted",[entryId])}else jQuery(document.getElementById("frm_delete_"+entryId)).replaceWith(html)}})}return false}function doEditInPlaceCleanUp(form){var entryIdField=jQuery(form).find('input[name="id"]');if(entryIdField.length){var link=document.getElementById("frm_edit_"+
|
||
entryIdField.val());if(isCancelLink(link))switchCancelToEdit(jQuery(link))}}function isCancelLink(link){return link!==null&&link.className.indexOf("frm_cancel_edit")>-1}function loadUniqueTimeFields(){var timeFields,i,dateField;if(typeof __frmUniqueTimes==="undefined")return;timeFields=__frmUniqueTimes;for(i=0;i<timeFields.length;i++){dateField=document.getElementById(timeFields[i].dateID);jQuery(dateField).on("change",maybeTriggerUniqueTime);if(""!==dateField.value)jQuery(dateField).trigger("change")}}
|
||
function maybeTriggerUniqueTime(){var timeFields=__frmUniqueTimes;for(var i=0;i<timeFields.length;i++)if(timeFields[i].dateID==this.id)frmProForm.removeUsedTimes(this,timeFields[i].timeID)}function checkFieldsOnPage(containerId,event){if("undefined"===typeof event)event="";checkPreviouslyHiddenFields();loadDateFields();loadCustomInputMasks();loadSliders();loadAutocomplete(containerId);checkDynamicFields(event);checkLookupFields();setTimeout(triggerCalc,0);loadDropzones();loadImask(containerId);checkPasswordFields();
|
||
triggerLookupWatchUpdates()}function triggerLookupWatchUpdates(){var i,fieldId,keys,value,$changedInput;if(typeof __FRMLOOKUP==="undefined"||document.querySelector('form input[name="id"]'))return;keys=Object.keys(__FRMLOOKUP);for(i=0;i<keys.length;i++){fieldId=keys[i];value=__FRMLOOKUP[fieldId];if(value.dependents.length<=0)continue;$changedInput=jQuery("#field_"+value.fieldKey);if($changedInput.length)checkFieldsWatchingLookup(fieldId,$changedInput,"value changed")}}function checkPasswordFields(){var passwordFields=
|
||
document.querySelectorAll(".frm_strength_meter"),event=document.createEvent("HTMLEvents");event.initEvent("keyup",true,true);for(var i=0;i<passwordFields.length;i++)passwordFields[i].dispatchEvent(event)}function checkPreviouslyHiddenFields(){if(typeof __frmHideFields!=="undefined")frmProForm.hidePreviouslyHiddenFields()}function loadAutocomplete(containerId){loadChosen(containerId);loadSlimSelect(containerId)}function loadChosen(chosenContainer){var opts;if(!jQuery().chosen)return;opts={allow_single_deselect:true,
|
||
no_results_text:frm_js.no_results,search_contains:true};if(typeof __frmChosen!=="undefined")opts="{"+__frmChosen+"}";if(typeof chosenContainer!=="undefined")jQuery("#"+chosenContainer).find(".frm_chzn").chosen(opts);else jQuery(".frm_chzn").chosen(opts)}function loadSlimSelect(containerId){var container,dropdowns;if("undefined"===typeof SlimSelect)return;if("undefined"!==typeof containerId){container=document.getElementById(containerId);if(!container)return;dropdowns=container.querySelectorAll("select.frm_slimselect")}else dropdowns=
|
||
document.querySelectorAll("select.frm_slimselect");dropdowns.forEach(function(autocompleteInput){var emptyOption,allowDeselect,isMultiSelect,tabindex;if("none"===autocompleteInput.style.display||autocompleteInput.classList.contains("ss-main")||autocompleteInput.classList.contains("ss-content"))return;emptyOption=autocompleteInput.querySelector('option[value=""]');allowDeselect=false;isMultiSelect="multiple"===autocompleteInput.getAttribute("multiple");if(emptyOption&&""===emptyOption.textContent.trim()){allowDeselect=
|
||
true;if(isMultiSelect)emptyOption.parentElement.removeChild(emptyOption);else emptyOption.setAttribute("data-placeholder","true")}else if(autocompleteInput.querySelector('option[data-placeholder="true"]'))allowDeselect=true;tabindex=autocompleteInput.getAttribute("tabindex");autocompleteInput.style.color="";new SlimSelect({select:autocompleteInput,settings:{placeholderText:"",searchText:frm_js.no_results,searchPlaceholder:" ",allowDeselect:allowDeselect,closeOnSelect:!isMultiSelect,keepOrder:true},
|
||
events:{afterOpen:function(){var ssContent,ssContentSearchInput,ssList,label;ssContent=document.querySelector('.ss-content[data-id="'+autocompleteInput.dataset.id+'"]');if(!ssContent)return;ssContent.removeAttribute("role");ssContentSearchInput=ssContent.querySelector(".ss-search input");if(!ssContentSearchInput)return;ssContentSearchInput.removeAttribute("aria-label");ssList=ssContent.querySelector(".ss-list");if(ssList){ssList.style.height=getHeightForSlimSelectList(ssContent)+"px";ssList.setAttribute("role",
|
||
"listbox")}label=document.querySelector('label[for="'+autocompleteInput.id+'"]');if(label){ssContentSearchInput.setAttribute("aria-labelledby",label.id);if(ssList)ssList.setAttribute("aria-labelledby",label.id)}}}});if(tabindex)copyTabIndexAttributeToSlimSelectElement(autocompleteInput,tabindex);makeSlimSelectAccessibilityChanges(autocompleteInput);maybeApplySlimSelectAutoWidth(autocompleteInput,allowDeselect);autocompleteInput.addEventListener("change",function(){jQuery(autocompleteInput).trigger("change")})})}
|
||
function copyTabIndexAttributeToSlimSelectElement(autocompleteInput,tabindex){var slimselectElement=getSlimSelectMainElement(autocompleteInput);if(slimselectElement)slimselectElement.setAttribute("tabindex",tabindex)}function getSlimSelectMainElement(autocompleteInput){return document.querySelector('.ss-main[data-id="'+autocompleteInput.getAttribute("data-id")+'"]')}function getHeightForSlimSelectList(ssContent){var ssSearch,listHeight;listHeight=jQuery(ssContent).outerHeight();ssSearch=ssContent.querySelector(".ss-search");
|
||
if(ssSearch)listHeight-=jQuery(ssSearch).outerHeight();return listHeight}function makeSlimSelectAccessibilityChanges(autocompleteInput){addAriaLabelledByToSlimSelectMainElement(autocompleteInput);openSlimSelectOnLabelClick(autocompleteInput)}function maybeApplySlimSelectAutoWidth(autocompleteInput,allowDeselect){var slimselectElement,extraRequiredWidth;if(!autocompleteInput.classList.contains("auto_width"))return;slimselectElement=getSlimSelectMainElement(autocompleteInput);if(slimselectElement){extraRequiredWidth=
|
||
allowDeselect?36:14;slimselectElement.style.minWidth=jQuery(autocompleteInput).outerWidth()+extraRequiredWidth+"px"}}function addAriaLabelledByToSlimSelectMainElement(autocompleteInput){var label,slimselectElement;label=document.querySelector('label[for="'+autocompleteInput.id+'"]');if(label){slimselectElement=getSlimSelectMainElement(autocompleteInput);if(slimselectElement)slimselectElement.setAttribute("aria-labelledby",label.id)}}function openSlimSelectOnLabelClick(autocompleteInput){var label=
|
||
document.querySelector('label[for="'+autocompleteInput.id+'"]');if(label){label.addEventListener("click",labelListener);function labelListener(){setTimeout(function(){autocompleteInput.slim.open()},0)}}}function isPreviousSelectedStar(input){return null!==input.getAttribute("data-frm-star-selected")}function loadStars(){if(isPreviousSelectedStar(this)){clearStars(this.parentElement,false);return}updateStars(this,true)}function hoverStars(){var input=this.previousSibling;if(input.checked||isPreviousSelectedStar(this))return;
|
||
updateStars(input,false)}function updateStars(hovered,onClick){var starGroup=hovered.parentElement,stars=starGroup.children,current=parseInt(hovered.value),starClass="star-rating",selectLabel=false;starGroup.className+=" frm-star-hovered";for(var i=0;i<stars.length;i++)if(stars[i].matches("."+starClass))if(selectLabel)stars[i].className+=" star-rating-hover";else stars[i].classList.remove("star-rating-hover","star-rating-on");else{selectLabel=parseInt(stars[i].value)<=current;if(onClick)stars[i].removeAttribute("data-frm-star-selected")}if(onClick)hovered.setAttribute("data-frm-star-selected",
|
||
"")}function unhoverStars(){var input=this.previousSibling,starGroup=input.parentElement;starGroup.classList.remove("frm-star-hovered");var stars=starGroup.children;var selected=jQuery(starGroup).find("input:checked").attr("id");var isSelected="";var starClass="star-rating";for(var i=stars.length-1;i>0;i--)if(stars[i].matches("."+starClass)){stars[i].classList.remove("star-rating-hover");if(isSelected===""&&typeof selected!=="undefined"&&stars[i].getAttribute("for")==selected)isSelected=" star-rating-on";
|
||
if(isSelected!=="")stars[i].className+=isSelected}}function clearStars(starGroup,noClearInput){var labels,input;labels=starGroup.querySelectorAll(".star-rating-on");if(labels&&labels.length)labels.forEach(function(el){el.classList.remove("star-rating-on")});if(!noClearInput){input=starGroup.querySelector('input[type="radio"]:checked');if(input){input.checked=false;input.removeAttribute("data-frm-star-selected")}}}function formatValueAsCurrency(value,fieldKey){const currency=getCurrencyFromCalcRule(__FRMCALC.calc[fieldKey]);
|
||
return(new DOMParser).parseFromString(formatCurrency(normalizeTotal(value,currency),currency),"text/html").documentElement.textContent}function handleSliderEvent(){if(this.type!=="range")return;const sliderValueEl=this.parentNode.querySelector(".frm_range_value");const fieldKey=getFieldKey(this.id,this.name);if(window.__FRMCALC?.calc[fieldKey])sliderValueEl.textContent=formatValueAsCurrency(this.value,fieldKey);else sliderValueEl.textContent=this.value}function loadSliders(){handleRangeSliders()}
|
||
function getCurrencyFromCalcRule(calcRule){return"undefined"!==typeof calcRule.custom_currency?calcRule.custom_currency:getCurrency(calcRule.form_id)}function setInlineFormWidth(){var children,f,inlineForm,inlineForms=jQuery(".frm_inline_form .frm_fields_container");if(inlineForms.length)for(f=0;f<inlineForms.length;f++){inlineForm=jQuery(inlineForms[f]);children=inlineForm.children(".frm_form_field");if(children.length<=12&&!fieldHasLayoutClass(children.last()))addAutoInlineLayout(inlineForm,children)}}
|
||
function fieldHasLayoutClass(field){var i,classList=field.attr("class"),layoutClasses=["frm_full","half","third","fourth","fifth","sixth","seventh","eighth"];if(typeof classList==="undefined")return false;for(i=1;i<=12;i++){if(field.hasClass("frm"+i))return true;if(i===12)for(var c=0;c<layoutClasses.length;c++){if(classList.indexOf(layoutClasses[c])!==-1)return true;if(c===layoutClasses.length-1)return false}}}function addAutoInlineLayout(inlineForm,children){var fieldCount,colCount,i;fieldCount=
|
||
children.length+1;colCount=Math.max(2,Math.ceil(12/fieldCount));for(i=0;i<children.length;i++)if(!fieldHasLayoutClass(jQuery(children[i])))jQuery(children[i]).addClass("frm"+colCount);inlineForm.children(".frm_submit").addClass("frm"+colCount)}function checkConditionalLogic(event){if(typeof __frmHideOrShowFields!=="undefined")frmProForm.hideOrShowFields(__frmHideOrShowFields,event);else showForm()}function showForm(){document.querySelectorAll(".frm_pro_form").forEach(form=>{jQuery(form).fadeIn("slow");
|
||
triggerEvent(form,"frmProAfterFormFadeIn")})}function checkDynamicFields(event){if(typeof __frmDepDynamicFields!=="undefined"){if("pageLoad"===event&&typeof __frmHideOrShowFields==="undefined")clearHideFields();frmProForm.checkDependentDynamicFields(__frmDepDynamicFields)}}function checkLookupFields(){if(typeof __frmDepLookupFields!=="undefined")frmProForm.checkDependentLookupFields(__frmDepLookupFields)}function triggerChange(input,fieldKey){if(typeof fieldKey==="undefined")fieldKey="dependent";
|
||
if(input.length>1)input=input.eq(0);input.trigger({type:"change",selfTriggered:true,frmTriggered:fieldKey})}function loadCustomInputMasks(){if(typeof __frmMasks==="undefined")return;var maskFields=__frmMasks;for(var i=0;i<maskFields.length;i++)jQuery(maskFields[i].trigger).attr("data-frmmask",maskFields[i].mask)}function getRepeatArgsFromFieldName(fieldName){var repeatArgs={repeatingSection:"",repeatRow:""};if(typeof fieldName!=="undefined"&&isRepeatingFieldByName(fieldName)){var inputNameParts=fieldName.split("][");
|
||
repeatArgs.repeatingSection=inputNameParts[0].replace("item_meta[","");repeatArgs.repeatRow=inputNameParts[1]}return repeatArgs}function fadeOut($remove){$remove.fadeOut("slow",function(){$remove.remove()})}function objectSearch(array,value){for(var prop in array)if(array.hasOwnProperty(prop))if(array[prop]===value)return prop;return null}function isNumeric(obj){return!Array.isArray(obj)&&obj-parseFloat(obj)+1>=0}function checkPasswordField(){var fieldId,fieldIdSplit,checks,split,suffix,check,span;
|
||
if(this.className.indexOf("frm_strength_meter")>-1){fieldId=this.name.substr(this.name.indexOf("[")+1).replace(/\]\[\d\]\[/,"-");if(fieldId[fieldId.length-1]==="]")fieldId=fieldId.substr(0,fieldId.length-1);fieldIdSplit=fieldId.split("-");if(fieldIdSplit.length===2)fieldId=fieldIdSplit[1]+"-"+fieldIdSplit[0];checks=passwordChecks();split=this.id.split("-");suffix=split.length>1&&!isNaN(split[split.length-1])?"-"+split[split.length-1]:"";for(check in checks){span=document.getElementById("frm-pass-"+
|
||
check+"-"+fieldId+suffix);addOrRemoveVerifyPass(checks[check],this.value,span)}}}function passwordChecks(){return{"eight-char":/^.{8,}$/,number:/\d/,uppercase:/[A-Z]/,lowercase:/[a-z]/,"special-char":/(?=.*[^a-zA-Z0-9])/}}function addOrRemoveVerifyPass(regEx,password,span){if(span!==null){var remove=regEx.test(password);if(remove)maybeRemovePassReq(span);else maybeRemovePassVerified(span)}}function maybeRemovePassReq(span){if(span.classList.contains("frm-pass-req")){span.classList.remove("frm-pass-req");
|
||
span.classList.add("frm-pass-verified")}}function maybeRemovePassVerified(span){if(span.classList.contains("frm-pass-verified")){span.classList.remove("frm-pass-verified");span.classList.add("frm-pass-req")}}function checkCheckboxSelectionLimit(){var limit=parseInt(this.getAttribute("data-frmlimit")),checked=this.checked;if(!limit)return;var allBoxes=jQuery(this).parents(".frm_opt_container").find('input[type="checkbox"]');if(limit>=allBoxes.length)return;var checkedBoxes=allBoxes.filter(function(){return this.checked});
|
||
if(checked){if(checkedBoxes.length>=limit)allBoxes.filter(function(){return!this.checked}).attr("disabled","disabled")}else allBoxes.prop("disabled",false)}function addTopAddRowBtnForRepeater(){jQuery('.frm_section_heading:has(div[class*="frm_repeat_"])').each(function(){const firstRepeatedSection=jQuery(this).find('div[class*="frm_repeat_"]').first()[0];const addButtonWrapper=document.createElement("div");addButtonWrapper.classList.add("frm_form_field","frm_hidden_container","frm_repeat_buttons",
|
||
"frm_hidden");const addButton=firstRepeatedSection.querySelector(".frm_add_form_row");if(addButton)addButtonWrapper.append(addButton.cloneNode(true));const buttonContainer=firstRepeatedSection.closest(".frm_toggle_container.frm_grid_container");if(buttonContainer)buttonContainer.prepend(addButtonWrapper);else firstRepeatedSection.parentNode.insertBefore(addButtonWrapper,firstRepeatedSection)})}function maybeDisableCheckboxesWithLimit(){jQuery('input[type="checkbox"][data-frmlimit]:not(:checked)').each(function(){var limit=
|
||
parseInt(this.getAttribute("data-frmlimit"));if(!limit)return;var allBoxes=jQuery(this).parents(".frm_opt_container").find('input[type="checkbox"]');if(limit>=allBoxes.length)return;var checkedBoxes=allBoxes.filter(function(){return this.checked});if(limit>checkedBoxes.length)return;this.setAttribute("disabled","disabled")})}function checkQuantityFieldMinMax(input){if(""===input.value)return 0;const val=parseFloat(input.value?input.value.trim():0);if(isNaN(val))return 0;let max=input.hasAttribute("max")?
|
||
parseFloat(input.getAttribute("max")):0;let min=input.hasAttribute("min")?parseFloat(input.getAttribute("min")):0;max=isNaN(max)?0:max;min=isNaN(min)?0:min<0?0:min;if(val<min){input.value=min;return min}if(0!==max&&val>max){input.value=max;return max}return val}function setHiddenProduct(input){input.setAttribute("data-frmhidden","1");triggerChange(jQuery(input))}function setHiddenProductContainer(container){if(container.innerHTML.indexOf("data-frmprice")!==-1)jQuery(container).find("input[data-frmprice], select:has([data-frmprice])").attr("data-frmhidden",
|
||
"1")}function setShownProduct(input){var wasHidden=input.getAttribute("data-frmhidden");if(wasHidden!==null){input.removeAttribute("data-frmhidden");triggerChange(jQuery(input))}}function calcProductsTotal(e){var formTotals=[],totalFields;if(typeof __FRMCURR==="undefined")return;if(undefined!==e&&"undefined"!==typeof e.target&&("keyup"===e.type||"change"===e.type)){var el=e.target;if(el.hasAttribute("data-frmprice")&&el instanceof HTMLInputElement&&"text"===el.type)el.setAttribute("data-frmprice",
|
||
el.value.trim())}totalFields=jQuery("[data-frmtotal]");if(!totalFields.length)return;totalFields.each(function(){var currency,formId,formatted,total=0,totalField=jQuery(this),$form=totalField.closest("form"),isRepeatingTotal=isRepeatingFieldByName(this.name);if(!$form.length)return;formId=$form.find('input[name="form_id"]').val();currency=getCurrency(formId);if(typeof formTotals[formId]!=="undefined"&&!isRepeatingTotal)total=formTotals[formId];else{$form.find("input[data-frmprice],select:has([data-frmprice])").each(function(){var quantity,
|
||
$this,price=0,isUserDef=false,isSingle=false;if(isRepeatingTotal&&!isRepeatingWithTotal(this,totalField[0]))return;if(this.hasAttribute("data-frmhigherpg")||isProductFieldHidden(this))return;if(this.tagName==="SELECT"){if(this.selectedIndex!==-1)price=this.options[this.selectedIndex].getAttribute("data-frmprice")}else{isUserDef="text"===this.type;isSingle="hidden"===this.type;$this=jQuery(this);if(!isUserDef&&!isSingle&&!$this.is(":checked"))return;price=this.getAttribute("data-frmprice")}if(!price)price=
|
||
0;else{price=preparePrice(price,currency);quantity=getQuantity(isUserDef,this);price=parseFloat(quantity)*parseFloat(price)}if("true"===this.getAttribute("data-frmdiscount"))price=price*-1;total+=price});if(!isRepeatingTotal)formTotals[formId]=total}total=isNaN(total)?0:total;currency.decimal_separator=currency.decimal_separator.trim();if(!currency.decimal_separator.length)currency.decimal_separator=".";total=normalizeTotal(total,currency);totalField.val(total);triggerChange(totalField);total=formatCurrency(total,
|
||
currency);formatted=totalField.prev(".frm_total_formatted");if(formatted.length<1)formatted=totalField.closest(".frm_form_field").find(".frm_total_formatted");if(formatted.length)formatted.html(total)})}function normalizeTotal(total,currency){const isLargeTotal=total>Number.MAX_SAFE_INTEGER;if(!isLargeTotal){const {decimals}=currency;total=decimals>0?Math.round10(total,decimals):Math.ceil(total)}return maybeAddTrailingZeroToPrice(total,currency,isLargeTotal)}function formatCurrency(total,currency){total=
|
||
maybeAddTrailingZeroToPrice(total,currency);if(total.length&&(total[total.length-1]==="."||total[total.length-1]===currency.decimal_separator))total=total.substr(0,total.length-1);total=maybeRemoveTrailingZerosFromPrice(total,currency);total=addThousands(total,currency);const leftSymbol=currency.symbol_left?currency.symbol_left+currency.symbol_padding:"";const rightSymbol=currency.symbol_right?currency.symbol_padding+currency.symbol_right:"";return leftSymbol+total+rightSymbol}function maybeRemoveTrailingZerosFromPrice(total,
|
||
currency){var split=total.split(currency.decimal_separator);if(2!==split.length||split[1].length<=currency.decimals)return total;if(0===currency.decimals)return split[0];return split[0]+currency.decimal_separator+split[1].substr(0,currency.decimals)}function addRteRequiredMessages(){var keys,length,index,key,field;if("undefined"===typeof __FRMRTEREQMESSAGES)return;keys=Object.keys(__FRMRTEREQMESSAGES);length=keys.length;for(index=0;index<length;++index){key=keys[index];field=document.getElementById(key);
|
||
if(field)field.setAttribute("data-reqmsg",__FRMRTEREQMESSAGES[key])}}function isProductFieldHidden(input){return input.getAttribute("data-frmhidden")!==null}function isRepeatingWithTotal(input,total){var regex=/item_meta\[.+?\]\[.+?\]/;return isRepeatingFieldByName(input.name)&&total.name.match(regex)[0]===input.name.match(regex)[0]}function getCurrency(formId){if(typeof __FRMCURR!=="undefined"&&typeof __FRMCURR[formId]!=="undefined")return __FRMCURR[formId]}function getQuantity(isUserDef,field){var quantity,
|
||
quantityFields,isRepeating,fieldID,$this=jQuery(field);fieldID=frmFrontForm.getFieldId(field,false);if(!fieldID)return 0;isRepeating=isRepeatingFieldByName(field.name);if(isRepeating){var match=field.name.match(/item_meta\[.+?\]\[.+?\]/);if(null===match)return 0;$this.nameMatch=match[0]}quantity=getQuantityField($this,fieldID,isRepeating);if(quantity)quantity=checkQuantityFieldMinMax(quantity);else{quantityFields=getQuantityFields($this,isRepeating);if(1===quantityFields.length&&""===quantityFields[0].getAttribute("data-frmproduct").trim())quantity=
|
||
checkQuantityFieldMinMax(quantityFields[0]);else quantity=1}if(0===quantity&&isUserDef)quantity=1;return quantity}function getQuantityField(elementObj,fieldID,isRepeating){var quantity,quantityFields=elementObj.closest("form").find("[data-frmproduct]");fieldID=fieldID.toString();quantityFields.each(function(){var ids;if(isRepeating&&-1===this.name.indexOf(elementObj.nameMatch))return true;ids=JSON.parse(this.getAttribute("data-frmproduct").trim());if(""===ids)return true;ids="string"===typeof ids?
|
||
[ids.toString()]:ids;if(ids.indexOf(fieldID)>-1){quantity=this;return false}});return quantity}function getQuantityFields(elementObj,isRepeating){var quantityFields;if(isRepeating)quantityFields=elementObj.closest("form").find('[name^="'+elementObj.nameMatch+'"]'+"[data-frmproduct]");else quantityFields=elementObj.closest("form").find('[data-frmproduct]:not([id*="-"])');return quantityFields}function preparePrice(price,currency){var matches;if(!price)return 0;price=price+"";const regex=getRegexForPrice(currency);
|
||
matches=price.match(regex);if(null===matches)return 0;price=matches.length?matches[matches.length-1]:0;price=price.trim();if(currency.decimal_separator==="."&&3===price.split(".").length&&price[0]===".")price=price.substr(1);if(price){price=maybeUseDecimal(price,currency);price=price.split(currency.thousand_separator).join("").replace(currency.decimal_separator,".")}return price}function getRegexForPrice(currency){let regexString="[0-9,.";if(currency.thousand_separator!=="."&¤cy.thousand_separator!==
|
||
",")regexString+=currency.thousand_separator;if(currency.decimal_separator!=="."&¤cy.decimal_separator!==",")regexString+=currency.decimal_separator;regexString+="]*\\.?\\,?[0-9]+";return new RegExp(regexString,"g")}function maybeUseDecimal(amount,currency){var usedForDecimal,amountParts;if(currency.thousand_separator=="."){amountParts=amount.split(".");usedForDecimal=2==amountParts.length&&2==amountParts[1].length;if(usedForDecimal)amount=amount.replace(".",currency.decimal_separator)}return amount}
|
||
function maybeAddTrailingZeroToPrice(price,currency,force=false){if("number"!==typeof price&&!force)return price;price+="";var pos=price.indexOf(".");if(pos===-1){price=price+".";for(let n=0;n<currency.decimals;++n)price+="0"}else{const decimalsString=price.substring(pos+1);if(decimalsString.length<currency.decimals){if(decimalsString.length<2)price+="0";for(let n=2;n<currency.decimals;++n)price+="0"}}return price.replace(".",currency.decimal_separator)}function addThousands(total,{decimal_separator,
|
||
thousand_separator}){const split=decimal_separator===""?[total.toString()]:total.split(decimal_separator);if(thousand_separator)split[0]=split[0].replace(/\B(?=(\d{3})+(?!\d))/g,thousand_separator);return split.join(decimal_separator)}function setAutoHeightForTextArea(){document.querySelectorAll(".frm-show-form textarea").forEach(function(element){var minHeight,callback;if(typeof element.dataset.autoGrow==="undefined"||element.getAttribute("frm-autogrow"))return;minHeight=getElementHeight(element);
|
||
element.style.overflowY="hidden";element.style.transition="none";callback=function(){adjustHeight(element,minHeight)};callback();element.addEventListener("input",callback);if(shouldCallResizeCallback())window.addEventListener("resize",callback);document.addEventListener("frmShowField",callback);element.setAttribute("frm-autogrow",1)})}function shouldCallResizeCallback(){if(!("userAgent"in navigator))return true;const userAgent=navigator.userAgent.toLowerCase();return userAgent.indexOf("android")===
|
||
-1&&userAgent.indexOf("iphone")===-1}function getElementHeight(element){var clone,container,height;clone=element.cloneNode(true);clone.style.position="absolute";clone.style.left="-10000px";clone.style.top="-10000px";container=jQuery(element).closest(".frm_forms").get(0);container.appendChild(clone);height=clone.clientHeight;container.removeChild(clone);return height}function adjustHeight(el,minHeight){if(minHeight>=el.scrollHeight)return;el.style.height=0;el.style.height=Math.max(minHeight,el.scrollHeight)+
|
||
"px"}function updateContentLength(){function onChange(e){var length,max,type,messageEl=e.target.nextElementSibling,countEl=messageEl.querySelector("span");if(!countEl)return;type=messageEl.getAttribute("data-max-type");max=parseInt(messageEl.getAttribute("data-max"));if("word"===type)length=e.target.value.split(/\s+/).filter(function(word){return word}).length;else length=e.target.value.length;countEl.innerText=length;messageEl.classList.toggle("frm_limit_error",length>max)}document.addEventListener("input",
|
||
function(e){var target;for(target=e.target;target&&target!=this;target=target.parentNode)if(target.matches("textarea")&&target.nextElementSibling&&target.nextElementSibling.matches(".frm_pro_max_limit_desc")){onChange(e);break}},false)}function triggerEvent(element,eventType,data){if("function"===typeof frmFrontForm.triggerCustomEvent)frmFrontForm.triggerCustomEvent(element,eventType,data)}function startOverButton(){function getInputs(formEl){return getInputsInFieldOnPage(formEl)}function resetInputs(formEl){var inputs=
|
||
getInputs(formEl);function resetRepeater(repeatBtns){var repeater,items;repeater=repeatBtns.parentElement;items=repeater.querySelectorAll(".frm_repeat_sec, .frm_repeat_inline, .frm_repeat_grid");if(!items.length){currentlyAddingRow=false;repeatBtns.querySelector(".frm_add_form_row").click()}else if(items.length>1)items.forEach(function(item,index){if(index)item.parentElement.removeChild(item);else item.querySelector(".frm_add_form_row").classList.remove("frm_hide_add_button")})}formEl.querySelectorAll(".frm_section_heading > .frm_repeat_buttons").forEach(resetRepeater);
|
||
clearValueForInputs(inputs,"",true);inputs.forEach(function(input){if(input.disabled&&input.getAttribute("data-frmlimit"))input.removeAttribute("disabled")})}function isMultiPagesForm(formId){return document.getElementById("frm_page_order_"+formId)||document.querySelector("#frm_form_"+formId+'_container input[name="frm_next_page"]')}function reloadForm(formId,formEl){const stateField=document.querySelector('input[name="frm_state"]');const state=null!==stateField?stateField.value:"";formEl.classList.add("frm_loading_form");
|
||
postToAjaxUrl(formEl,{action:"frm_load_form",form:formId,_ajax_nonce:frm_js.nonce,frm_state:state},function(response){var idValueMapping;if(!response.success){console.log(response);return}idValueMapping=getDefaultValuesFromForm(formEl);jQuery(formEl.closest(".frm_forms")).replaceWith(response.data);setDefaultValues(idValueMapping);maybeShowMoreStepsButton();if("undefined"!==typeof __frmAjaxDropzone)window.__frmDropzone=__frmAjaxDropzone;checkConditionalLogic("pageLoad");checkFieldsOnPage("frm_form_"+
|
||
formId+"_container");triggerCompletedEvent(formId)},function(response){console.log(response)})}function getDefaultValuesFromForm(formEl){var inputs,values={};inputs=formEl.querySelectorAll("[data-frmval]");inputs.forEach(function(input){values[input.id]=input.getAttribute("data-frmval")});return values}function setDefaultValues(idValueMapping){Object.keys(idValueMapping).forEach(function(id){var input=document.getElementById(id);if(!input)return;input.setAttribute("data-frmval",idValueMapping[id]);
|
||
if("checkbox"===input.type||"radio"===input.type){if(input.value===idValueMapping[id])input.checked=true;return}input.value=idValueMapping[id]})}function hasSaveDraft(formEl){return!!formEl.querySelector(".frm_save_draft")}function deleteDraft(formId,formEl){postToAjaxUrl(formEl,{action:"frm_delete_draft_entry",form:formId,_ajax_nonce:frm_js.nonce})}function onClickStartOver(e){e.preventDefault();var formEl,formId,draftIdInput;formEl=e.target.closest("form");if(!formEl)return;formId=formEl.querySelector('input[name="form_id"]').value;
|
||
if(hasSaveDraft(formEl)){deleteDraft(formId,formEl);draftIdInput=formEl.querySelector('input[name="id"]');if(draftIdInput)draftIdInput.remove();formEl.querySelector('input[name="frm_action"]').value="create"}if(isMultiPagesForm(formId))reloadForm(formId,formEl);else{resetInputs(formEl);triggerCompletedEvent(formId)}}function triggerCompletedEvent(formId){triggerEvent(document,"frm_after_start_over",{formId:formId})}document.addEventListener("click",function(e){var target;for(target=e.target;target&&
|
||
target!=this;target=target.parentNode)if(target.matches(".frm_start_over")){onClickStartOver.call(target,e);break}},false)}function maybeShowMoreStepsButton(){var i,listWrappers,listWrapper,rootlineSteps,wrappingElementsCount,startIndex,hiddenSteps,showMoreButtonLi,showMoreButton,hiddenStepsWrapper,oldIE;listWrappers=document.getElementsByClassName("frm_rootline");copyRootlines(listWrappers);oldIE=isOldIEVersion(10);for(i=0;i<listWrappers.length;i++){listWrapper=listWrappers[i];if(oldIE){listWrapper.className+=
|
||
" frm_hidden";continue}rootlineSteps=listWrapper.children;wrappingElementsCount=countOverflowPages(rootlineSteps);if(!wrappingElementsCount)continue;showMoreButton=listWrapper.querySelector(".frm_rootline_show_more_btn");if(!showMoreButton)continue;showMoreButton.addEventListener("click",showMoreSteps);showMoreButtonLi=showMoreButton.parentNode;showMoreButtonLi.className=showMoreButtonLi.className.replace(" frm_hidden","");startIndex=rootlineSteps.length-wrappingElementsCount>1?rootlineSteps.length-
|
||
wrappingElementsCount-3:0;hiddenSteps=[].slice.call(rootlineSteps,Math.max(startIndex,1),rootlineSteps.length-2);hiddenStepsWrapper=showMoreButtonLi.querySelector(".frm_rootline_hidden_steps");hiddenSteps.forEach(function(hiddenStep){hiddenStepsWrapper.appendChild(hiddenStep)});moveRootlineTitles(hiddenStepsWrapper,listWrapper,showMoreButton);listWrapper.insertBefore(showMoreButtonLi,listWrapper.children[listWrapper.children.length-1]);if(listWrapper.children[listWrapper.children.length-1].className.indexOf("frm_current_page")!==
|
||
-1)updateRootlineStyle(hiddenStepsWrapper)}}function isOldIEVersion(max){var version,myNav=navigator.userAgent.toLowerCase();version=myNav.indexOf("msie")!==-1?parseInt(myNav.split("msie")[1]):false;return version!==false&&max>=version}function countOverflowPages(rootlineSteps){var j,wrappingElementsCount=0;for(j=0;j<rootlineSteps.length;j++)if(rootlineSteps[j].offsetTop!==rootlineSteps[0].offsetTop&&rootlineSteps[j].className.indexOf("frm_rootline_show_hidden_steps_btn")===-1)wrappingElementsCount++;
|
||
return wrappingElementsCount}function moveRootlineTitles(hiddenStepsWrapper,listWrapper,showMoreButton){var currentPageTitle,currentStepTitle,rootlineGroup,activeHiddenStepLink=hiddenStepsWrapper.querySelector("input:not(.frm_page_back):not(.frm_page_skip)");if(activeHiddenStepLink){currentPageTitle=activeHiddenStepLink.parentElement.querySelector(".frm_rootline_title");maybeUpdateRootlineTitles(activeHiddenStepLink.parentElement.previousElementSibling,hiddenStepsWrapper);showMoreButton.parentElement.className+=
|
||
" active";showMoreButton.className+=" active"}else currentPageTitle=listWrapper.querySelector(".frm_current_page").querySelector(".frm_rootline_title");if(!currentPageTitle)return;currentStepTitle=currentPageTitle.textContent;if(!currentStepTitle)return;rootlineGroup=listWrapper.closest(".frm_rootline_group");showCurrentHiddenStepText(currentStepTitle)}function showCurrentHiddenStepText(currentStepTitle){var rootlineCurrentStep=document.createElement("span");rootlineCurrentStep.className="frm_rootline_title";
|
||
rootlineCurrentStep.textContent=currentStepTitle;document.querySelector(".frm_rootline_show_hidden_steps_btn").appendChild(rootlineCurrentStep)}function copyRootlines(listWrappers){var i,listWrappers,listWrapper,rootlinesBackup;rootlinesBackup={};for(i=0;i<listWrappers.length;i++){listWrapper=listWrappers[i];rootlinesBackup[listWrapper.closest("form").getAttribute("id")]=listWrapper.cloneNode(true)}listWrappersOriginal=rootlinesBackup}function maybeUpdateRootlineTitles(previousPageLink,hiddenStepsWrapper){var i;
|
||
if(previousPageLink){i=0;while(previousPageLink){i++;previousPageLink=previousPageLink.previousElementSibling}updateRootlineStyle(hiddenStepsWrapper,i)}}function updateRootlineStyle(hiddenStepsWrapper,uptoIndex){var rootlineTitles,rootlineTitle;if(!uptoIndex)uptoIndex=hiddenStepsWrapper.children.length;rootlineTitles=[].slice.call(hiddenStepsWrapper.children,0,uptoIndex);rootlineTitles.forEach(function(el){rootlineTitle=el.querySelector(".frm_rootline_title");if(rootlineTitle)rootlineTitle.className+=
|
||
" frm_prev_page_title"})}function showMoreSteps(e){var hiddenStepsWrapper=e.target.parentElement.querySelector("ul");if(hiddenStepsWrapper.className.indexOf("frm_hidden")>-1)hiddenStepsWrapper.className=hiddenStepsWrapper.className.replace(" frm_hidden","");else hiddenStepsWrapper.className+=" frm_hidden"}function validateForm(){document.addEventListener("frm_get_ajax_form_errors",function(event){if(!event.frmData.formEl)return;validateCheckboxMinSelections(event.frmData.formEl,event.frmData.errors)})}
|
||
function validateCheckboxMinSelections(formEl,errors){var checkboxes,checkedField={},errorMsg=frmCheckboxI18n.errorMsg.min_selections;if("function"===typeof formEl.get)formEl=formEl.get(0);checkboxes=formEl.querySelectorAll('input[type="checkbox"][data-frmmin]:checked');checkboxes.forEach(function(checkbox){var min,fieldEl,checkedCheckboxes,key;min=parseInt(checkbox.dataset.frmmin,10);if(!min)return;fieldEl=checkbox.closest(".frm_form_field");key=fieldEl.id.replace("frm_field_","").replace("_container",
|
||
"");if(checkedField[key])return;checkedCheckboxes=fieldEl.querySelectorAll('input[type="checkbox"]:checked');if(!checkedCheckboxes.length)return;if(checkedCheckboxes.length<min)errors[key]=errorMsg.replace("%1$d",min).replace("%2$d",checkedCheckboxes.length);checkedField[key]=true})}function validateFieldValue(){document.addEventListener("frm_validate_field_value",function(event){if("object"!==typeof event.frmData.field||"object"!==typeof event.frmData.errors)return;if("password"===event.frmData.field.type)validatePasswordStrength(event.frmData.field,
|
||
event.frmData.errors)})}function validatePasswordStrength(field,errors){var check,regex,checks;if("object"!==typeof window.frm_password_checks)return;if(-1===field.className.indexOf("frm_strong_pass")||0===field.id.indexOf("field_conf_"))return;checks=window.frm_password_checks;for(check in checks){regex=checks[check].regex.slice(1,checks[check].regex.length-1);regex=new RegExp(regex);if(!regex.test(field.value)){errors[frmFrontForm.getFieldId(field)]=checks[check].message;return}}}function maybeTriggerCalc(event){if(event.persisted||
|
||
window.performance&&window.performance.getEntriesByType("navigation")[0].type==="back_forward")triggerCalc()}function showMoreStepsButtonEvents(){var timeout;window.addEventListener("resize",function(){var i,listWrappers,listWrapper,form;listWrappers=document.getElementsByClassName("frm_rootline");for(i=0;i<listWrappers.length;i++){listWrapper=listWrappers[i];form=listWrapper.closest("form");form.querySelector(".frm_rootline_group").replaceChild(listWrappersOriginal[form.getAttribute("id")],listWrapper)}clearTimeout(timeout);
|
||
timeout=setTimeout(maybeShowMoreStepsButton(),100)})}function handleShowPasswordBtn(){documentOn("click",".frm_show_password_btn",function(event){var input=event.target.closest(".frm_show_password_wrapper").querySelector("input"),button=input.nextElementSibling;if("password"===input.type){input.type="text";button.setAttribute("data-show-password-label",button.title);button.title=button.getAttribute("data-hide-password-label")}else{input.type="password";button.title=button.getAttribute("data-show-password-label")}button.setAttribute("aria-label",
|
||
button.title)})}function handleRangeSliders(){document.querySelectorAll(".frm_range_container").forEach(function(rangeContainer){const rangeInput=rangeContainer.querySelector('input[type="hidden"]');if(!rangeInput||rangeInput.dataset.isRangeSliderInitialized)return;initializeRangeSlider(rangeInput,rangeContainer)})}function documentOn(event,selector,handler,options){if("undefined"===typeof options)options=false;document.addEventListener(event,function(e){var target;for(target=e.target;target&&target!=
|
||
this;target=target.parentNode)if(target&&target.matches&&target.matches(selector)){handler.call(target,e);break}},options)}function handleElementorPopupConflicts(){var elementorPopupWrapper=document.querySelector(".elementor-popup-modal");if(null!==elementorPopupWrapper){elementorPopupWrapper.querySelectorAll(".frm_dropzone").forEach(function(item){item.classList.remove("dz-clickable")});elementorPopupWrapper.querySelectorAll(".frm_form_field .chosen-container").forEach(function(chosenContainer){chosenContainer.remove()})}loadDropzones();
|
||
loadAutocomplete()}function getAllFormClasses(input){var formContainer,formClasses;formContainer=input.closest(".with_frm_style");if(!formContainer)return[];formClasses=[];Array.prototype.forEach.call(formContainer.className.split(" "),function(className){var trimmedClassName=className.trim();if(""!==trimmedClassName&&"frm_forms"!==trimmedClassName)formClasses.push(trimmedClassName)});return formClasses}function maybeAddIntlTelInput(phoneInputs){if(document.body.classList.contains("wp-admin")||typeof window.intlTelInput!==
|
||
"function")return;phoneInputs.forEach(function(phoneInput){const parentContainer=document.createElement("div");parentContainer.classList.add("frm_forms","with_frm_style");document.body.appendChild(parentContainer);const intlPhoneConfig={initialCountry:"auto",formatOnDisplay:false,dropdownContainer:parentContainer,geoIpLookup:function(callback){if("function"===typeof window.fetch)fetch("https://ipapi.co/json").then(function(res){return res.json()}).then(function(data){callback(data.country_code)}).catch(function(){callback("us")})},
|
||
loadUtils:()=>import((getProPluginUrl()+"/js/intl-tel-input-utils.min.js"))};if(phoneInput.dataset.onlyCountries){intlPhoneConfig.onlyCountries=phoneInput.dataset.onlyCountries.split(",");if(1===intlPhoneConfig.onlyCountries.length){intlPhoneConfig.initialCountry=intlPhoneConfig.onlyCountries[0];intlPhoneConfig.allowDropdown=false}}if(phoneInput.dataset.countryOrder)intlPhoneConfig.countryOrder=phoneInput.dataset.countryOrder.split(",");const intlTelInputInstance=window.intlTelInput(phoneInput,intlPhoneConfig);
|
||
phoneInput.addEventListener("countrychange",function(){if(!this.value)return;this.dispatchEvent(new Event("change",{bubbles:true}))});phoneInput.addEventListener("blur",function(){if(phoneInput.dataset.numberFormat)phoneInput.value=intlTelInputInstance.getNumber(determineNumberFormat(phoneInput.dataset.numberFormat));else phoneInput.value=intlTelInputInstance.getNumber()});intlPhoneInputs[phoneInput.id]=intlTelInputInstance})}function determineNumberFormat(numberFormat){numberFormat=numberFormat.toLowerCase();
|
||
const map={e164:0,international:1,national:2,rfc3966:3};return map[numberFormat]??0}function maybeUpdateFormsOverflowX(){document.querySelectorAll(".frm-show-form").forEach(function(slideinForm){slideinForm.style["overflow-x"]="visible"})}function initRangeInput(rangeInputs){rangeInputs.forEach(function(rangeInput){updateRangeInputBackground(rangeInput);rangeInput.addEventListener("input",function(){updateRangeInputBackground(rangeInput)});rangeInput.addEventListener("onchange",function(){updateRangeInputBackground(rangeInput)})});
|
||
function updateRangeInputBackground(rangeInput){const sliderValuePercent=(rangeInput.value-rangeInput.min)/(rangeInput.max-rangeInput.min)*100;rangeInput.style.background=`linear-gradient(to right, var(--slider-color) 0%, var(--slider-color) ${sliderValuePercent}%, var(--slider-bar-color) ${sliderValuePercent}% 100%)`}}function initFormatFieldValueNumbers(){document.querySelectorAll(".frm-has-number-format:not([data-has-number-format-events])").forEach(field=>{field.dataset.hasNumberFormatEvents=
|
||
true;document.addEventListener("frmShowField",()=>onShowField(field));field.addEventListener("focus",handleFocus);field.addEventListener("blur",handleBlur);if(field.classList.contains("frm_field_number"))field.addEventListener("keydown",restrictToNumericInput);triggerFormatting(field)});function triggerFormatting(field){field.dispatchEvent(new Event("blur",{bubbles:true}))}function onShowField(field){if(!field.offsetHeight||field.value!=="")return;const {rawValue,frmval}=field.dataset;const valueToUse=
|
||
rawValue||frmval;if(valueToUse??false){field.value=valueToUse;triggerFormatting(field)}}function handleFocus({target:field}){const {rawValue}=field.dataset;if(rawValue!==null)field.value=rawValue}function handleBlur({target:field}){const previousValue=field.value;const previousRawValue=field.getAttribute("data-raw-value")??"";const fieldKey=getFieldKey(field.id,field.name);const userTyped=field.value;field.setAttribute("data-raw-value",userTyped);field.value=applyNumberFormatting(userTyped,fieldKey);
|
||
if(previousValue!==field.value||previousRawValue!==userTyped)field.dispatchEvent(new Event("change",{bubbles:true}))}function restrictToNumericInput(event){const {target:field,key,ctrlKey,metaKey}=event;const fieldKey=getFieldKey(field.id,field.name);const formatConfig=getCurrencyFromCalcRule(__FRMCALC.calc?.[fieldKey])||{};const decimalSeparator=formatConfig.decimal_separator??".";const thousandSeparator=formatConfig.thousand_separator??"";const decimals=parseInt(formatConfig.decimals??2,10);const allowedKeys=
|
||
["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Tab","Home","End","Enter"];if(allowedKeys.includes(key)||ctrlKey||metaKey)return;let regexPattern="^[0-9\\+\\-";if(decimals>0)regexPattern+=escapeForRegex(decimalSeparator);if(thousandSeparator)regexPattern+=escapeForRegex(thousandSeparator);regexPattern+="]$";const oneCharRegex=new RegExp(regexPattern);if(!oneCharRegex.test(key)){event.preventDefault();return}if(decimals===0&&key===(decimalSeparator!==""?decimalSeparator:".")){event.preventDefault();
|
||
return}if(key===decimalSeparator&&field.value.includes(decimalSeparator)){event.preventDefault();return}if((key==="+"||key==="-")&&field.selectionStart!==0)event.preventDefault()}function applyNumberFormatting(text,fieldKey){if(!__FRMCALC?.calc?.[fieldKey])return text;const formatConfig=getCurrencyFromCalcRule(__FRMCALC.calc[fieldKey]);const {decimal_separator:decimalSeparator=".",thousand_separator:thousandSeparator=",",symbol_left:symbolLeft="",symbol_right:symbolRight="",symbol_padding:symbolPadding=
|
||
""}=formatConfig;const escapedDecimalSeparator=escapeForRegex(decimalSeparator);const escapedThousandSeparator=escapeForRegex(thousandSeparator);const escapedSymbolLeft=escapeForRegex(symbolLeft);const escapedSymbolRight=escapeForRegex(symbolRight);const escapedSymbolPadding=escapeForRegex(symbolPadding);let pattern="(?<!\\S)";if(symbolLeft)pattern+=`(?:${escapedSymbolLeft}${symbolPadding?escapedSymbolPadding:""})?`;pattern+=`([-+]?\\d+(?:${escapedThousandSeparator}\\d+)*(?:${escapedDecimalSeparator}\\d+)?)`;
|
||
if(symbolRight)pattern+=`(?:${symbolPadding?escapedSymbolPadding:""}${escapedSymbolRight})?`;pattern+="(?!\\S)";const numericRegex=new RegExp(pattern,"g");return text.replace(numericRegex,match=>{const sign=match.startsWith("-")?"-":match.startsWith("+")?"+":"";const signRemoved=match.replace(/^[-+]/,"");const number=stripSymbolsAndFormatNumber(signRemoved,formatConfig);const formatted=formatCurrency(normalizeTotal(number,formatConfig),formatConfig);return`${sign}${formatted}`})}function stripSymbolsAndFormatNumber(value,
|
||
config={}){const {symbol_left:symbolLeft="",symbol_right:symbolRight="",decimal_separator:decimalSeparator=".",thousand_separator:thousandSeparator=","}=config;let cleanedValue=value.trim();if(symbolLeft)cleanedValue=cleanedValue.replace(symbolLeft,"");if(symbolRight)cleanedValue=cleanedValue.replace(symbolRight,"");cleanedValue=cleanedValue.trim();if(thousandSeparator){const split=cleanedValue.split(thousandSeparator);if(split.length!==2||split[1].length>2)cleanedValue=split.join("");else cleanedValue=
|
||
split[0]+"."+split[1]}if(decimalSeparator.trim()&&decimalSeparator!==".")cleanedValue=cleanedValue.split(decimalSeparator).join(".");return cleanedValue.trim()}function escapeForRegex(str){return str.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}}function initializeRangeSlider(rangeInput,rangeContainer){const parseDataset=dataset=>{const parsed={};for(const [key,value]of Object.entries(dataset))parsed[key]=parseFloat(value,10);return parsed};const {minGap,maxGap}=parseDataset(rangeInput.dataset);const min=
|
||
parseFloat(rangeInput.min,10);const max=parseFloat(rangeInput.max,10);const minRange=minGap||0;const maxRange=maxGap||max-min;if(min>=max)throw new Error("Min value must be less than max value");if(minRange<=0||minRange>max-min)throw new Error("Invalid minimum range value");if(maxRange<minRange||maxRange>max-min)throw new Error("Invalid maximum range value");const values=rangeInput.value.split(",");values[0]=values[0]||min;values[1]=values[1]||max;const step=parseFloat(rangeInput.step,10);const sliderRange=
|
||
max-min;const stepInPercent=step/sliderRange*100;const minRangePercent=minRange/sliderRange*100;const maxRangePercent=maxRange/sliderRange*100;const minHandle=rangeContainer.querySelector(".min-handle");const maxHandle=rangeContainer.querySelector(".max-handle");const rangeElement=rangeContainer.querySelector(".frm-slider-range");const minValueDisplay=rangeContainer.querySelector(".min-value");const maxValueDisplay=rangeContainer.querySelector(".max-value");const track=rangeContainer.querySelector(".frm-slider-track");
|
||
let decimalsToUse=0;[step,min,max,minRange,maxRange].forEach(value=>{const decimal=countDecimals(value);if(decimal>decimalsToUse)decimalsToUse=decimal});const initialMinValue=Math.max(values[0],min);const initialMaxValue=Math.min(values[1],initialMinValue+maxRange,max);const getWidthWithHiddenParent=element=>{if(!element.isConnected)return 0;if(element.closest(".frm_form_field").style.display!=="none"&&element.closest(".frm_toggle_container.frm_grid_container")?.style.display!=="none"){const trackRect=
|
||
track.getBoundingClientRect();return trackRect.width}const originalParent=element.parentNode;const originalNextSibling=element.nextSibling;document.body.appendChild(element);const width=element.offsetWidth;if(originalNextSibling)originalParent.insertBefore(element,originalNextSibling);else originalParent.appendChild(element);return width};let trackWidth=getWidthWithHiddenParent(track);let minPos=(initialMinValue-min)/sliderRange*100;let maxPos=(initialMaxValue-min)/sliderRange*100;updateHandlesPositionAndValue();
|
||
window.addEventListener("resize",function(){trackWidth=getWidthWithHiddenParent(track)});let isDragging=false;let activeHandle=null;let startX=0;let startMinPos=0;let startMaxPos=0;setupHandle(minHandle);setupHandle(maxHandle);rangeInput.addEventListener("change",setHandlesBasedOnValue);function setupHandle(handle){handle.addEventListener("touchstart",handleTouchStart,{passive:false});handle.addEventListener("mousedown",handleMouseDown)}function handleTouchStart(e){isDragging=true;activeHandle=e.target;
|
||
const touch=e.touches[0];startX=touch.clientX;startMinPos=minPos;startMaxPos=maxPos;document.addEventListener("touchmove",handleTouchMove,{passive:false});document.addEventListener("touchend",handleTouchEnd);e.preventDefault()}function handleMouseDown(e){isDragging=true;activeHandle=e.target;startX=e.clientX;startMinPos=minPos;startMaxPos=maxPos;document.addEventListener("mousemove",onMouseMove);document.addEventListener("mouseup",onMouseUp);e.preventDefault()}function handleTouchMove(e){if(!isDragging)return;
|
||
const touch=e.touches[0];const mouseEvent=new MouseEvent("mousemove",{clientX:touch.clientX,clientY:touch.clientY});onMouseMove(mouseEvent,e);e.preventDefault()}function handleTouchEnd(){document.removeEventListener("touchmove",handleTouchMove);document.removeEventListener("touchend",handleTouchEnd)}function onMouseMove(e){if(!isDragging)return;const deltaX=e.clientX-startX;const deltaPercent=deltaX/trackWidth*100;const minHandleIsMoved=activeHandle===minHandle;let newMinPos,newMaxPos,hasMovedMinimumSteps;
|
||
if(minHandleIsMoved){newMinPos=startMinPos+deltaPercent;hasMovedMinimumSteps=Math.abs(newMinPos-minPos)>=stepInPercent}else{newMaxPos=startMaxPos+deltaPercent;hasMovedMinimumSteps=Math.abs(newMaxPos-maxPos)>=stepInPercent}if(!hasMovedMinimumSteps)return;const movingRight=minHandleIsMoved?newMinPos>minPos:newMaxPos>maxPos;const numberOfNewSteps=movingRight?Math.floor(deltaPercent/stepInPercent):Math.ceil(deltaPercent/stepInPercent);const newRange=activeHandle===minHandle?maxPos-newMinPos:newMaxPos-
|
||
minPos;const stepsDelta=numberOfNewSteps*stepInPercent;if(activeHandle===minHandle){if(newRange<minRangePercent){const tempMinPos=Math.max(startMinPos+stepsDelta,0);if(tempMinPos+minRangePercent<=100){minPos=tempMinPos;maxPos=Math.max(0,minPos+minRangePercent)}}else if(newRange>maxRangePercent){minPos=Math.max(0,startMinPos+stepsDelta);maxPos=minPos+maxRangePercent}else minPos=Math.max(0,startMinPos+stepsDelta);updateHandlesPositionAndValue();return}if(newRange<minRangePercent){const tempMaxPos=Math.min(startMaxPos+
|
||
stepsDelta,100);if(tempMaxPos-minRangePercent>=0){maxPos=tempMaxPos;minPos=Math.max(0,maxPos-minRangePercent)}}else if(newRange>maxRangePercent){maxPos=Math.min(100,startMaxPos+stepsDelta);minPos=maxPos-maxRangePercent}else maxPos=Math.min(100,startMaxPos+stepsDelta);updateHandlesPositionAndValue()}function updateHandlesPositionAndValue(){minPos=parseFloat(minPos);maxPos=parseFloat(maxPos);minHandle.style.left=`${minPos}%`;maxHandle.style.right=`${100-maxPos}%`;updateRangeElement();const {currentMin,
|
||
currentMax}=prepareCurrentValues();updateDisplayedValues(currentMin,currentMax);rangeContainer.querySelector("input").value=`${currentMin},${currentMax}`}function countDecimals(num){const str=num.toString();const decimalIndex=str.indexOf(".");return decimalIndex===-1?0:str.length-decimalIndex-1}function formatSliderValue(value){const fieldKey=getFieldKey(rangeInput.id,rangeInput.name);if(window.__FRMCALC?.calc[fieldKey])return formatValueAsCurrency(value,fieldKey);return value}function updateDisplayedValues(currentMin,
|
||
currentMax){minValueDisplay.textContent=formatSliderValue(currentMin);maxValueDisplay.textContent=formatSliderValue(currentMax)}function prepareCurrentValues(){let currentMin=(min+minPos/stepInPercent*step).toFixed(decimalsToUse);let currentMax=(min+maxPos/stepInPercent*step).toFixed(decimalsToUse);currentMin=Number(currentMin).toPrecision().toString();currentMax=Number(currentMax).toPrecision().toString();return{currentMin,currentMax}}function onMouseUp(){isDragging=false;document.removeEventListener("mousemove",
|
||
onMouseMove);document.removeEventListener("mouseup",onMouseUp)}function updateRangeElement(){rangeElement.style.left=`${minPos}%`;rangeElement.style.width=`${maxPos-minPos}%`}function setHandlesBasedOnValue(){const {minGap}=parseDataset(rangeInput.dataset);const min=parseFloat(rangeInput.min,10);const max=parseFloat(rangeInput.max,10);const minRange=minGap||0;const sliderRange=max-min;const values=rangeInput.value.split(",");values[0]=values[0]||min;values[1]=values[1]||max;const initialMinValue=
|
||
Math.max(values[0],min);const initialMaxValue=Math.min(Math.max(values[1],initialMinValue+minRange),max);minPos=(initialMinValue-min)/sliderRange*100;maxPos=(initialMaxValue-min)/sliderRange*100;updateHandlesPositionAndValue()}}return{init:function(){maybeUpdateFormsOverflowX();maybeAddIntlTelInput(document.querySelectorAll(".frm-intl-tel-input"));initRangeInput(document.querySelectorAll(".with_frm_style input[type=range]"));initFormatFieldValueNumbers();addEventListener("pageshow",maybeTriggerCalc);
|
||
jQuery(document).on("frmFormComplete",afterFormSubmitted);jQuery(document).on("frmPageChanged",afterPageChanged);jQuery(document).on("frmAfterAddRow frmAfterRemoveRow",calcProductsTotal);jQuery(document).on("click",".frm_trigger",toggleSection);jQuery(document).on("keydown",".frm_trigger",toggleSection);var $blankField=jQuery(".frm_blank_field");if($blankField.length)$blankField.closest(".frm_toggle_container").prev(".frm_trigger").trigger("click");jQuery(document).on("click",".frm_remove_link",removeFile);
|
||
jQuery(document).on("frmFieldChanged",maybeCheckDependent);jQuery(document).on("keyup","input.frm_strength_meter",checkPasswordField);jQuery(document).on("keydown",".frm_switch",triggerToggleClickOnSpace);jQuery(document).on("mouseenter click",".frm-star-group input",loadStars);jQuery(document).on("mouseenter",".frm-star-group .star-rating:not(.star-rating-readonly)",hoverStars);jQuery(document).on("mouseleave",".frm-star-group .star-rating:not(.star-rating-readonly)",unhoverStars);jQuery(document).on("click",
|
||
'.frm-show-form input[type="submit"], .frm-show-form input[name="frm_prev_page"], .frm_page_back, .frm_page_skip, .frm-show-form .frm_save_draft, .frm_prev_page, .frm_button_submit, .frm_rootline_show_hidden_steps_btn .frm_rootline_single',setNextPage);jQuery(document).on("change",'.frm_other_container input[type="checkbox"], .frm_other_container input[type="radio"], .frm_other_container select',showOtherText);jQuery(document).on("change",'.frm_switch_block input[type="checkbox"]',setToggleAriaChecked);
|
||
jQuery(document).on("click",".frm_remove_form_row",removeRow);jQuery(document).on("click",".frm_add_form_row",addRow);jQuery(document).on("click",".frm_edit_link_container a.frm_inplace_edit",editEntry);jQuery(document).on("click",".frm_edit_link_container a.frm_cancel_edit",cancelEdit);jQuery(document).on("click",".frm_ajax_delete",deleteEntry);jQuery(".frm_month_heading, .frm_year_heading").on("click",function(){var content=jQuery(this).children(".ui-icon-triangle-1-e, .ui-icon-triangle-1-s");if(content.hasClass("ui-icon-triangle-1-e")){content.addClass("ui-icon-triangle-1-s").removeClass("ui-icon-triangle-1-e");
|
||
jQuery(this).next(".frm_toggle_container").fadeIn("slow")}else{content.addClass("ui-icon-triangle-1-e").removeClass("ui-icon-triangle-1-s");jQuery(this).next(".frm_toggle_container").hide()}});jQuery(document).on("elementor/popup/show",handleElementorPopupConflicts);addTopAddRowBtnForRepeater();jQuery(document).on("click",'input[type="checkbox"][data-frmlimit]',checkCheckboxSelectionLimit);jQuery(document).on("change",'[type="checkbox"][data-frmprice],[type="radio"][data-frmprice],[type="hidden"][data-frmprice],select:has([data-frmprice])',
|
||
calcProductsTotal);jQuery(document).on("keyup change",'[data-frmproduct],[type="text"][data-frmprice]',calcProductsTotal);jQuery(document).on("frmFormComplete frmPageChanged frmInPlaceEdit frmAfterAddRow",setAutoHeightForTextArea);maybeDisableCheckboxesWithLimit();setInlineFormWidth();checkConditionalLogic("pageLoad");checkFieldsOnPage(undefined,"pageLoad");processPendingAjax();addRteRequiredMessages();setAutoHeightForTextArea();updateContentLength();calcProductsTotal();startOverButton();maybeShowMoreStepsButton();
|
||
showMoreStepsButtonEvents();validateFieldValue();validateForm();handleShowPasswordBtn();jQuery(document).on("input change","input[data-frmrange]",handleSliderEvent)},savingDraft:function(object){return savingDraftEntry(object)},goingToPreviousPage:function(object){return goingToPrevPage(object)},hideOrShowFields:function(ids,event){if("pageLoad"===event)clearHideFields();var len=ids.length,repeatArgs={repeatingSection:"",repeatRow:""};for(var i=0,l=len;i<l;i++){hideOrShowFieldById(ids[i],repeatArgs);
|
||
if(i==l-1)showForm()}},hidePreviouslyHiddenFields:function(){var hiddenFields=getAllHiddenFields(),len=hiddenFields.length;for(var i=0,l=len;i<l;i++){var container=document.getElementById(hiddenFields[i]);if(container==null){container=document.querySelector("#"+hiddenFields[i]);if(container!=null&&hiddenFields[i].indexOf("frm_final_submit")>-1){hidePreviouslyHiddenSubmitButton(hiddenFields[i]);continue}}if(container!==null){container.style.display="none";setHiddenProductContainer(container)}}},submitAllowed:function(object){var formElementId=
|
||
object.getAttribute("id");if(!isSubmitButtonOnPage(formElementId+" .frm_final_submit")||goingToPrevPage(object)||savingDraftEntry(object))return true;var formKey=getFormKeyFromFormElementID(formElementId);return!isOnPageSubmitButtonHidden(formKey)},checkDependentDynamicFields:function(ids){var len=ids.length,repeatArgs={repeatingSection:"",repeatRow:""};for(var i=0,l=len;i<l;i++)hideOrShowFieldById(ids[i],repeatArgs)},checkDependentLookupFields:function(ids){var fieldId,repeatArgs={repeatingSection:"",
|
||
repeatRow:""};for(var i=0,l=ids.length;i<l;i++){fieldId=ids[i];updateWatchingFieldById(fieldId,repeatArgs,"value changed")}},loadGoogle:function(){var graphs,packages,i;if(typeof google==="undefined"||!google||!google.load){setTimeout(frmProForm.loadGoogle,30);return}graphs=__FRMTABLES;packages=Object.keys(graphs);for(i=0;i<packages.length;i++)if(packages[i]==="graphs")generateGoogleGraphs(graphs[packages[i]]);else generateGoogleTables(graphs[packages[i]],packages[i])},removeUsedTimes:function(obj,
|
||
timeField){var $form,form,e,data,success,extraParams;$form=jQuery(obj).parents("form").first();form=$form.get(0);e=$form.find('input[name="id"]');data={action:"frm_fields_ajax_time_options",time_field:timeField,date_field:obj.id,entry_id:e?e.val():"",date:jQuery(obj).val(),nonce:frm_js.nonce};success=function(opts){if(null!==document.getElementById(timeField+"_H")){frmProForm.removeUsedTimesForMultipleDropdown(opts,timeField);return}var $timeField=jQuery(document.getElementById(timeField));$timeField.find("option").prop("disabled",
|
||
false);if(opts.length>0)for(var i=0,l=opts.length;i<l;i++)$timeField.get(0).querySelectorAll('option[value="'+opts[i]+'"]').forEach(function(option){option.disabled=true;if(option.selected)option.selected=false})};extraParams={dataType:"json"};postToAjaxUrl(form,data,success,false,extraParams)},removeUsedTimesForMultipleDropdown:function(times,timeField){const self=this;self.hDropdown=null;self.mDropdown=null;self.ampmDropdown=null;function getTimeDropdownsElements(timeField){return{h:getTimeDropdownsElements.prototype.h[timeField],
|
||
m:getTimeDropdownsElements.prototype.m[timeField],ampm:getTimeDropdownsElements.prototype.ampm[timeField]}}this.init=function(){if("undefined"===typeof getTimeDropdownsElements.prototype.h){getTimeDropdownsElements.prototype.h=[];getTimeDropdownsElements.prototype.m=[];getTimeDropdownsElements.prototype.ampm=[]}if("undefined"!==typeof getTimeDropdownsElements.prototype.h[timeField])return;getTimeDropdownsElements.prototype.h[timeField]=document.getElementById(timeField+"_H");getTimeDropdownsElements.prototype.m[timeField]=
|
||
document.getElementById(timeField+"_m");getTimeDropdownsElements.prototype.ampm[timeField]=document.getElementById(timeField+"_A");if(null===getTimeDropdownsElements(timeField).h)return;getTimeDropdownsElements(timeField).h.addEventListener("change",function(event){self.disableMinutes(event.target.value)});getTimeDropdownsElements(timeField).m.addEventListener("change",function(event){});getTimeDropdownsElements(timeField).ampm.addEventListener("change",function(){self.disableHours()});self.disableHours();
|
||
self.disableAmpm()};this.checkIfTimeIsDisabled=time=>times.includes(time);this.getActiveTime=function(){var h=getTimeDropdownsElements(timeField).h.value||"12",m=getTimeDropdownsElements(timeField).m.value||"00",ampm=getTimeDropdownsElements(timeField).ampm.value||"AM";return h+":"+m+" "+ampm};this.getMeridiem=function(){return getTimeDropdownsElements(timeField).ampm.value||"AM"};this.listPossibleHourTimes=function(hour){const minutes=[];const ampm=[];const minutesElement=getTimeDropdownsElements(timeField).m;
|
||
const ampmElement=getTimeDropdownsElements(timeField).ampm;for(let i=0;i<ampmElement.options.length;i++)ampm.push(ampmElement.options[i].value);for(let i=0;i<minutesElement.options.length;i++)if(""!==minutesElement.options[i].value)minutes.push(minutesElement.options[i].value);return ampm.reduce((array,ampm)=>{array[ampm]=minutes.map(minute=>{return hour+":"+minute+" "+ampm});return array},{})};this.hourHasEmptySlots=function(hour){const possibleTimes=this.listPossibleHourTimes(hour);const ampm=this.getMeridiem();
|
||
const allPossibleTimes=possibleTimes[ampm];return!allPossibleTimes.every(time=>{return times.includes(time)})};this.disableHours=function(){if(null===getTimeDropdownsElements(timeField).h)return;getTimeDropdownsElements(timeField).h.querySelectorAll("option").forEach(function(option){option.disabled=!self.hourHasEmptySlots(option.value)})};this.disableMinutes=function(hour){if(null===getTimeDropdownsElements(timeField).m)return;getTimeDropdownsElements(timeField).m.querySelectorAll("option").forEach(function(option){const timeString=
|
||
hour+":"+option.value+" AM";option.disabled=times.includes(timeString)})};this.disableAmpm=function(){if(null===getTimeDropdownsElements(timeField).ampm)return;getTimeDropdownsElements(timeField).ampm.querySelectorAll("option").forEach(function(option){if(times.includes(option.value))option.disabled=true})};this.init()},changeRte:function(editor){editor.on("change",function(){var content=editor.getBody().innerHTML;jQuery("#"+editor.id).val(content).trigger("change")})},addFormidableClassToDatepicker:function(_,
|
||
options){if(options.dpDiv){Array.prototype.forEach.call(getAllFormClasses(options.input.get(0)),function(formClass){options.dpDiv.get(0).classList.add(formClass)});options.dpDiv.addClass("frm-datepicker");options.dpDiv.get(0).setAttribute("is-formidable-datepicker",1)}return options},removeFormidableClassFromDatepicker:function(_,options){var dpDiv;if(options.dpDiv){dpDiv=options.dpDiv.get(0);dpDiv.removeAttribute("is-formidable-datepicker");setTimeout(function(){if(dpDiv.hasAttribute("is-formidable-datepicker"))return;
|
||
Array.prototype.forEach.call(getAllFormClasses(options.input.get(0)),function(formClass){options.dpDiv.get(0).classList.remove(formClass)});jQuery(dpDiv).removeClass("frm-datepicker")},400)}},isIntlPhoneInput:function(field){var pattern=field.getAttribute("pattern");if("\\+?\\d{1,4}[\\s\\-]?(?:\\(\\d{1,3}\\)[\\s\\-]?)?\\d{1,4}[\\s\\-]?\\d{1,4}[\\s\\-]?\\d{1,4}$"!==pattern)return false;return"undefined"!==typeof intlPhoneInputs&&"undefined"!==typeof intlPhoneInputs[field.id]},validateIntlPhoneInput:function(field){return intlPhoneInputs[field.id].isValidNumber()},
|
||
frmDatepicker:frmDatepickerPro}}var frmProForm=frmProFormJS();document.addEventListener("frmMaybeDelayFocus",function(event){if("object"!==typeof event.frmData||"undefined"===typeof event.frmData.input)return;const input=event.frmData.input;const form=input.closest("form");if(form){const focusHandler=()=>{input.focus();form.removeEventListener("frmProAfterFormFadeIn",focusHandler)};form.addEventListener("frmProAfterFormFadeIn",focusHandler)}});jQuery(document).ready(function(){frmProForm.init()});
|
||
(function(){if(!Math.round10)Math.round10=function(value,decimals){return Number(Math.round(value+"e"+decimals)+"e-"+decimals)}})();
|
||
if(undefined===window.frmUpdateField)window.frmUpdateField=function(entryId,fieldId,value,message,num){jQuery(document.getElementById("frm_update_field_"+entryId+"_"+fieldId+"_"+num)).html('<span class="frm-loading-img"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_update_field_ajax",entry_id:entryId,field_id:fieldId,value:value,nonce:frm_js.nonce},success:function(){if(message.replace(/^\s+|\s+$/g,"")==="")jQuery(document.getElementById("frm_update_field_"+entryId+
|
||
"_"+fieldId+"_"+num)).fadeOut("slow");else jQuery(document.getElementById("frm_update_field_"+entryId+"_"+fieldId+"_"+num)).replaceWith(message)}})};
|
||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).SlimSelect=t()}(this,(function(){"use strict";function e(){return Math.random().toString(36).substring(2,10)}function t(e,t=50,s=!1){let i;return function(...n){const a=self,l=s&&!i;clearTimeout(i),i=setTimeout((()=>{i=null,s||e.apply(a,n)}),t),l&&e.apply(a,n)}}function s(e,t){return JSON.stringify(e)===JSON.stringify(t)}class i{constructor(t){if(this.id=t.id&&""!==t.id?t.id:e(),this.label=t.label||"",this.selectAll=void 0!==t.selectAll&&t.selectAll,this.selectAllText=t.selectAllText||"Select All",this.closable=t.closable||"off",this.options=[],t.options)for(const e of t.options)this.options.push(new n(e))}}class n{constructor(t){this.id=t.id&&""!==t.id?t.id:e(),this.value=void 0===t.value?t.text:t.value,this.text=t.text||"",this.html=t.html||"",this.selected=void 0!==t.selected&&t.selected,this.display=void 0===t.display||t.display,this.disabled=void 0!==t.disabled&&t.disabled,this.mandatory=void 0!==t.mandatory&&t.mandatory,this.placeholder=void 0!==t.placeholder&&t.placeholder,this.class=t.class||"",this.style=t.style||"",this.data=t.data||{}}}class a{constructor(e,t){this.selectType="single",this.data=[],this.selectType=e,this.setData(t)}validateDataArray(e){if(!Array.isArray(e))return new Error("Data must be an array");for(let t of e){if(!(t instanceof i||"label"in t))return t instanceof n||"text"in t?this.validateOption(t):new Error("Data object must be a valid optgroup or option");if(!("label"in t))return new Error("Optgroup must have a label");if("options"in t&&t.options)for(let e of t.options)return this.validateOption(e)}return null}validateOption(e){return"text"in e?null:new Error("Option must have a text")}partialToFullData(e){let t=[];return e.forEach((e=>{if(e instanceof i||"label"in e){let s=[];"options"in e&&e.options&&e.options.forEach((e=>{s.push(new n(e))})),s.length>0&&t.push(new i(e))}(e instanceof n||"text"in e)&&t.push(new n(e))})),t}setData(e){this.data=this.partialToFullData(e),"single"===this.selectType&&this.setSelectedBy("value",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(e){this.setData(this.getData().concat(new n(e)))}setSelectedBy(e,t){let s=null,a=!1;for(let l of this.data){if(l instanceof i)for(let i of l.options)s||(s=i),i.selected=!a&&t.includes(i[e]),i.selected&&"single"===this.selectType&&(a=!0);l instanceof n&&(s||(s=l),l.selected=!a&&t.includes(l[e]),l.selected&&"single"===this.selectType&&(a=!0))}"single"===this.selectType&&s&&!a&&(s.selected=!0)}getSelected(){let e=this.getSelectedOptions(),t=[];return e.forEach((e=>{t.push(e.value)})),t}getSelectedOptions(){return this.filter((e=>e.selected),!1)}getSelectedIDs(){let e=this.getSelectedOptions(),t=[];return e.forEach((e=>{t.push(e.id)})),t}getOptgroupByID(e){for(let t of this.data)if(t instanceof i&&t.id===e)return t;return null}getOptionByID(e){let t=this.filter((t=>t.id===e),!1);return t.length?t[0]:null}getSelectType(){return this.selectType}getFirstOption(){let e=null;for(let t of this.data)if(t instanceof i?e=t.options[0]:t instanceof n&&(e=t),e)break;return e}search(e,t){return""===(e=e.trim())?this.getData():this.filter((s=>t(s,e)),!0)}filter(e,t){const s=[];return this.data.forEach((a=>{if(a instanceof i){let l=[];if(a.options.forEach((i=>{e&&!e(i)||(t?l.push(new n(i)):s.push(new n(i)))})),l.length>0){let e=new i(a);e.options=l,s.push(e)}}a instanceof n&&(e&&!e(a)||s.push(new n(a)))})),s}}class l{constructor(e,t,s){this.classes={main:"ss-main",placeholder:"ss-placeholder",values:"ss-values",single:"ss-single",max:"ss-max",value:"ss-value",valueText:"ss-value-text",valueDelete:"ss-value-delete",valueOut:"ss-value-out",deselect:"ss-deselect",deselectPath:"M10,10 L90,90 M10,90 L90,10",arrow:"ss-arrow",arrowClose:"M10,30 L50,70 L90,30",arrowOpen:"M10,70 L50,30 L90,70",content:"ss-content",openAbove:"ss-open-above",openBelow:"ss-open-below",search:"ss-search",searchHighlighter:"ss-search-highlight",searching:"ss-searching",addable:"ss-addable",addablePath:"M50,10 L50,90 M10,50 L90,50",list:"ss-list",optgroup:"ss-optgroup",optgroupLabel:"ss-optgroup-label",optgroupLabelText:"ss-optgroup-label-text",optgroupActions:"ss-optgroup-actions",optgroupSelectAll:"ss-selectall",optgroupSelectAllBox:"M60,10 L10,10 L10,90 L90,90 L90,50",optgroupSelectAllCheck:"M30,45 L50,70 L90,10",optgroupClosable:"ss-closable",option:"ss-option",optionDelete:"M10,10 L90,90 M10,90 L90,10",highlighted:"ss-highlighted",open:"ss-open",close:"ss-close",selected:"ss-selected",error:"ss-error",disabled:"ss-disabled",hide:"ss-hide"},this.store=t,this.settings=e,this.callbacks=s,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes(),this.settings.contentLocation.appendChild(this.content.main)}enable(){this.main.main.classList.remove(this.classes.disabled),this.content.search.input.disabled=!1}disable(){this.main.main.classList.add(this.classes.disabled),this.content.search.input.disabled=!0}open(){this.main.arrow.path.setAttribute("d",this.classes.arrowOpen),this.main.main.classList.add("up"===this.settings.openPosition?this.classes.openAbove:this.classes.openBelow),this.main.main.setAttribute("aria-expanded","true"),this.moveContent();const e=this.store.getSelectedOptions();if(e.length){const t=e[e.length-1].id,s=this.content.list.querySelector('[data-id="'+t+'"]');s&&this.ensureElementInView(this.content.list,s)}}close(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.remove(this.classes.openBelow),this.main.main.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose)}updateClassStyles(){if(this.main.main.className="",this.main.main.removeAttribute("style"),this.content.main.className="",this.content.main.removeAttribute("style"),this.main.main.classList.add(this.classes.main),this.content.main.classList.add(this.classes.content),""!==this.settings.style&&(this.main.main.style.cssText=this.settings.style,this.content.main.style.cssText=this.settings.style),this.settings.class.length)for(const e of this.settings.class)""!==e.trim()&&(this.main.main.classList.add(e.trim()),this.content.main.classList.add(e.trim()));"relative"===this.settings.contentPosition&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.main.main.role="combobox",this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.main.id),this.main.main.setAttribute("aria-expanded","false"),this.content.main.setAttribute("role","listbox")}mainDiv(){var e;const t=document.createElement("div");t.dataset.id=this.settings.id,t.setAttribute("aria-label",this.settings.ariaLabel),t.tabIndex=0,t.onkeydown=e=>{switch(e.key){case"ArrowUp":case"ArrowDown":return this.callbacks.open(),"ArrowDown"===e.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Enter":case" ":this.callbacks.open();const t=this.content.list.querySelector("."+this.classes.highlighted);return t&&t.click(),!1;case"Escape":return this.callbacks.close(),!1}return!1},t.onclick=e=>{this.settings.disabled||(this.settings.isOpen?this.callbacks.close():this.callbacks.open())};const s=document.createElement("div");s.classList.add(this.classes.values),t.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.deselect);const n=null===(e=this.store)||void 0===e?void 0:e.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&n&&n.length<=0?i.classList.add(this.classes.hide):i.classList.remove(this.classes.hide),i.onclick=e=>{if(e.stopPropagation(),this.settings.disabled)return;let t=!0;const s=this.store.getSelectedOptions(),i=[];if(this.callbacks.beforeChange&&(t=!0===this.callbacks.beforeChange(i,s)),t){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const e=this.store.getFirstOption(),t=e?e.value:"";this.callbacks.setSelected(t,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100");const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.deselectPath),a.appendChild(l),i.appendChild(a),t.appendChild(i);const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.classList.add(this.classes.arrow),o.setAttribute("viewBox","0 0 100 100");const c=document.createElementNS("http://www.w3.org/2000/svg","path");return c.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(c),t.appendChild(o),{main:t,values:s,deselect:{main:i,svg:a,path:l},arrow:{main:o,path:c}}}mainFocus(e){"click"!==e&&this.main.main.focus({preventScroll:!0})}placeholder(){const e=this.store.filter((e=>e.placeholder),!1);let t=this.settings.placeholderText;e.length&&(""!==e[0].html?t=e[0].html:""!==e[0].text&&(t=e[0].text));const s=document.createElement("div");return s.classList.add(this.classes.placeholder),s.innerHTML=t,s}renderValues(){this.settings.isMultiple?(this.renderMultipleValues(),this.updateDeselectAll()):this.renderSingleValue()}renderSingleValue(){const e=this.store.filter((e=>e.selected&&!e.placeholder),!1),t=e.length>0?e[0]:null;if(t){const e=document.createElement("div");e.classList.add(this.classes.single),t.html?e.innerHTML=t.html:e.innerText=t.text,this.main.values.innerHTML=e.outerHTML}else this.main.values.innerHTML=this.placeholder().outerHTML;this.settings.allowDeselect&&e.length?this.main.deselect.main.classList.remove(this.classes.hide):this.main.deselect.main.classList.add(this.classes.hide)}renderMultipleValues(){let e=this.main.values.childNodes,t=this.store.filter((e=>e.selected&&e.display),!1);if(0===t.length)return void(this.main.values.innerHTML=this.placeholder().outerHTML);{const e=this.main.values.querySelector("."+this.classes.placeholder);e&&e.remove()}if(t.length>this.settings.maxValuesShown){const e=document.createElement("div");return e.classList.add(this.classes.max),e.textContent=this.settings.maxValuesMessage.replace("{number}",t.length.toString()),void(this.main.values.innerHTML=e.outerHTML)}{const e=this.main.values.querySelector("."+this.classes.max);e&&e.remove()}let s=[];for(let i=0;i<e.length;i++){const n=e[i],a=n.getAttribute("data-id");if(a){t.filter((e=>e.id===a),!1).length||s.push(n)}}for(const e of s)e.classList.add(this.classes.valueOut),setTimeout((()=>{this.main.values.hasChildNodes()&&this.main.values.contains(e)&&this.main.values.removeChild(e)}),100);e=this.main.values.childNodes;for(let s=0;s<t.length;s++){let i=!0;for(let n=0;n<e.length;n++)t[s].id===String(e[n].dataset.id)&&(i=!1);i&&(this.settings.keepOrder||0===e.length?this.main.values.appendChild(this.multipleValue(t[s])):0===s?this.main.values.insertBefore(this.multipleValue(t[s]),e[s]):e[s-1].insertAdjacentElement("afterend",this.multipleValue(t[s])))}}multipleValue(e){const t=document.createElement("div");t.classList.add(this.classes.value),t.dataset.id=e.id;const s=document.createElement("div");if(s.classList.add(this.classes.valueText),s.innerText=e.text,t.appendChild(s),!e.mandatory){const s=document.createElement("div");s.classList.add(this.classes.valueDelete),s.onclick=t=>{if(t.preventDefault(),t.stopPropagation(),this.settings.disabled)return;let s=!0;const a=this.store.getSelectedOptions(),l=a.filter((t=>t.selected&&t.id!==e.id),!0);if(!(this.settings.minSelected&&l.length<this.settings.minSelected)&&(this.callbacks.beforeChange&&(s=!0===this.callbacks.beforeChange(l,a)),s)){let e=[];for(const t of l){if(t instanceof i)for(const s of t.options)e.push(s.value);t instanceof n&&e.push(t.value)}this.callbacks.setSelected(e,!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(l),this.updateDeselectAll()}};const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100");const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optionDelete),a.appendChild(l),s.appendChild(a),t.appendChild(s)}return t}contentDiv(){const e=document.createElement("div");e.dataset.id=this.settings.id;const t=this.searchDiv();e.appendChild(t.main);const s=this.listDiv();return e.appendChild(s),{main:e,search:t,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const e=document.createElement("div"),s=document.createElement("input"),i=document.createElement("div");e.classList.add(this.classes.search);const a={main:e,input:s};if(this.settings.showSearch||(e.classList.add(this.classes.hide),s.readOnly=!0),s.type="search",s.placeholder=this.settings.searchPlaceholder,s.tabIndex=-1,s.setAttribute("aria-label",this.settings.searchPlaceholder),s.setAttribute("autocapitalize","off"),s.setAttribute("autocomplete","off"),s.setAttribute("autocorrect","off"),s.oninput=t((e=>{this.callbacks.search(e.target.value)}),100),s.onkeydown=e=>{switch(e.key){case"ArrowUp":case"ArrowDown":return"ArrowDown"===e.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case"Enter":case" ":if(this.callbacks.addable&&e.ctrlKey)return i.click(),!1;{const e=this.content.list.querySelector("."+this.classes.highlighted);if(e)return e.click(),!1}return!0}return!0},e.appendChild(s),this.callbacks.addable){i.classList.add(this.classes.addable);const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("viewBox","0 0 100 100");const s=document.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("d",this.classes.addablePath),t.appendChild(s),i.appendChild(t),i.onclick=e=>{if(e.preventDefault(),e.stopPropagation(),!this.callbacks.addable)return;const t=this.content.search.input.value.trim();if(""===t)return void this.content.search.input.focus();const s=e=>{let t=new n(e);if(this.callbacks.addOption(t),this.settings.isMultiple){let e=this.store.getSelected();e.push(t.value),this.callbacks.setSelected(e,!0)}else this.callbacks.setSelected([t.value],!0);this.callbacks.search(""),this.settings.closeOnSelect&&setTimeout((()=>{this.callbacks.close()}),100)},i=this.callbacks.addable(t);!1!==i&&null!=i&&(i instanceof Promise?i.then((e=>{s("string"==typeof e?{text:e,value:e}:e)})):s("string"==typeof i?{text:i,value:i}:i))},e.appendChild(i),a.addable={main:i,svg:t,path:s}}return a}searchFocus(){this.content.search.input.focus()}getOptions(e=!1,t=!1,s=!1){let i="."+this.classes.option;return e&&(i+=":not(."+this.classes.placeholder+")"),t&&(i+=":not(."+this.classes.disabled+")"),s&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(e){const t=this.getOptions(!0,!0,!0);if(0===t.length)return;if(1===t.length&&!t[0].classList.contains(this.classes.highlighted))return void t[0].classList.add(this.classes.highlighted);let s=!1;for(const e of t)e.classList.contains(this.classes.highlighted)&&(s=!0);if(!s)for(const e of t)if(e.classList.contains(this.classes.selected)){e.classList.add(this.classes.highlighted);break}for(let s=0;s<t.length;s++)if(t[s].classList.contains(this.classes.highlighted)){const i=t[s];i.classList.remove(this.classes.highlighted);const n=i.parentElement;if(n&&n.classList.contains(this.classes.open)){const e=n.querySelector("."+this.classes.optgroupLabel);e&&e.click()}let a=t["down"===e?s+1<t.length?s+1:0:s-1>=0?s-1:t.length-1];a.classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,a);const l=a.parentElement;if(l&&l.classList.contains(this.classes.close)){const e=l.querySelector("."+this.classes.optgroupLabel);e&&e.click()}return}t["down"===e?0:t.length-1].classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,t["down"===e?0:t.length-1])}listDiv(){const e=document.createElement("div");return e.classList.add(this.classes.list),e}renderError(e){this.content.list.innerHTML="";const t=document.createElement("div");t.classList.add(this.classes.error),t.textContent=e,this.content.list.appendChild(t)}renderSearching(){this.content.list.innerHTML="";const e=document.createElement("div");e.classList.add(this.classes.searching),e.textContent=this.settings.searchingText,this.content.list.appendChild(e)}renderOptions(e){if(this.content.list.innerHTML="",0===e.length){const e=document.createElement("div");return e.classList.add(this.classes.search),e.innerHTML=this.settings.searchText,void this.content.list.appendChild(e)}for(const t of e){if(t instanceof i){const e=document.createElement("div");e.classList.add(this.classes.optgroup);const s=document.createElement("div");s.classList.add(this.classes.optgroupLabel),e.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabelText),i.textContent=t.label,s.appendChild(i);const n=document.createElement("div");if(n.classList.add(this.classes.optgroupActions),s.appendChild(n),this.settings.isMultiple&&t.selectAll){const e=document.createElement("div");e.classList.add(this.classes.optgroupSelectAll);let s=!0;for(const e of t.options)if(!e.selected){s=!1;break}s&&e.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=t.selectAllText,e.appendChild(i);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),e.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),a.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),a.appendChild(o),e.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation();const i=this.store.getSelected();if(s){const e=i.filter((e=>{for(const s of t.options)if(e===s.value)return!1;return!0}));this.callbacks.setSelected(e,!0)}else{const e=i.concat(t.options.map((e=>e.value)));for(const e of t.options)this.store.getOptionByID(e.id)||this.callbacks.addOption(e);this.callbacks.setSelected(e,!0)}})),n.appendChild(e)}if("off"!==t.closable){const i=document.createElement("div");i.classList.add(this.classes.optgroupClosable);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),a.classList.add(this.classes.arrow),i.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");a.appendChild(l),t.options.some((e=>e.selected))||""!==this.content.search.input.value.trim()?(i.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"open"===t.closable?(e.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===t.closable&&(e.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),s.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),e.classList.contains(this.classes.close)?(e.classList.remove(this.classes.close),e.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):(e.classList.remove(this.classes.open),e.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose))})),n.appendChild(i)}e.appendChild(s);for(const s of t.options)e.appendChild(this.option(s));this.content.list.appendChild(e)}t instanceof n&&this.content.list.appendChild(this.option(t))}}option(e){if(e.placeholder){const e=document.createElement("div");return e.classList.add(this.classes.option),e.classList.add(this.classes.hide),e}const t=document.createElement("div");return t.dataset.id=e.id,t.id=e.id,t.classList.add(this.classes.option),t.setAttribute("role","option"),e.class&&e.class.split(" ").forEach((e=>{t.classList.add(e)})),e.style&&(t.style.cssText=e.style),this.settings.searchHighlight&&""!==this.content.search.input.value.trim()?t.innerHTML=this.highlightText(""!==e.html?e.html:e.text,this.content.search.input.value,this.classes.searchHighlighter):""!==e.html?t.innerHTML=e.html:t.textContent=e.text,this.settings.showOptionTooltips&&t.textContent&&t.setAttribute("title",t.textContent),e.display||t.classList.add(this.classes.hide),e.disabled&&t.classList.add(this.classes.disabled),e.selected&&this.settings.hideSelected&&t.classList.add(this.classes.hide),e.selected?(t.classList.add(this.classes.selected),t.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",t.id)):(t.classList.remove(this.classes.selected),t.setAttribute("aria-selected","false")),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const s=this.store.getSelected(),i=t.currentTarget,n=String(i.dataset.id);if(e.disabled||e.selected&&!this.settings.allowDeselect)return;if(this.settings.isMultiple&&this.settings.maxSelected<=s.length&&!e.selected||this.settings.isMultiple&&this.settings.minSelected>=s.length&&e.selected)return;let a=!1;const l=this.store.getSelectedOptions();let o=[];this.settings.isMultiple&&(o=e.selected?l.filter((e=>e.id!==n)):l.concat(e)),this.settings.isMultiple||(o=e.selected?[]:[e]),this.callbacks.beforeChange||(a=!0),this.callbacks.beforeChange&&(a=!1!==this.callbacks.beforeChange(o,l)),a&&(this.store.getOptionByID(n)||this.callbacks.addOption(e),this.callbacks.setSelected(o.map((e=>e.value)),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(o))})),t}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(e,t,s){let i=e;const n=new RegExp("("+t.trim()+")(?![^<]*>[^<>]*</)","i");if(!e.match(n))return e;const a=e.match(n).index,l=a+e.match(n)[0].toString().length,o=e.substring(a,l);return i=i.replace(n,`<mark class="${s}">${o}</mark>`),i}moveContentAbove(){const e=this.main.main.offsetHeight,t=this.content.main.offsetHeight;this.main.main.classList.remove(this.classes.openBelow),this.main.main.classList.add(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.content.main.classList.add(this.classes.openAbove);const s=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(e+t-1)+"px 0px 0px 0px",this.content.main.style.top=s.top+s.height+window.scrollY+"px",this.content.main.style.left=s.left+window.scrollX+"px",this.content.main.style.width=s.width+"px"}moveContentBelow(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.add(this.classes.openBelow),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.add(this.classes.openBelow);const e=this.main.main.getBoundingClientRect();this.content.main.style.margin="-1px 0px 0px 0px","relative"!==this.settings.contentPosition&&(this.content.main.style.top=e.top+e.height+window.scrollY+"px",this.content.main.style.left=e.left+window.scrollX+"px",this.content.main.style.width=e.width+"px")}ensureElementInView(e,t){const s=e.scrollTop+e.offsetTop,i=s+e.clientHeight,n=t.offsetTop,a=n+t.clientHeight;n<s?e.scrollTop-=s-n:a>i&&(e.scrollTop+=a-i)}putContent(){const e=this.main.main.offsetHeight,t=this.main.main.getBoundingClientRect(),s=this.content.main.offsetHeight;return window.innerHeight-(t.top+e)<=s&&t.top>s?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const e=this.store.getSelectedOptions(),t=e&&e.length>0,s=this.settings.isMultiple,i=this.settings.allowDeselect,n=this.main.deselect.main,a=this.classes.hide;!i||s&&!t?n.classList.add(a):n.classList.remove(a)}}class o{constructor(e){this.listen=!1,this.observer=null,this.select=e,this.valueChange=this.valueChange.bind(this),this.select.addEventListener("change",this.valueChange,{passive:!0}),this.observer=new MutationObserver(this.observeCall.bind(this)),this.changeListen(!0)}enable(){this.select.disabled=!1}disable(){this.select.disabled=!0}hideUI(){this.select.tabIndex=-1,this.select.style.display="none",this.select.setAttribute("aria-hidden","true")}showUI(){this.select.removeAttribute("tabindex"),this.select.style.display="",this.select.removeAttribute("aria-hidden")}changeListen(e){this.listen=e,e&&this.observer&&this.observer.observe(this.select,{subtree:!0,childList:!0,attributes:!0}),e||this.observer&&this.observer.disconnect()}valueChange(e){return this.listen&&this.onValueChange&&this.onValueChange(this.getSelectedValues()),!0}observeCall(e){if(!this.listen)return;let t=!1,s=!1,i=!1;for(const n of e)n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(t=!0)),"OPTGROUP"!==n.target.nodeName&&"OPTION"!==n.target.nodeName||(i=!0);t&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),s&&this.onDisabledChange&&(this.changeListen(!1),this.onDisabledChange(this.select.disabled),this.changeListen(!0)),i&&this.onOptionsChange&&(this.changeListen(!1),this.onOptionsChange(this.getData()),this.changeListen(!0))}getData(){let e=[];const t=this.select.childNodes;for(const s of t)"OPTGROUP"===s.nodeName&&e.push(this.getDataFromOptgroup(s)),"OPTION"===s.nodeName&&e.push(this.getDataFromOption(s));return e}getDataFromOptgroup(e){let t={id:e.id,label:e.label,selectAll:!!e.dataset&&"true"===e.dataset.selectall,selectAllText:e.dataset?e.dataset.selectalltext:"Select all",closable:e.dataset?e.dataset.closable:"off",options:[]};const s=e.childNodes;for(const e of s)"OPTION"===e.nodeName&&t.options.push(this.getDataFromOption(e));return t}getDataFromOption(e){return{id:e.id,value:e.value,text:e.text,html:e.dataset&&e.dataset.html?e.dataset.html:"",selected:e.selected,display:"none"!==e.style.display,disabled:e.disabled,mandatory:!!e.dataset&&"true"===e.dataset.mandatory,placeholder:"true"===e.dataset.placeholder,class:e.className,style:e.style.cssText,data:e.dataset}}getSelectedValues(){let e=[];const t=this.select.childNodes;for(const s of t){if("OPTGROUP"===s.nodeName){const t=s.childNodes;for(const s of t)if("OPTION"===s.nodeName){const t=s;t.selected&&e.push(t.value)}}if("OPTION"===s.nodeName){const t=s;t.selected&&e.push(t.value)}}return e}setSelected(e){this.changeListen(!1);const t=this.select.childNodes;for(const s of t){if("OPTGROUP"===s.nodeName){const t=s.childNodes;for(const s of t)if("OPTION"===s.nodeName){const t=s;t.selected=e.includes(t.value)}}if("OPTION"===s.nodeName){const t=s;t.selected=e.includes(t.value)}}this.changeListen(!0)}updateSelect(e,t,s){this.changeListen(!1),e&&(this.select.dataset.id=e),t&&(this.select.style.cssText=t),s&&(this.select.className="",s.forEach((e=>{""!==e.trim()&&this.select.classList.add(e.trim())}))),this.changeListen(!0)}updateOptions(e){this.changeListen(!1),this.select.innerHTML="";for(const t of e)t instanceof i&&this.select.appendChild(this.createOptgroup(t)),t instanceof n&&this.select.appendChild(this.createOption(t));this.select.dispatchEvent(new Event("change")),this.changeListen(!0)}createOptgroup(e){const t=document.createElement("optgroup");if(t.id=e.id,t.label=e.label,e.selectAll&&(t.dataset.selectAll="true"),"off"!==e.closable&&(t.dataset.closable=e.closable),e.options)for(const s of e.options)t.appendChild(this.createOption(s));return t}createOption(e){const t=document.createElement("option");return t.id=e.id,t.value=e.value,t.innerHTML=e.text,""!==e.html&&t.setAttribute("data-html",e.html),e.selected&&(t.selected=e.selected),e.disabled&&(t.disabled=!0),!1===e.display&&(t.style.display="none"),e.placeholder&&t.setAttribute("data-placeholder","true"),e.mandatory&&t.setAttribute("data-mandatory","true"),e.class&&e.class.split(" ").forEach((e=>{t.classList.add(e)})),e.data&&"object"==typeof e.data&&Object.keys(e.data).forEach((s=>{t.setAttribute("data-"+function(e){const t=e.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(e=>"-"+e.toLowerCase()));return e[0]===e[0].toUpperCase()?t.substring(1):t}(s),e.data[s])})),t}destroy(){this.changeListen(!1),this.select.removeEventListener("change",this.valueChange),this.observer&&(this.observer.disconnect(),this.observer=null),delete this.select.dataset.id,this.showUI()}}class c{constructor(t){this.id="",this.style="",this.class=[],this.isMultiple=!1,this.isOpen=!1,this.isFullOpen=!1,this.intervalMove=null,t||(t={}),this.id="ss-"+e(),this.style=t.style||"",this.class=t.class||[],this.disabled=void 0!==t.disabled&&t.disabled,this.alwaysOpen=void 0!==t.alwaysOpen&&t.alwaysOpen,this.showSearch=void 0===t.showSearch||t.showSearch,this.ariaLabel=t.ariaLabel||"Combobox",this.searchPlaceholder=t.searchPlaceholder||"Search",this.searchText=t.searchText||"No Results",this.searchingText=t.searchingText||"Searching...",this.searchHighlight=void 0!==t.searchHighlight&&t.searchHighlight,this.closeOnSelect=void 0===t.closeOnSelect||t.closeOnSelect,this.contentLocation=t.contentLocation||document.body,this.contentPosition=t.contentPosition||"absolute",this.openPosition=t.openPosition||"auto",this.placeholderText=void 0!==t.placeholderText?t.placeholderText:"Select Value",this.allowDeselect=void 0!==t.allowDeselect&&t.allowDeselect,this.hideSelected=void 0!==t.hideSelected&&t.hideSelected,this.keepOrder=void 0!==t.keepOrder&&t.keepOrder,this.showOptionTooltips=void 0!==t.showOptionTooltips&&t.showOptionTooltips,this.minSelected=t.minSelected||0,this.maxSelected=t.maxSelected||1e3,this.timeoutDelay=t.timeoutDelay||200,this.maxValuesShown=t.maxValuesShown||20,this.maxValuesMessage=t.maxValuesMessage||"{number} selected"}}return class{constructor(e){var s;if(this.events={search:void 0,searchFilter:(e,t)=>-1!==e.text.toLowerCase().indexOf(t.toLowerCase()),addable:void 0,beforeChange:void 0,afterChange:void 0,beforeOpen:void 0,afterOpen:void 0,beforeClose:void 0,afterClose:void 0},this.windowResize=t((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=t((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.documentClick=e=>{this.settings.isOpen&&e.target&&!function(e,t){function s(e,s){return s&&e&&e.classList&&e.classList.contains(s)||s&&e&&e.dataset&&e.dataset.id&&e.dataset.id===t?e:null}return s(e,t)||function e(t,i){return t&&t!==document?s(t,i)?t:e(t.parentNode,i):null}(e,t)}(e.target,this.settings.id)&&this.close(e.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl="string"==typeof e.select?document.querySelector(e.select):e.select,!this.selectEl)return void(e.events&&e.events.error&&e.events.error(new Error("Could not find select element")));if("SELECT"!==this.selectEl.tagName)return void(e.events&&e.events.error&&e.events.error(new Error("Element isnt of type select")));this.selectEl.dataset.ssid&&this.destroy(),this.settings=new c(e.settings);const i=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const s in e.events)e.events.hasOwnProperty(s)&&(-1!==i.indexOf(s)?this.events[s]=t(e.events[s],100):this.events[s]=e.events[s]);this.settings.disabled=(null===(s=e.settings)||void 0===s?void 0:s.disabled)?e.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new o(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=e=>{this.setSelected(e)},this.select.onClassChange=e=>{this.settings.class=e,this.render.updateClassStyles()},this.select.onDisabledChange=e=>{e?this.disable():this.enable()},this.select.onOptionsChange=e=>{this.setData(e)},this.store=new a(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const n={open:this.open.bind(this),close:this.close.bind(this),addable:this.events.addable?this.events.addable:void 0,setSelected:this.setSelected.bind(this),addOption:this.addOption.bind(this),search:this.search.bind(this),beforeChange:this.events.beforeChange,afterChange:this.events.afterChange};this.render=new l(this.settings,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):r&&this.render.main.main.setAttribute("aria-labelledby",r),this.selectEl.parentNode&&this.selectEl.parentNode.insertBefore(this.render.main.main,this.selectEl.nextSibling),window.addEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.addEventListener("scroll",this.windowScroll,!1),document.addEventListener("visibilitychange",this.windowVisibilityChange),this.settings.disabled&&this.disable(),this.settings.alwaysOpen&&this.open(),this.selectEl.slim=this}enable(){this.settings.disabled=!1,this.select.enable(),this.render.enable()}disable(){this.settings.disabled=!0,this.select.disable(),this.render.disable()}getData(){return this.store.getData()}setData(e){const t=this.store.getSelected(),i=this.store.validateDataArray(e);if(i)return void(this.events.error&&this.events.error(i));this.store.setData(e);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!s(t,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){return this.store.getSelected()}setSelected(e,t=!0){const i=this.store.getSelected();this.store.setSelectedBy("value",Array.isArray(e)?e:[e]);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),""!==this.render.content.search.input.value?this.search(this.render.content.search.input.value):this.render.renderOptions(n),t&&this.events.afterChange&&!s(i,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(e){const t=this.store.getSelected();this.store.getDataOptions().some((t=>{var s;return t.value===(null!==(s=e.value)&&void 0!==s?s:e.text)}))||this.store.addOption(e);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!s(t,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}open(){this.settings.disabled||this.settings.isOpen||(this.events.beforeOpen&&this.events.beforeOpen(),this.render.open(),this.settings.showSearch&&this.render.searchFocus(),this.settings.isOpen=!0,setTimeout((()=>{this.events.afterOpen&&this.events.afterOpen(),this.settings.isOpen&&(this.settings.isFullOpen=!0),document.addEventListener("click",this.documentClick)}),this.settings.timeoutDelay),"absolute"===this.settings.contentPosition&&(this.settings.intervalMove&&clearInterval(this.settings.intervalMove),this.settings.intervalMove=setInterval(this.render.moveContent.bind(this.render),500)))}close(e=null){this.settings.isOpen&&!this.settings.alwaysOpen&&(this.events.beforeClose&&this.events.beforeClose(),this.render.close(),""!==this.render.content.search.input.value&&this.search(""),this.render.mainFocus(e),this.settings.isOpen=!1,this.settings.isFullOpen=!1,setTimeout((()=>{this.events.afterClose&&this.events.afterClose(),document.removeEventListener("click",this.documentClick)}),this.settings.timeoutDelay),this.settings.intervalMove&&clearInterval(this.settings.intervalMove))}search(e){if(this.render.content.search.input.value!==e&&(this.render.content.search.input.value=e),!this.events.search)return void this.render.renderOptions(""===e?this.store.getData():this.store.search(e,this.events.searchFilter));this.render.renderSearching();const t=this.events.search(e,this.store.getSelectedOptions());t instanceof Promise?t.then((e=>{this.render.renderOptions(this.store.partialToFullData(e))})).catch((e=>{this.render.renderError("string"==typeof e?e:e.message)})):Array.isArray(t)?this.render.renderOptions(this.store.partialToFullData(t)):this.render.renderError("Search event must return a promise or an array of data")}destroy(){document.removeEventListener("click",this.documentClick),window.removeEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.removeEventListener("scroll",this.windowScroll,!1),document.removeEventListener("visibilitychange",this.windowVisibilityChange),this.store.setData([]),this.render.destroy(),this.select.destroy()}}}));
|
||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(self,(function(){return function(){var e={3099:function(e){e.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},6077:function(e,t,n){var r=n(111);e.exports=function(e){if(!r(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype");return e}},1223:function(e,t,n){var r=n(5112),i=n(30),o=n(3070),a=r("unscopables"),u=Array.prototype;null==u[a]&&o.f(u,a,{configurable:!0,value:i(null)}),e.exports=function(e){u[a][e]=!0}},1530:function(e,t,n){"use strict";var r=n(8710).charAt;e.exports=function(e,t,n){return t+(n?r(e,t).length:1)}},5787:function(e){e.exports=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e}},9670:function(e,t,n){var r=n(111);e.exports=function(e){if(!r(e))throw TypeError(String(e)+" is not an object");return e}},4019:function(e){e.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},260:function(e,t,n){"use strict";var r,i=n(4019),o=n(9781),a=n(7854),u=n(111),s=n(6656),l=n(648),c=n(8880),f=n(1320),p=n(3070).f,h=n(9518),d=n(7674),v=n(5112),y=n(9711),g=a.Int8Array,m=g&&g.prototype,b=a.Uint8ClampedArray,x=b&&b.prototype,w=g&&h(g),E=m&&h(m),k=Object.prototype,A=k.isPrototypeOf,S=v("toStringTag"),F=y("TYPED_ARRAY_TAG"),T=i&&!!d&&"Opera"!==l(a.opera),C=!1,L={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},R={BigInt64Array:8,BigUint64Array:8},I=function(e){if(!u(e))return!1;var t=l(e);return s(L,t)||s(R,t)};for(r in L)a[r]||(T=!1);if((!T||"function"!=typeof w||w===Function.prototype)&&(w=function(){throw TypeError("Incorrect invocation")},T))for(r in L)a[r]&&d(a[r],w);if((!T||!E||E===k)&&(E=w.prototype,T))for(r in L)a[r]&&d(a[r].prototype,E);if(T&&h(x)!==E&&d(x,E),o&&!s(E,S))for(r in C=!0,p(E,S,{get:function(){return u(this)?this[F]:void 0}}),L)a[r]&&c(a[r],F,r);e.exports={NATIVE_ARRAY_BUFFER_VIEWS:T,TYPED_ARRAY_TAG:C&&F,aTypedArray:function(e){if(I(e))return e;throw TypeError("Target is not a typed array")},aTypedArrayConstructor:function(e){if(d){if(A.call(w,e))return e}else for(var t in L)if(s(L,r)){var n=a[t];if(n&&(e===n||A.call(n,e)))return e}throw TypeError("Target is not a typed array constructor")},exportTypedArrayMethod:function(e,t,n){if(o){if(n)for(var r in L){var i=a[r];i&&s(i.prototype,e)&&delete i.prototype[e]}E[e]&&!n||f(E,e,n?t:T&&m[e]||t)}},exportTypedArrayStaticMethod:function(e,t,n){var r,i;if(o){if(d){if(n)for(r in L)(i=a[r])&&s(i,e)&&delete i[e];if(w[e]&&!n)return;try{return f(w,e,n?t:T&&g[e]||t)}catch(e){}}for(r in L)!(i=a[r])||i[e]&&!n||f(i,e,t)}},isView:function(e){if(!u(e))return!1;var t=l(e);return"DataView"===t||s(L,t)||s(R,t)},isTypedArray:I,TypedArray:w,TypedArrayPrototype:E}},3331:function(e,t,n){"use strict";var r=n(7854),i=n(9781),o=n(4019),a=n(8880),u=n(2248),s=n(7293),l=n(5787),c=n(9958),f=n(7466),p=n(7067),h=n(1179),d=n(9518),v=n(7674),y=n(8006).f,g=n(3070).f,m=n(1285),b=n(8003),x=n(9909),w=x.get,E=x.set,k="ArrayBuffer",A="DataView",S="Wrong index",F=r.ArrayBuffer,T=F,C=r.DataView,L=C&&C.prototype,R=Object.prototype,I=r.RangeError,U=h.pack,O=h.unpack,_=function(e){return[255&e]},M=function(e){return[255&e,e>>8&255]},z=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},P=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},j=function(e){return U(e,23,4)},D=function(e){return U(e,52,8)},N=function(e,t){g(e.prototype,t,{get:function(){return w(this)[t]}})},B=function(e,t,n,r){var i=p(n),o=w(e);if(i+t>o.byteLength)throw I(S);var a=w(o.buffer).bytes,u=i+o.byteOffset,s=a.slice(u,u+t);return r?s:s.reverse()},q=function(e,t,n,r,i,o){var a=p(n),u=w(e);if(a+t>u.byteLength)throw I(S);for(var s=w(u.buffer).bytes,l=a+u.byteOffset,c=r(+i),f=0;f<t;f++)s[l+f]=c[o?f:t-f-1]};if(o){if(!s((function(){F(1)}))||!s((function(){new F(-1)}))||s((function(){return new F,new F(1.5),new F(NaN),F.name!=k}))){for(var W,H=(T=function(e){return l(this,T),new F(p(e))}).prototype=F.prototype,Y=y(F),G=0;Y.length>G;)(W=Y[G++])in T||a(T,W,F[W]);H.constructor=T}v&&d(L)!==R&&v(L,R);var Q=new C(new T(2)),$=L.setInt8;Q.setInt8(0,2147483648),Q.setInt8(1,2147483649),!Q.getInt8(0)&&Q.getInt8(1)||u(L,{setInt8:function(e,t){$.call(this,e,t<<24>>24)},setUint8:function(e,t){$.call(this,e,t<<24>>24)}},{unsafe:!0})}else T=function(e){l(this,T,k);var t=p(e);E(this,{bytes:m.call(new Array(t),0),byteLength:t}),i||(this.byteLength=t)},C=function(e,t,n){l(this,C,A),l(e,T,A);var r=w(e).byteLength,o=c(t);if(o<0||o>r)throw I("Wrong offset");if(o+(n=void 0===n?r-o:f(n))>r)throw I("Wrong length");E(this,{buffer:e,byteLength:n,byteOffset:o}),i||(this.buffer=e,this.byteLength=n,this.byteOffset=o)},i&&(N(T,"byteLength"),N(C,"buffer"),N(C,"byteLength"),N(C,"byteOffset")),u(C.prototype,{getInt8:function(e){return B(this,1,e)[0]<<24>>24},getUint8:function(e){return B(this,1,e)[0]},getInt16:function(e){var t=B(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=B(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return P(B(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return P(B(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return O(B(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return O(B(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){q(this,1,e,_,t)},setUint8:function(e,t){q(this,1,e,_,t)},setInt16:function(e,t){q(this,2,e,M,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){q(this,2,e,M,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){q(this,4,e,z,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){q(this,4,e,z,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){q(this,4,e,j,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){q(this,8,e,D,t,arguments.length>2?arguments[2]:void 0)}});b(T,k),b(C,A),e.exports={ArrayBuffer:T,DataView:C}},1048:function(e,t,n){"use strict";var r=n(7908),i=n(1400),o=n(7466),a=Math.min;e.exports=[].copyWithin||function(e,t){var n=r(this),u=o(n.length),s=i(e,u),l=i(t,u),c=arguments.length>2?arguments[2]:void 0,f=a((void 0===c?u:i(c,u))-l,u-s),p=1;for(l<s&&s<l+f&&(p=-1,l+=f-1,s+=f-1);f-- >0;)l in n?n[s]=n[l]:delete n[s],s+=p,l+=p;return n}},1285:function(e,t,n){"use strict";var r=n(7908),i=n(1400),o=n(7466);e.exports=function(e){for(var t=r(this),n=o(t.length),a=arguments.length,u=i(a>1?arguments[1]:void 0,n),s=a>2?arguments[2]:void 0,l=void 0===s?n:i(s,n);l>u;)t[u++]=e;return t}},8533:function(e,t,n){"use strict";var r=n(2092).forEach,i=n(9341)("forEach");e.exports=i?[].forEach:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0)}},8457:function(e,t,n){"use strict";var r=n(9974),i=n(7908),o=n(3411),a=n(7659),u=n(7466),s=n(6135),l=n(1246);e.exports=function(e){var t,n,c,f,p,h,d=i(e),v="function"==typeof this?this:Array,y=arguments.length,g=y>1?arguments[1]:void 0,m=void 0!==g,b=l(d),x=0;if(m&&(g=r(g,y>2?arguments[2]:void 0,2)),null==b||v==Array&&a(b))for(n=new v(t=u(d.length));t>x;x++)h=m?g(d[x],x):d[x],s(n,x,h);else for(p=(f=b.call(d)).next,n=new v;!(c=p.call(f)).done;x++)h=m?o(f,g,[c.value,x],!0):c.value,s(n,x,h);return n.length=x,n}},1318:function(e,t,n){var r=n(5656),i=n(7466),o=n(1400),a=function(e){return function(t,n,a){var u,s=r(t),l=i(s.length),c=o(a,l);if(e&&n!=n){for(;l>c;)if((u=s[c++])!=u)return!0}else for(;l>c;c++)if((e||c in s)&&s[c]===n)return e||c||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},2092:function(e,t,n){var r=n(9974),i=n(8361),o=n(7908),a=n(7466),u=n(5417),s=[].push,l=function(e){var t=1==e,n=2==e,l=3==e,c=4==e,f=6==e,p=7==e,h=5==e||f;return function(d,v,y,g){for(var m,b,x=o(d),w=i(x),E=r(v,y,3),k=a(w.length),A=0,S=g||u,F=t?S(d,k):n||p?S(d,0):void 0;k>A;A++)if((h||A in w)&&(b=E(m=w[A],A,x),e))if(t)F[A]=b;else if(b)switch(e){case 3:return!0;case 5:return m;case 6:return A;case 2:s.call(F,m)}else switch(e){case 4:return!1;case 7:s.call(F,m)}return f?-1:l||c?c:F}};e.exports={forEach:l(0),map:l(1),filter:l(2),some:l(3),every:l(4),find:l(5),findIndex:l(6),filterOut:l(7)}},6583:function(e,t,n){"use strict";var r=n(5656),i=n(9958),o=n(7466),a=n(9341),u=Math.min,s=[].lastIndexOf,l=!!s&&1/[1].lastIndexOf(1,-0)<0,c=a("lastIndexOf"),f=l||!c;e.exports=f?function(e){if(l)return s.apply(this,arguments)||0;var t=r(this),n=o(t.length),a=n-1;for(arguments.length>1&&(a=u(a,i(arguments[1]))),a<0&&(a=n+a);a>=0;a--)if(a in t&&t[a]===e)return a||0;return-1}:s},1194:function(e,t,n){var r=n(7293),i=n(5112),o=n(7392),a=i("species");e.exports=function(e){return o>=51||!r((function(){var t=[];return(t.constructor={})[a]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},9341:function(e,t,n){"use strict";var r=n(7293);e.exports=function(e,t){var n=[][e];return!!n&&r((function(){n.call(null,t||function(){throw 1},1)}))}},3671:function(e,t,n){var r=n(3099),i=n(7908),o=n(8361),a=n(7466),u=function(e){return function(t,n,u,s){r(n);var l=i(t),c=o(l),f=a(l.length),p=e?f-1:0,h=e?-1:1;if(u<2)for(;;){if(p in c){s=c[p],p+=h;break}if(p+=h,e?p<0:f<=p)throw TypeError("Reduce of empty array with no initial value")}for(;e?p>=0:f>p;p+=h)p in c&&(s=n(s,c[p],p,l));return s}};e.exports={left:u(!1),right:u(!0)}},5417:function(e,t,n){var r=n(111),i=n(3157),o=n(5112)("species");e.exports=function(e,t){var n;return i(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!i(n.prototype)?r(n)&&null===(n=n[o])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)}},3411:function(e,t,n){var r=n(9670),i=n(9212);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){throw i(e),t}}},7072:function(e,t,n){var r=n(5112)("iterator"),i=!1;try{var o=0,a={next:function(){return{done:!!o++}},return:function(){i=!0}};a[r]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!i)return!1;var n=!1;try{var o={};o[r]=function(){return{next:function(){return{done:n=!0}}}},e(o)}catch(e){}return n}},4326:function(e){var t={}.toString;e.exports=function(e){return t.call(e).slice(8,-1)}},648:function(e,t,n){var r=n(1694),i=n(4326),o=n(5112)("toStringTag"),a="Arguments"==i(function(){return arguments}());e.exports=r?i:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),o))?n:a?i(t):"Object"==(r=i(t))&&"function"==typeof t.callee?"Arguments":r}},9920:function(e,t,n){var r=n(6656),i=n(3887),o=n(1236),a=n(3070);e.exports=function(e,t){for(var n=i(t),u=a.f,s=o.f,l=0;l<n.length;l++){var c=n[l];r(e,c)||u(e,c,s(t,c))}}},8544:function(e,t,n){var r=n(7293);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},4994:function(e,t,n){"use strict";var r=n(3383).IteratorPrototype,i=n(30),o=n(9114),a=n(8003),u=n(7497),s=function(){return this};e.exports=function(e,t,n){var l=t+" Iterator";return e.prototype=i(r,{next:o(1,n)}),a(e,l,!1,!0),u[l]=s,e}},8880:function(e,t,n){var r=n(9781),i=n(3070),o=n(9114);e.exports=r?function(e,t,n){return i.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},9114:function(e){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},6135:function(e,t,n){"use strict";var r=n(7593),i=n(3070),o=n(9114);e.exports=function(e,t,n){var a=r(t);a in e?i.f(e,a,o(0,n)):e[a]=n}},654:function(e,t,n){"use strict";var r=n(2109),i=n(4994),o=n(9518),a=n(7674),u=n(8003),s=n(8880),l=n(1320),c=n(5112),f=n(1913),p=n(7497),h=n(3383),d=h.IteratorPrototype,v=h.BUGGY_SAFARI_ITERATORS,y=c("iterator"),g="keys",m="values",b="entries",x=function(){return this};e.exports=function(e,t,n,c,h,w,E){i(n,t,c);var k,A,S,F=function(e){if(e===h&&I)return I;if(!v&&e in L)return L[e];switch(e){case g:case m:case b:return function(){return new n(this,e)}}return function(){return new n(this)}},T=t+" Iterator",C=!1,L=e.prototype,R=L[y]||L["@@iterator"]||h&&L[h],I=!v&&R||F(h),U="Array"==t&&L.entries||R;if(U&&(k=o(U.call(new e)),d!==Object.prototype&&k.next&&(f||o(k)===d||(a?a(k,d):"function"!=typeof k[y]&&s(k,y,x)),u(k,T,!0,!0),f&&(p[T]=x))),h==m&&R&&R.name!==m&&(C=!0,I=function(){return R.call(this)}),f&&!E||L[y]===I||s(L,y,I),p[t]=I,h)if(A={values:F(m),keys:w?I:F(g),entries:F(b)},E)for(S in A)(v||C||!(S in L))&&l(L,S,A[S]);else r({target:t,proto:!0,forced:v||C},A);return A}},9781:function(e,t,n){var r=n(7293);e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},317:function(e,t,n){var r=n(7854),i=n(111),o=r.document,a=i(o)&&i(o.createElement);e.exports=function(e){return a?o.createElement(e):{}}},8324:function(e){e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},8113:function(e,t,n){var r=n(5005);e.exports=r("navigator","userAgent")||""},7392:function(e,t,n){var r,i,o=n(7854),a=n(8113),u=o.process,s=u&&u.versions,l=s&&s.v8;l?i=(r=l.split("."))[0]+r[1]:a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(i=r[1]),e.exports=i&&+i},748:function(e){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2109:function(e,t,n){var r=n(7854),i=n(1236).f,o=n(8880),a=n(1320),u=n(3505),s=n(9920),l=n(4705);e.exports=function(e,t){var n,c,f,p,h,d=e.target,v=e.global,y=e.stat;if(n=v?r:y?r[d]||u(d,{}):(r[d]||{}).prototype)for(c in t){if(p=t[c],f=e.noTargetGet?(h=i(n,c))&&h.value:n[c],!l(v?c:d+(y?".":"#")+c,e.forced)&&void 0!==f){if(typeof p==typeof f)continue;s(p,f)}(e.sham||f&&f.sham)&&o(p,"sham",!0),a(n,c,p,e)}}},7293:function(e){e.exports=function(e){try{return!!e()}catch(e){return!0}}},7007:function(e,t,n){"use strict";n(4916);var r=n(1320),i=n(7293),o=n(5112),a=n(2261),u=n(8880),s=o("species"),l=!i((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")})),c="$0"==="a".replace(/./,"$0"),f=o("replace"),p=!!/./[f]&&""===/./[f]("a","$0"),h=!i((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));e.exports=function(e,t,n,f){var d=o(e),v=!i((function(){var t={};return t[d]=function(){return 7},7!=""[e](t)})),y=v&&!i((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[s]=function(){return n},n.flags="",n[d]=/./[d]),n.exec=function(){return t=!0,null},n[d](""),!t}));if(!v||!y||"replace"===e&&(!l||!c||p)||"split"===e&&!h){var g=/./[d],m=n(d,""[e],(function(e,t,n,r,i){return t.exec===a?v&&!i?{done:!0,value:g.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),{REPLACE_KEEPS_$0:c,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:p}),b=m[0],x=m[1];r(String.prototype,e,b),r(RegExp.prototype,d,2==t?function(e,t){return x.call(e,this,t)}:function(e){return x.call(e,this)})}f&&u(RegExp.prototype[d],"sham",!0)}},9974:function(e,t,n){var r=n(3099);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},5005:function(e,t,n){var r=n(857),i=n(7854),o=function(e){return"function"==typeof e?e:void 0};e.exports=function(e,t){return arguments.length<2?o(r[e])||o(i[e]):r[e]&&r[e][t]||i[e]&&i[e][t]}},1246:function(e,t,n){var r=n(648),i=n(7497),o=n(5112)("iterator");e.exports=function(e){if(null!=e)return e[o]||e["@@iterator"]||i[r(e)]}},8554:function(e,t,n){var r=n(9670),i=n(1246);e.exports=function(e){var t=i(e);if("function"!=typeof t)throw TypeError(String(e)+" is not iterable");return r(t.call(e))}},647:function(e,t,n){var r=n(7908),i=Math.floor,o="".replace,a=/\$([$&'`]|\d\d?|<[^>]*>)/g,u=/\$([$&'`]|\d\d?)/g;e.exports=function(e,t,n,s,l,c){var f=n+e.length,p=s.length,h=u;return void 0!==l&&(l=r(l),h=a),o.call(c,h,(function(r,o){var a;switch(o.charAt(0)){case"$":return"$";case"&":return e;case"`":return t.slice(0,n);case"'":return t.slice(f);case"<":a=l[o.slice(1,-1)];break;default:var u=+o;if(0===u)return r;if(u>p){var c=i(u/10);return 0===c?r:c<=p?void 0===s[c-1]?o.charAt(1):s[c-1]+o.charAt(1):r}a=s[u-1]}return void 0===a?"":a}))}},7854:function(e,t,n){var r=function(e){return e&&e.Math==Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||function(){return this}()||Function("return this")()},6656:function(e){var t={}.hasOwnProperty;e.exports=function(e,n){return t.call(e,n)}},3501:function(e){e.exports={}},490:function(e,t,n){var r=n(5005);e.exports=r("document","documentElement")},4664:function(e,t,n){var r=n(9781),i=n(7293),o=n(317);e.exports=!r&&!i((function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},1179:function(e){var t=Math.abs,n=Math.pow,r=Math.floor,i=Math.log,o=Math.LN2;e.exports={pack:function(e,a,u){var s,l,c,f=new Array(u),p=8*u-a-1,h=(1<<p)-1,d=h>>1,v=23===a?n(2,-24)-n(2,-77):0,y=e<0||0===e&&1/e<0?1:0,g=0;for((e=t(e))!=e||e===1/0?(l=e!=e?1:0,s=h):(s=r(i(e)/o),e*(c=n(2,-s))<1&&(s--,c*=2),(e+=s+d>=1?v/c:v*n(2,1-d))*c>=2&&(s++,c/=2),s+d>=h?(l=0,s=h):s+d>=1?(l=(e*c-1)*n(2,a),s+=d):(l=e*n(2,d-1)*n(2,a),s=0));a>=8;f[g++]=255&l,l/=256,a-=8);for(s=s<<a|l,p+=a;p>0;f[g++]=255&s,s/=256,p-=8);return f[--g]|=128*y,f},unpack:function(e,t){var r,i=e.length,o=8*i-t-1,a=(1<<o)-1,u=a>>1,s=o-7,l=i-1,c=e[l--],f=127&c;for(c>>=7;s>0;f=256*f+e[l],l--,s-=8);for(r=f&(1<<-s)-1,f>>=-s,s+=t;s>0;r=256*r+e[l],l--,s-=8);if(0===f)f=1-u;else{if(f===a)return r?NaN:c?-1/0:1/0;r+=n(2,t),f-=u}return(c?-1:1)*r*n(2,f-t)}}},8361:function(e,t,n){var r=n(7293),i=n(4326),o="".split;e.exports=r((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==i(e)?o.call(e,""):Object(e)}:Object},9587:function(e,t,n){var r=n(111),i=n(7674);e.exports=function(e,t,n){var o,a;return i&&"function"==typeof(o=t.constructor)&&o!==n&&r(a=o.prototype)&&a!==n.prototype&&i(e,a),e}},2788:function(e,t,n){var r=n(5465),i=Function.toString;"function"!=typeof r.inspectSource&&(r.inspectSource=function(e){return i.call(e)}),e.exports=r.inspectSource},9909:function(e,t,n){var r,i,o,a=n(8536),u=n(7854),s=n(111),l=n(8880),c=n(6656),f=n(5465),p=n(6200),h=n(3501),d=u.WeakMap;if(a){var v=f.state||(f.state=new d),y=v.get,g=v.has,m=v.set;r=function(e,t){return t.facade=e,m.call(v,e,t),t},i=function(e){return y.call(v,e)||{}},o=function(e){return g.call(v,e)}}else{var b=p("state");h[b]=!0,r=function(e,t){return t.facade=e,l(e,b,t),t},i=function(e){return c(e,b)?e[b]:{}},o=function(e){return c(e,b)}}e.exports={set:r,get:i,has:o,enforce:function(e){return o(e)?i(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!s(t)||(n=i(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}}},7659:function(e,t,n){var r=n(5112),i=n(7497),o=r("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(i.Array===e||a[o]===e)}},3157:function(e,t,n){var r=n(4326);e.exports=Array.isArray||function(e){return"Array"==r(e)}},4705:function(e,t,n){var r=n(7293),i=/#|\.prototype\./,o=function(e,t){var n=u[a(e)];return n==l||n!=s&&("function"==typeof t?r(t):!!t)},a=o.normalize=function(e){return String(e).replace(i,".").toLowerCase()},u=o.data={},s=o.NATIVE="N",l=o.POLYFILL="P";e.exports=o},111:function(e){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},1913:function(e){e.exports=!1},7850:function(e,t,n){var r=n(111),i=n(4326),o=n(5112)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[o])?!!t:"RegExp"==i(e))}},9212:function(e,t,n){var r=n(9670);e.exports=function(e){var t=e.return;if(void 0!==t)return r(t.call(e)).value}},3383:function(e,t,n){"use strict";var r,i,o,a=n(7293),u=n(9518),s=n(8880),l=n(6656),c=n(5112),f=n(1913),p=c("iterator"),h=!1;[].keys&&("next"in(o=[].keys())?(i=u(u(o)))!==Object.prototype&&(r=i):h=!0);var d=null==r||a((function(){var e={};return r[p].call(e)!==e}));d&&(r={}),f&&!d||l(r,p)||s(r,p,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:h}},7497:function(e){e.exports={}},133:function(e,t,n){var r=n(7293);e.exports=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())}))},590:function(e,t,n){var r=n(7293),i=n(5112),o=n(1913),a=i("iterator");e.exports=!r((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,n="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),n+=r+e})),o&&!e.toJSON||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[a]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==n||"x"!==new URL("http://x",void 0).host}))},8536:function(e,t,n){var r=n(7854),i=n(2788),o=r.WeakMap;e.exports="function"==typeof o&&/native code/.test(i(o))},1574:function(e,t,n){"use strict";var r=n(9781),i=n(7293),o=n(1956),a=n(5181),u=n(5296),s=n(7908),l=n(8361),c=Object.assign,f=Object.defineProperty;e.exports=!c||i((function(){if(r&&1!==c({b:1},c(f({},"a",{enumerable:!0,get:function(){f(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol(),i="abcdefghijklmnopqrst";return e[n]=7,i.split("").forEach((function(e){t[e]=e})),7!=c({},e)[n]||o(c({},t)).join("")!=i}))?function(e,t){for(var n=s(e),i=arguments.length,c=1,f=a.f,p=u.f;i>c;)for(var h,d=l(arguments[c++]),v=f?o(d).concat(f(d)):o(d),y=v.length,g=0;y>g;)h=v[g++],r&&!p.call(d,h)||(n[h]=d[h]);return n}:c},30:function(e,t,n){var r,i=n(9670),o=n(6048),a=n(748),u=n(3501),s=n(490),l=n(317),c=n(6200)("IE_PROTO"),f=function(){},p=function(e){return"<script>"+e+"<\/script>"},h=function(){try{r=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e,t;h=r?function(e){e.write(p("")),e.close();var t=e.parentWindow.Object;return e=null,t}(r):((t=l("iframe")).style.display="none",s.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(p("document.F=Object")),e.close(),e.F);for(var n=a.length;n--;)delete h.prototype[a[n]];return h()};u[c]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(f.prototype=i(e),n=new f,f.prototype=null,n[c]=e):n=h(),void 0===t?n:o(n,t)}},6048:function(e,t,n){var r=n(9781),i=n(3070),o=n(9670),a=n(1956);e.exports=r?Object.defineProperties:function(e,t){o(e);for(var n,r=a(t),u=r.length,s=0;u>s;)i.f(e,n=r[s++],t[n]);return e}},3070:function(e,t,n){var r=n(9781),i=n(4664),o=n(9670),a=n(7593),u=Object.defineProperty;t.f=r?u:function(e,t,n){if(o(e),t=a(t,!0),o(n),i)try{return u(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},1236:function(e,t,n){var r=n(9781),i=n(5296),o=n(9114),a=n(5656),u=n(7593),s=n(6656),l=n(4664),c=Object.getOwnPropertyDescriptor;t.f=r?c:function(e,t){if(e=a(e),t=u(t,!0),l)try{return c(e,t)}catch(e){}if(s(e,t))return o(!i.f.call(e,t),e[t])}},8006:function(e,t,n){var r=n(6324),i=n(748).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},5181:function(e,t){t.f=Object.getOwnPropertySymbols},9518:function(e,t,n){var r=n(6656),i=n(7908),o=n(6200),a=n(8544),u=o("IE_PROTO"),s=Object.prototype;e.exports=a?Object.getPrototypeOf:function(e){return e=i(e),r(e,u)?e[u]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?s:null}},6324:function(e,t,n){var r=n(6656),i=n(5656),o=n(1318).indexOf,a=n(3501);e.exports=function(e,t){var n,u=i(e),s=0,l=[];for(n in u)!r(a,n)&&r(u,n)&&l.push(n);for(;t.length>s;)r(u,n=t[s++])&&(~o(l,n)||l.push(n));return l}},1956:function(e,t,n){var r=n(6324),i=n(748);e.exports=Object.keys||function(e){return r(e,i)}},5296:function(e,t){"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,i=r&&!n.call({1:2},1);t.f=i?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},7674:function(e,t,n){var r=n(9670),i=n(6077);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(e){}return function(n,o){return r(n),i(o),t?e.call(n,o):n.__proto__=o,n}}():void 0)},288:function(e,t,n){"use strict";var r=n(1694),i=n(648);e.exports=r?{}.toString:function(){return"[object "+i(this)+"]"}},3887:function(e,t,n){var r=n(5005),i=n(8006),o=n(5181),a=n(9670);e.exports=r("Reflect","ownKeys")||function(e){var t=i.f(a(e)),n=o.f;return n?t.concat(n(e)):t}},857:function(e,t,n){var r=n(7854);e.exports=r},2248:function(e,t,n){var r=n(1320);e.exports=function(e,t,n){for(var i in t)r(e,i,t[i],n);return e}},1320:function(e,t,n){var r=n(7854),i=n(8880),o=n(6656),a=n(3505),u=n(2788),s=n(9909),l=s.get,c=s.enforce,f=String(String).split("String");(e.exports=function(e,t,n,u){var s,l=!!u&&!!u.unsafe,p=!!u&&!!u.enumerable,h=!!u&&!!u.noTargetGet;"function"==typeof n&&("string"!=typeof t||o(n,"name")||i(n,"name",t),(s=c(n)).source||(s.source=f.join("string"==typeof t?t:""))),e!==r?(l?!h&&e[t]&&(p=!0):delete e[t],p?e[t]=n:i(e,t,n)):p?e[t]=n:a(t,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&l(this).source||u(this)}))},7651:function(e,t,n){var r=n(4326),i=n(2261);e.exports=function(e,t){var n=e.exec;if("function"==typeof n){var o=n.call(e,t);if("object"!=typeof o)throw TypeError("RegExp exec method returned something other than an Object or null");return o}if("RegExp"!==r(e))throw TypeError("RegExp#exec called on incompatible receiver");return i.call(e,t)}},2261:function(e,t,n){"use strict";var r,i,o=n(7066),a=n(2999),u=RegExp.prototype.exec,s=String.prototype.replace,l=u,c=(r=/a/,i=/b*/g,u.call(r,"a"),u.call(i,"a"),0!==r.lastIndex||0!==i.lastIndex),f=a.UNSUPPORTED_Y||a.BROKEN_CARET,p=void 0!==/()??/.exec("")[1];(c||p||f)&&(l=function(e){var t,n,r,i,a=this,l=f&&a.sticky,h=o.call(a),d=a.source,v=0,y=e;return l&&(-1===(h=h.replace("y","")).indexOf("g")&&(h+="g"),y=String(e).slice(a.lastIndex),a.lastIndex>0&&(!a.multiline||a.multiline&&"\n"!==e[a.lastIndex-1])&&(d="(?: "+d+")",y=" "+y,v++),n=new RegExp("^(?:"+d+")",h)),p&&(n=new RegExp("^"+d+"$(?!\\s)",h)),c&&(t=a.lastIndex),r=u.call(l?n:a,y),l?r?(r.input=r.input.slice(v),r[0]=r[0].slice(v),r.index=a.lastIndex,a.lastIndex+=r[0].length):a.lastIndex=0:c&&r&&(a.lastIndex=a.global?r.index+r[0].length:t),p&&r&&r.length>1&&s.call(r[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)})),r}),e.exports=l},7066:function(e,t,n){"use strict";var r=n(9670);e.exports=function(){var e=r(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},2999:function(e,t,n){"use strict";var r=n(7293);function i(e,t){return RegExp(e,t)}t.UNSUPPORTED_Y=r((function(){var e=i("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),t.BROKEN_CARET=r((function(){var e=i("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},4488:function(e){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},3505:function(e,t,n){var r=n(7854),i=n(8880);e.exports=function(e,t){try{i(r,e,t)}catch(n){r[e]=t}return t}},6340:function(e,t,n){"use strict";var r=n(5005),i=n(3070),o=n(5112),a=n(9781),u=o("species");e.exports=function(e){var t=r(e),n=i.f;a&&t&&!t[u]&&n(t,u,{configurable:!0,get:function(){return this}})}},8003:function(e,t,n){var r=n(3070).f,i=n(6656),o=n(5112)("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,o)&&r(e,o,{configurable:!0,value:t})}},6200:function(e,t,n){var r=n(2309),i=n(9711),o=r("keys");e.exports=function(e){return o[e]||(o[e]=i(e))}},5465:function(e,t,n){var r=n(7854),i=n(3505),o="__core-js_shared__",a=r[o]||i(o,{});e.exports=a},2309:function(e,t,n){var r=n(1913),i=n(5465);(e.exports=function(e,t){return i[e]||(i[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.9.0",mode:r?"pure":"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})},6707:function(e,t,n){var r=n(9670),i=n(3099),o=n(5112)("species");e.exports=function(e,t){var n,a=r(e).constructor;return void 0===a||null==(n=r(a)[o])?t:i(n)}},8710:function(e,t,n){var r=n(9958),i=n(4488),o=function(e){return function(t,n){var o,a,u=String(i(t)),s=r(n),l=u.length;return s<0||s>=l?e?"":void 0:(o=u.charCodeAt(s))<55296||o>56319||s+1===l||(a=u.charCodeAt(s+1))<56320||a>57343?e?u.charAt(s):o:e?u.slice(s,s+2):a-56320+(o-55296<<10)+65536}};e.exports={codeAt:o(!1),charAt:o(!0)}},3197:function(e){"use strict";var t=2147483647,n=/[^\0-\u007E]/,r=/[.\u3002\uFF0E\uFF61]/g,i="Overflow: input needs wider integers to process",o=Math.floor,a=String.fromCharCode,u=function(e){return e+22+75*(e<26)},s=function(e,t,n){var r=0;for(e=n?o(e/700):e>>1,e+=o(e/t);e>455;r+=36)e=o(e/35);return o(r+36*e/(e+38))},l=function(e){var n,r,l=[],c=(e=function(e){for(var t=[],n=0,r=e.length;n<r;){var i=e.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){var o=e.charCodeAt(n++);56320==(64512&o)?t.push(((1023&i)<<10)+(1023&o)+65536):(t.push(i),n--)}else t.push(i)}return t}(e)).length,f=128,p=0,h=72;for(n=0;n<e.length;n++)(r=e[n])<128&&l.push(a(r));var d=l.length,v=d;for(d&&l.push("-");v<c;){var y=t;for(n=0;n<e.length;n++)(r=e[n])>=f&&r<y&&(y=r);var g=v+1;if(y-f>o((t-p)/g))throw RangeError(i);for(p+=(y-f)*g,f=y,n=0;n<e.length;n++){if((r=e[n])<f&&++p>t)throw RangeError(i);if(r==f){for(var m=p,b=36;;b+=36){var x=b<=h?1:b>=h+26?26:b-h;if(m<x)break;var w=m-x,E=36-x;l.push(a(u(x+w%E))),m=o(w/E)}l.push(a(u(m))),h=s(p,g,v==d),p=0,++v}}++p,++f}return l.join("")};e.exports=function(e){var t,i,o=[],a=e.toLowerCase().replace(r,".").split(".");for(t=0;t<a.length;t++)i=a[t],o.push(n.test(i)?"xn--"+l(i):i);return o.join(".")}},6091:function(e,t,n){var r=n(7293),i=n(1361);e.exports=function(e){return r((function(){return!!i[e]()||"
"!="
"[e]()||i[e].name!==e}))}},3111:function(e,t,n){var r=n(4488),i="["+n(1361)+"]",o=RegExp("^"+i+i+"*"),a=RegExp(i+i+"*$"),u=function(e){return function(t){var n=String(r(t));return 1&e&&(n=n.replace(o,"")),2&e&&(n=n.replace(a,"")),n}};e.exports={start:u(1),end:u(2),trim:u(3)}},1400:function(e,t,n){var r=n(9958),i=Math.max,o=Math.min;e.exports=function(e,t){var n=r(e);return n<0?i(n+t,0):o(n,t)}},7067:function(e,t,n){var r=n(9958),i=n(7466);e.exports=function(e){if(void 0===e)return 0;var t=r(e),n=i(t);if(t!==n)throw RangeError("Wrong length or index");return n}},5656:function(e,t,n){var r=n(8361),i=n(4488);e.exports=function(e){return r(i(e))}},9958:function(e){var t=Math.ceil,n=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?n:t)(e)}},7466:function(e,t,n){var r=n(9958),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},7908:function(e,t,n){var r=n(4488);e.exports=function(e){return Object(r(e))}},4590:function(e,t,n){var r=n(3002);e.exports=function(e,t){var n=r(e);if(n%t)throw RangeError("Wrong offset");return n}},3002:function(e,t,n){var r=n(9958);e.exports=function(e){var t=r(e);if(t<0)throw RangeError("The argument can't be less than 0");return t}},7593:function(e,t,n){var r=n(111);e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},1694:function(e,t,n){var r={};r[n(5112)("toStringTag")]="z",e.exports="[object z]"===String(r)},9843:function(e,t,n){"use strict";var r=n(2109),i=n(7854),o=n(9781),a=n(3832),u=n(260),s=n(3331),l=n(5787),c=n(9114),f=n(8880),p=n(7466),h=n(7067),d=n(4590),v=n(7593),y=n(6656),g=n(648),m=n(111),b=n(30),x=n(7674),w=n(8006).f,E=n(7321),k=n(2092).forEach,A=n(6340),S=n(3070),F=n(1236),T=n(9909),C=n(9587),L=T.get,R=T.set,I=S.f,U=F.f,O=Math.round,_=i.RangeError,M=s.ArrayBuffer,z=s.DataView,P=u.NATIVE_ARRAY_BUFFER_VIEWS,j=u.TYPED_ARRAY_TAG,D=u.TypedArray,N=u.TypedArrayPrototype,B=u.aTypedArrayConstructor,q=u.isTypedArray,W="BYTES_PER_ELEMENT",H="Wrong length",Y=function(e,t){for(var n=0,r=t.length,i=new(B(e))(r);r>n;)i[n]=t[n++];return i},G=function(e,t){I(e,t,{get:function(){return L(this)[t]}})},Q=function(e){var t;return e instanceof M||"ArrayBuffer"==(t=g(e))||"SharedArrayBuffer"==t},$=function(e,t){return q(e)&&"symbol"!=typeof t&&t in e&&String(+t)==String(t)},V=function(e,t){return $(e,t=v(t,!0))?c(2,e[t]):U(e,t)},X=function(e,t,n){return!($(e,t=v(t,!0))&&m(n)&&y(n,"value"))||y(n,"get")||y(n,"set")||n.configurable||y(n,"writable")&&!n.writable||y(n,"enumerable")&&!n.enumerable?I(e,t,n):(e[t]=n.value,e)};o?(P||(F.f=V,S.f=X,G(N,"buffer"),G(N,"byteOffset"),G(N,"byteLength"),G(N,"length")),r({target:"Object",stat:!0,forced:!P},{getOwnPropertyDescriptor:V,defineProperty:X}),e.exports=function(e,t,n){var o=e.match(/\d+$/)[0]/8,u=e+(n?"Clamped":"")+"Array",s="get"+e,c="set"+e,v=i[u],y=v,g=y&&y.prototype,S={},F=function(e,t){I(e,t,{get:function(){return function(e,t){var n=L(e);return n.view[s](t*o+n.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,r){var i=L(e);n&&(r=(r=O(r))<0?0:r>255?255:255&r),i.view[c](t*o+i.byteOffset,r,!0)}(this,t,e)},enumerable:!0})};P?a&&(y=t((function(e,t,n,r){return l(e,y,u),C(m(t)?Q(t)?void 0!==r?new v(t,d(n,o),r):void 0!==n?new v(t,d(n,o)):new v(t):q(t)?Y(y,t):E.call(y,t):new v(h(t)),e,y)})),x&&x(y,D),k(w(v),(function(e){e in y||f(y,e,v[e])})),y.prototype=g):(y=t((function(e,t,n,r){l(e,y,u);var i,a,s,c=0,f=0;if(m(t)){if(!Q(t))return q(t)?Y(y,t):E.call(y,t);i=t,f=d(n,o);var v=t.byteLength;if(void 0===r){if(v%o)throw _(H);if((a=v-f)<0)throw _(H)}else if((a=p(r)*o)+f>v)throw _(H);s=a/o}else s=h(t),i=new M(a=s*o);for(R(e,{buffer:i,byteOffset:f,byteLength:a,length:s,view:new z(i)});c<s;)F(e,c++)})),x&&x(y,D),g=y.prototype=b(N)),g.constructor!==y&&f(g,"constructor",y),j&&f(g,j,u),S[u]=y,r({global:!0,forced:y!=v,sham:!P},S),W in y||f(y,W,o),W in g||f(g,W,o),A(u)}):e.exports=function(){}},3832:function(e,t,n){var r=n(7854),i=n(7293),o=n(7072),a=n(260).NATIVE_ARRAY_BUFFER_VIEWS,u=r.ArrayBuffer,s=r.Int8Array;e.exports=!a||!i((function(){s(1)}))||!i((function(){new s(-1)}))||!o((function(e){new s,new s(null),new s(1.5),new s(e)}),!0)||i((function(){return 1!==new s(new u(2),1,void 0).length}))},3074:function(e,t,n){var r=n(260).aTypedArrayConstructor,i=n(6707);e.exports=function(e,t){for(var n=i(e,e.constructor),o=0,a=t.length,u=new(r(n))(a);a>o;)u[o]=t[o++];return u}},7321:function(e,t,n){var r=n(7908),i=n(7466),o=n(1246),a=n(7659),u=n(9974),s=n(260).aTypedArrayConstructor;e.exports=function(e){var t,n,l,c,f,p,h=r(e),d=arguments.length,v=d>1?arguments[1]:void 0,y=void 0!==v,g=o(h);if(null!=g&&!a(g))for(p=(f=g.call(h)).next,h=[];!(c=p.call(f)).done;)h.push(c.value);for(y&&d>2&&(v=u(v,arguments[2],2)),n=i(h.length),l=new(s(this))(n),t=0;n>t;t++)l[t]=y?v(h[t],t):h[t];return l}},9711:function(e){var t=0,n=Math.random();e.exports=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++t+n).toString(36)}},3307:function(e,t,n){var r=n(133);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},5112:function(e,t,n){var r=n(7854),i=n(2309),o=n(6656),a=n(9711),u=n(133),s=n(3307),l=i("wks"),c=r.Symbol,f=s?c:c&&c.withoutSetter||a;e.exports=function(e){return o(l,e)||(u&&o(c,e)?l[e]=c[e]:l[e]=f("Symbol."+e)),l[e]}},1361:function(e){e.exports="\t\n\v\f\r \u2028\u2029\ufeff"},8264:function(e,t,n){"use strict";var r=n(2109),i=n(7854),o=n(3331),a=n(6340),u=o.ArrayBuffer;r({global:!0,forced:i.ArrayBuffer!==u},{ArrayBuffer:u}),a("ArrayBuffer")},2222:function(e,t,n){"use strict";var r=n(2109),i=n(7293),o=n(3157),a=n(111),u=n(7908),s=n(7466),l=n(6135),c=n(5417),f=n(1194),p=n(5112),h=n(7392),d=p("isConcatSpreadable"),v=9007199254740991,y="Maximum allowed index exceeded",g=h>=51||!i((function(){var e=[];return e[d]=!1,e.concat()[0]!==e})),m=f("concat"),b=function(e){if(!a(e))return!1;var t=e[d];return void 0!==t?!!t:o(e)};r({target:"Array",proto:!0,forced:!g||!m},{concat:function(e){var t,n,r,i,o,a=u(this),f=c(a,0),p=0;for(t=-1,r=arguments.length;t<r;t++)if(b(o=-1===t?a:arguments[t])){if(p+(i=s(o.length))>v)throw TypeError(y);for(n=0;n<i;n++,p++)n in o&&l(f,p,o[n])}else{if(p>=v)throw TypeError(y);l(f,p++,o)}return f.length=p,f}})},7327:function(e,t,n){"use strict";var r=n(2109),i=n(2092).filter;r({target:"Array",proto:!0,forced:!n(1194)("filter")},{filter:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}})},2772:function(e,t,n){"use strict";var r=n(2109),i=n(1318).indexOf,o=n(9341),a=[].indexOf,u=!!a&&1/[1].indexOf(1,-0)<0,s=o("indexOf");r({target:"Array",proto:!0,forced:u||!s},{indexOf:function(e){return u?a.apply(this,arguments)||0:i(this,e,arguments.length>1?arguments[1]:void 0)}})},6992:function(e,t,n){"use strict";var r=n(5656),i=n(1223),o=n(7497),a=n(9909),u=n(654),s="Array Iterator",l=a.set,c=a.getterFor(s);e.exports=u(Array,"Array",(function(e,t){l(this,{type:s,target:r(e),index:0,kind:t})}),(function(){var e=c(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),o.Arguments=o.Array,i("keys"),i("values"),i("entries")},1249:function(e,t,n){"use strict";var r=n(2109),i=n(2092).map;r({target:"Array",proto:!0,forced:!n(1194)("map")},{map:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}})},7042:function(e,t,n){"use strict";var r=n(2109),i=n(111),o=n(3157),a=n(1400),u=n(7466),s=n(5656),l=n(6135),c=n(5112),f=n(1194)("slice"),p=c("species"),h=[].slice,d=Math.max;r({target:"Array",proto:!0,forced:!f},{slice:function(e,t){var n,r,c,f=s(this),v=u(f.length),y=a(e,v),g=a(void 0===t?v:t,v);if(o(f)&&("function"!=typeof(n=f.constructor)||n!==Array&&!o(n.prototype)?i(n)&&null===(n=n[p])&&(n=void 0):n=void 0,n===Array||void 0===n))return h.call(f,y,g);for(r=new(void 0===n?Array:n)(d(g-y,0)),c=0;y<g;y++,c++)y in f&&l(r,c,f[y]);return r.length=c,r}})},561:function(e,t,n){"use strict";var r=n(2109),i=n(1400),o=n(9958),a=n(7466),u=n(7908),s=n(5417),l=n(6135),c=n(1194)("splice"),f=Math.max,p=Math.min,h=9007199254740991,d="Maximum allowed length exceeded";r({target:"Array",proto:!0,forced:!c},{splice:function(e,t){var n,r,c,v,y,g,m=u(this),b=a(m.length),x=i(e,b),w=arguments.length;if(0===w?n=r=0:1===w?(n=0,r=b-x):(n=w-2,r=p(f(o(t),0),b-x)),b+n-r>h)throw TypeError(d);for(c=s(m,r),v=0;v<r;v++)(y=x+v)in m&&l(c,v,m[y]);if(c.length=r,n<r){for(v=x;v<b-r;v++)g=v+n,(y=v+r)in m?m[g]=m[y]:delete m[g];for(v=b;v>b-r+n;v--)delete m[v-1]}else if(n>r)for(v=b-r;v>x;v--)g=v+n-1,(y=v+r-1)in m?m[g]=m[y]:delete m[g];for(v=0;v<n;v++)m[v+x]=arguments[v+2];return m.length=b-r+n,c}})},8309:function(e,t,n){var r=n(9781),i=n(3070).f,o=Function.prototype,a=o.toString,u=/^\s*function ([^ (]*)/,s="name";r&&!(s in o)&&i(o,s,{configurable:!0,get:function(){try{return a.call(this).match(u)[1]}catch(e){return""}}})},489:function(e,t,n){var r=n(2109),i=n(7293),o=n(7908),a=n(9518),u=n(8544);r({target:"Object",stat:!0,forced:i((function(){a(1)})),sham:!u},{getPrototypeOf:function(e){return a(o(e))}})},1539:function(e,t,n){var r=n(1694),i=n(1320),o=n(288);r||i(Object.prototype,"toString",o,{unsafe:!0})},4916:function(e,t,n){"use strict";var r=n(2109),i=n(2261);r({target:"RegExp",proto:!0,forced:/./.exec!==i},{exec:i})},9714:function(e,t,n){"use strict";var r=n(1320),i=n(9670),o=n(7293),a=n(7066),u="toString",s=RegExp.prototype,l=s.toString,c=o((function(){return"/a/b"!=l.call({source:"a",flags:"b"})})),f=l.name!=u;(c||f)&&r(RegExp.prototype,u,(function(){var e=i(this),t=String(e.source),n=e.flags;return"/"+t+"/"+String(void 0===n&&e instanceof RegExp&&!("flags"in s)?a.call(e):n)}),{unsafe:!0})},8783:function(e,t,n){"use strict";var r=n(8710).charAt,i=n(9909),o=n(654),a="String Iterator",u=i.set,s=i.getterFor(a);o(String,"String",(function(e){u(this,{type:a,string:String(e),index:0})}),(function(){var e,t=s(this),n=t.string,i=t.index;return i>=n.length?{value:void 0,done:!0}:(e=r(n,i),t.index+=e.length,{value:e,done:!1})}))},4723:function(e,t,n){"use strict";var r=n(7007),i=n(9670),o=n(7466),a=n(4488),u=n(1530),s=n(7651);r("match",1,(function(e,t,n){return[function(t){var n=a(this),r=null==t?void 0:t[e];return void 0!==r?r.call(t,n):new RegExp(t)[e](String(n))},function(e){var r=n(t,e,this);if(r.done)return r.value;var a=i(e),l=String(this);if(!a.global)return s(a,l);var c=a.unicode;a.lastIndex=0;for(var f,p=[],h=0;null!==(f=s(a,l));){var d=String(f[0]);p[h]=d,""===d&&(a.lastIndex=u(l,o(a.lastIndex),c)),h++}return 0===h?null:p}]}))},5306:function(e,t,n){"use strict";var r=n(7007),i=n(9670),o=n(7466),a=n(9958),u=n(4488),s=n(1530),l=n(647),c=n(7651),f=Math.max,p=Math.min;r("replace",2,(function(e,t,n,r){var h=r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,d=r.REPLACE_KEEPS_$0,v=h?"$":"$0";return[function(n,r){var i=u(this),o=null==n?void 0:n[e];return void 0!==o?o.call(n,i,r):t.call(String(i),n,r)},function(e,r){if(!h&&d||"string"==typeof r&&-1===r.indexOf(v)){var u=n(t,e,this,r);if(u.done)return u.value}var y=i(e),g=String(this),m="function"==typeof r;m||(r=String(r));var b=y.global;if(b){var x=y.unicode;y.lastIndex=0}for(var w=[];;){var E=c(y,g);if(null===E)break;if(w.push(E),!b)break;""===String(E[0])&&(y.lastIndex=s(g,o(y.lastIndex),x))}for(var k,A="",S=0,F=0;F<w.length;F++){E=w[F];for(var T=String(E[0]),C=f(p(a(E.index),g.length),0),L=[],R=1;R<E.length;R++)L.push(void 0===(k=E[R])?k:String(k));var I=E.groups;if(m){var U=[T].concat(L,C,g);void 0!==I&&U.push(I);var O=String(r.apply(void 0,U))}else O=l(T,g,C,L,I,r);C>=S&&(A+=g.slice(S,C)+O,S=C+T.length)}return A+g.slice(S)}]}))},3123:function(e,t,n){"use strict";var r=n(7007),i=n(7850),o=n(9670),a=n(4488),u=n(6707),s=n(1530),l=n(7466),c=n(7651),f=n(2261),p=n(7293),h=[].push,d=Math.min,v=4294967295,y=!p((function(){return!RegExp(v,"y")}));r("split",2,(function(e,t,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var r=String(a(this)),o=void 0===n?v:n>>>0;if(0===o)return[];if(void 0===e)return[r];if(!i(e))return t.call(r,e,o);for(var u,s,l,c=[],p=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,y=new RegExp(e.source,p+"g");(u=f.call(y,r))&&!((s=y.lastIndex)>d&&(c.push(r.slice(d,u.index)),u.length>1&&u.index<r.length&&h.apply(c,u.slice(1)),l=u[0].length,d=s,c.length>=o));)y.lastIndex===u.index&&y.lastIndex++;return d===r.length?!l&&y.test("")||c.push(""):c.push(r.slice(d)),c.length>o?c.slice(0,o):c}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:t.call(this,e,n)}:t,[function(t,n){var i=a(this),o=null==t?void 0:t[e];return void 0!==o?o.call(t,i,n):r.call(String(i),t,n)},function(e,i){var a=n(r,e,this,i,r!==t);if(a.done)return a.value;var f=o(e),p=String(this),h=u(f,RegExp),g=f.unicode,m=(f.ignoreCase?"i":"")+(f.multiline?"m":"")+(f.unicode?"u":"")+(y?"y":"g"),b=new h(y?f:"^(?:"+f.source+")",m),x=void 0===i?v:i>>>0;if(0===x)return[];if(0===p.length)return null===c(b,p)?[p]:[];for(var w=0,E=0,k=[];E<p.length;){b.lastIndex=y?E:0;var A,S=c(b,y?p:p.slice(E));if(null===S||(A=d(l(b.lastIndex+(y?0:E)),p.length))===w)E=s(p,E,g);else{if(k.push(p.slice(w,E)),k.length===x)return k;for(var F=1;F<=S.length-1;F++)if(k.push(S[F]),k.length===x)return k;E=w=A}}return k.push(p.slice(w)),k}]}),!y)},3210:function(e,t,n){"use strict";var r=n(2109),i=n(3111).trim;r({target:"String",proto:!0,forced:n(6091)("trim")},{trim:function(){return i(this)}})},2990:function(e,t,n){"use strict";var r=n(260),i=n(1048),o=r.aTypedArray;(0,r.exportTypedArrayMethod)("copyWithin",(function(e,t){return i.call(o(this),e,t,arguments.length>2?arguments[2]:void 0)}))},8927:function(e,t,n){"use strict";var r=n(260),i=n(2092).every,o=r.aTypedArray;(0,r.exportTypedArrayMethod)("every",(function(e){return i(o(this),e,arguments.length>1?arguments[1]:void 0)}))},3105:function(e,t,n){"use strict";var r=n(260),i=n(1285),o=r.aTypedArray;(0,r.exportTypedArrayMethod)("fill",(function(e){return i.apply(o(this),arguments)}))},5035:function(e,t,n){"use strict";var r=n(260),i=n(2092).filter,o=n(3074),a=r.aTypedArray;(0,r.exportTypedArrayMethod)("filter",(function(e){var t=i(a(this),e,arguments.length>1?arguments[1]:void 0);return o(this,t)}))},7174:function(e,t,n){"use strict";var r=n(260),i=n(2092).findIndex,o=r.aTypedArray;(0,r.exportTypedArrayMethod)("findIndex",(function(e){return i(o(this),e,arguments.length>1?arguments[1]:void 0)}))},4345:function(e,t,n){"use strict";var r=n(260),i=n(2092).find,o=r.aTypedArray;(0,r.exportTypedArrayMethod)("find",(function(e){return i(o(this),e,arguments.length>1?arguments[1]:void 0)}))},2846:function(e,t,n){"use strict";var r=n(260),i=n(2092).forEach,o=r.aTypedArray;(0,r.exportTypedArrayMethod)("forEach",(function(e){i(o(this),e,arguments.length>1?arguments[1]:void 0)}))},4731:function(e,t,n){"use strict";var r=n(260),i=n(1318).includes,o=r.aTypedArray;(0,r.exportTypedArrayMethod)("includes",(function(e){return i(o(this),e,arguments.length>1?arguments[1]:void 0)}))},7209:function(e,t,n){"use strict";var r=n(260),i=n(1318).indexOf,o=r.aTypedArray;(0,r.exportTypedArrayMethod)("indexOf",(function(e){return i(o(this),e,arguments.length>1?arguments[1]:void 0)}))},6319:function(e,t,n){"use strict";var r=n(7854),i=n(260),o=n(6992),a=n(5112)("iterator"),u=r.Uint8Array,s=o.values,l=o.keys,c=o.entries,f=i.aTypedArray,p=i.exportTypedArrayMethod,h=u&&u.prototype[a],d=!!h&&("values"==h.name||null==h.name),v=function(){return s.call(f(this))};p("entries",(function(){return c.call(f(this))})),p("keys",(function(){return l.call(f(this))})),p("values",v,!d),p(a,v,!d)},8867:function(e,t,n){"use strict";var r=n(260),i=r.aTypedArray,o=r.exportTypedArrayMethod,a=[].join;o("join",(function(e){return a.apply(i(this),arguments)}))},7789:function(e,t,n){"use strict";var r=n(260),i=n(6583),o=r.aTypedArray;(0,r.exportTypedArrayMethod)("lastIndexOf",(function(e){return i.apply(o(this),arguments)}))},3739:function(e,t,n){"use strict";var r=n(260),i=n(2092).map,o=n(6707),a=r.aTypedArray,u=r.aTypedArrayConstructor;(0,r.exportTypedArrayMethod)("map",(function(e){return i(a(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(u(o(e,e.constructor)))(t)}))}))},4483:function(e,t,n){"use strict";var r=n(260),i=n(3671).right,o=r.aTypedArray;(0,r.exportTypedArrayMethod)("reduceRight",(function(e){return i(o(this),e,arguments.length,arguments.length>1?arguments[1]:void 0)}))},9368:function(e,t,n){"use strict";var r=n(260),i=n(3671).left,o=r.aTypedArray;(0,r.exportTypedArrayMethod)("reduce",(function(e){return i(o(this),e,arguments.length,arguments.length>1?arguments[1]:void 0)}))},2056:function(e,t,n){"use strict";var r=n(260),i=r.aTypedArray,o=r.exportTypedArrayMethod,a=Math.floor;o("reverse",(function(){for(var e,t=this,n=i(t).length,r=a(n/2),o=0;o<r;)e=t[o],t[o++]=t[--n],t[n]=e;return t}))},3462:function(e,t,n){"use strict";var r=n(260),i=n(7466),o=n(4590),a=n(7908),u=n(7293),s=r.aTypedArray;(0,r.exportTypedArrayMethod)("set",(function(e){s(this);var t=o(arguments.length>1?arguments[1]:void 0,1),n=this.length,r=a(e),u=i(r.length),l=0;if(u+t>n)throw RangeError("Wrong length");for(;l<u;)this[t+l]=r[l++]}),u((function(){new Int8Array(1).set({})})))},678:function(e,t,n){"use strict";var r=n(260),i=n(6707),o=n(7293),a=r.aTypedArray,u=r.aTypedArrayConstructor,s=r.exportTypedArrayMethod,l=[].slice;s("slice",(function(e,t){for(var n=l.call(a(this),e,t),r=i(this,this.constructor),o=0,s=n.length,c=new(u(r))(s);s>o;)c[o]=n[o++];return c}),o((function(){new Int8Array(1).slice()})))},7462:function(e,t,n){"use strict";var r=n(260),i=n(2092).some,o=r.aTypedArray;(0,r.exportTypedArrayMethod)("some",(function(e){return i(o(this),e,arguments.length>1?arguments[1]:void 0)}))},3824:function(e,t,n){"use strict";var r=n(260),i=r.aTypedArray,o=r.exportTypedArrayMethod,a=[].sort;o("sort",(function(e){return a.call(i(this),e)}))},5021:function(e,t,n){"use strict";var r=n(260),i=n(7466),o=n(1400),a=n(6707),u=r.aTypedArray;(0,r.exportTypedArrayMethod)("subarray",(function(e,t){var n=u(this),r=n.length,s=o(e,r);return new(a(n,n.constructor))(n.buffer,n.byteOffset+s*n.BYTES_PER_ELEMENT,i((void 0===t?r:o(t,r))-s))}))},2974:function(e,t,n){"use strict";var r=n(7854),i=n(260),o=n(7293),a=r.Int8Array,u=i.aTypedArray,s=i.exportTypedArrayMethod,l=[].toLocaleString,c=[].slice,f=!!a&&o((function(){l.call(new a(1))}));s("toLocaleString",(function(){return l.apply(f?c.call(u(this)):u(this),arguments)}),o((function(){return[1,2].toLocaleString()!=new a([1,2]).toLocaleString()}))||!o((function(){a.prototype.toLocaleString.call([1,2])})))},5016:function(e,t,n){"use strict";var r=n(260).exportTypedArrayMethod,i=n(7293),o=n(7854).Uint8Array,a=o&&o.prototype||{},u=[].toString,s=[].join;i((function(){u.call({})}))&&(u=function(){return s.call(this)});var l=a.toString!=u;r("toString",u,l)},2472:function(e,t,n){n(9843)("Uint8",(function(e){return function(t,n,r){return e(this,t,n,r)}}))},4747:function(e,t,n){var r=n(7854),i=n(8324),o=n(8533),a=n(8880);for(var u in i){var s=r[u],l=s&&s.prototype;if(l&&l.forEach!==o)try{a(l,"forEach",o)}catch(e){l.forEach=o}}},3948:function(e,t,n){var r=n(7854),i=n(8324),o=n(6992),a=n(8880),u=n(5112),s=u("iterator"),l=u("toStringTag"),c=o.values;for(var f in i){var p=r[f],h=p&&p.prototype;if(h){if(h[s]!==c)try{a(h,s,c)}catch(e){h[s]=c}if(h[l]||a(h,l,f),i[f])for(var d in o)if(h[d]!==o[d])try{a(h,d,o[d])}catch(e){h[d]=o[d]}}}},1637:function(e,t,n){"use strict";n(6992);var r=n(2109),i=n(5005),o=n(590),a=n(1320),u=n(2248),s=n(8003),l=n(4994),c=n(9909),f=n(5787),p=n(6656),h=n(9974),d=n(648),v=n(9670),y=n(111),g=n(30),m=n(9114),b=n(8554),x=n(1246),w=n(5112),E=i("fetch"),k=i("Headers"),A=w("iterator"),S="URLSearchParams",F="URLSearchParamsIterator",T=c.set,C=c.getterFor(S),L=c.getterFor(F),R=/\+/g,I=Array(4),U=function(e){return I[e-1]||(I[e-1]=RegExp("((?:%[\\da-f]{2}){"+e+"})","gi"))},O=function(e){try{return decodeURIComponent(e)}catch(t){return e}},_=function(e){var t=e.replace(R," "),n=4;try{return decodeURIComponent(t)}catch(e){for(;n;)t=t.replace(U(n--),O);return t}},M=/[!'()~]|%20/g,z={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},P=function(e){return z[e]},j=function(e){return encodeURIComponent(e).replace(M,P)},D=function(e,t){if(t)for(var n,r,i=t.split("&"),o=0;o<i.length;)(n=i[o++]).length&&(r=n.split("="),e.push({key:_(r.shift()),value:_(r.join("="))}))},N=function(e){this.entries.length=0,D(this.entries,e)},B=function(e,t){if(e<t)throw TypeError("Not enough arguments")},q=l((function(e,t){T(this,{type:F,iterator:b(C(e).entries),kind:t})}),"Iterator",(function(){var e=L(this),t=e.kind,n=e.iterator.next(),r=n.value;return n.done||(n.value="keys"===t?r.key:"values"===t?r.value:[r.key,r.value]),n})),W=function(){f(this,W,S);var e,t,n,r,i,o,a,u,s,l=arguments.length>0?arguments[0]:void 0,c=this,h=[];if(T(c,{type:S,entries:h,updateURL:function(){},updateSearchParams:N}),void 0!==l)if(y(l))if("function"==typeof(e=x(l)))for(n=(t=e.call(l)).next;!(r=n.call(t)).done;){if((a=(o=(i=b(v(r.value))).next).call(i)).done||(u=o.call(i)).done||!o.call(i).done)throw TypeError("Expected sequence with length 2");h.push({key:a.value+"",value:u.value+""})}else for(s in l)p(l,s)&&h.push({key:s,value:l[s]+""});else D(h,"string"==typeof l?"?"===l.charAt(0)?l.slice(1):l:l+"")},H=W.prototype;u(H,{append:function(e,t){B(arguments.length,2);var n=C(this);n.entries.push({key:e+"",value:t+""}),n.updateURL()},delete:function(e){B(arguments.length,1);for(var t=C(this),n=t.entries,r=e+"",i=0;i<n.length;)n[i].key===r?n.splice(i,1):i++;t.updateURL()},get:function(e){B(arguments.length,1);for(var t=C(this).entries,n=e+"",r=0;r<t.length;r++)if(t[r].key===n)return t[r].value;return null},getAll:function(e){B(arguments.length,1);for(var t=C(this).entries,n=e+"",r=[],i=0;i<t.length;i++)t[i].key===n&&r.push(t[i].value);return r},has:function(e){B(arguments.length,1);for(var t=C(this).entries,n=e+"",r=0;r<t.length;)if(t[r++].key===n)return!0;return!1},set:function(e,t){B(arguments.length,1);for(var n,r=C(this),i=r.entries,o=!1,a=e+"",u=t+"",s=0;s<i.length;s++)(n=i[s]).key===a&&(o?i.splice(s--,1):(o=!0,n.value=u));o||i.push({key:a,value:u}),r.updateURL()},sort:function(){var e,t,n,r=C(this),i=r.entries,o=i.slice();for(i.length=0,n=0;n<o.length;n++){for(e=o[n],t=0;t<n;t++)if(i[t].key>e.key){i.splice(t,0,e);break}t===n&&i.push(e)}r.updateURL()},forEach:function(e){for(var t,n=C(this).entries,r=h(e,arguments.length>1?arguments[1]:void 0,3),i=0;i<n.length;)r((t=n[i++]).value,t.key,this)},keys:function(){return new q(this,"keys")},values:function(){return new q(this,"values")},entries:function(){return new q(this,"entries")}},{enumerable:!0}),a(H,A,H.entries),a(H,"toString",(function(){for(var e,t=C(this).entries,n=[],r=0;r<t.length;)e=t[r++],n.push(j(e.key)+"="+j(e.value));return n.join("&")}),{enumerable:!0}),s(W,S),r({global:!0,forced:!o},{URLSearchParams:W}),o||"function"!=typeof E||"function"!=typeof k||r({global:!0,enumerable:!0,forced:!0},{fetch:function(e){var t,n,r,i=[e];return arguments.length>1&&(y(t=arguments[1])&&(n=t.body,d(n)===S&&((r=t.headers?new k(t.headers):new k).has("content-type")||r.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),t=g(t,{body:m(0,String(n)),headers:m(0,r)}))),i.push(t)),E.apply(this,i)}}),e.exports={URLSearchParams:W,getState:C}},285:function(e,t,n){"use strict";n(8783);var r,i=n(2109),o=n(9781),a=n(590),u=n(7854),s=n(6048),l=n(1320),c=n(5787),f=n(6656),p=n(1574),h=n(8457),d=n(8710).codeAt,v=n(3197),y=n(8003),g=n(1637),m=n(9909),b=u.URL,x=g.URLSearchParams,w=g.getState,E=m.set,k=m.getterFor("URL"),A=Math.floor,S=Math.pow,F="Invalid scheme",T="Invalid host",C="Invalid port",L=/[A-Za-z]/,R=/[\d+-.A-Za-z]/,I=/\d/,U=/^(0x|0X)/,O=/^[0-7]+$/,_=/^\d+$/,M=/^[\dA-Fa-f]+$/,z=/[\u0000\t\u000A\u000D #%/:?@[\\]]/,P=/[\u0000\t\u000A\u000D #/:?@[\\]]/,j=/^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g,D=/[\t\u000A\u000D]/g,N=function(e,t){var n,r,i;if("["==t.charAt(0)){if("]"!=t.charAt(t.length-1))return T;if(!(n=q(t.slice(1,-1))))return T;e.host=n}else if(X(e)){if(t=v(t),z.test(t))return T;if(null===(n=B(t)))return T;e.host=n}else{if(P.test(t))return T;for(n="",r=h(t),i=0;i<r.length;i++)n+=$(r[i],H);e.host=n}},B=function(e){var t,n,r,i,o,a,u,s=e.split(".");if(s.length&&""==s[s.length-1]&&s.pop(),(t=s.length)>4)return e;for(n=[],r=0;r<t;r++){if(""==(i=s[r]))return e;if(o=10,i.length>1&&"0"==i.charAt(0)&&(o=U.test(i)?16:8,i=i.slice(8==o?1:2)),""===i)a=0;else{if(!(10==o?_:8==o?O:M).test(i))return e;a=parseInt(i,o)}n.push(a)}for(r=0;r<t;r++)if(a=n[r],r==t-1){if(a>=S(256,5-t))return null}else if(a>255)return null;for(u=n.pop(),r=0;r<n.length;r++)u+=n[r]*S(256,3-r);return u},q=function(e){var t,n,r,i,o,a,u,s=[0,0,0,0,0,0,0,0],l=0,c=null,f=0,p=function(){return e.charAt(f)};if(":"==p()){if(":"!=e.charAt(1))return;f+=2,c=++l}for(;p();){if(8==l)return;if(":"!=p()){for(t=n=0;n<4&&M.test(p());)t=16*t+parseInt(p(),16),f++,n++;if("."==p()){if(0==n)return;if(f-=n,l>6)return;for(r=0;p();){if(i=null,r>0){if(!("."==p()&&r<4))return;f++}if(!I.test(p()))return;for(;I.test(p());){if(o=parseInt(p(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;f++}s[l]=256*s[l]+i,2!=++r&&4!=r||l++}if(4!=r)return;break}if(":"==p()){if(f++,!p())return}else if(p())return;s[l++]=t}else{if(null!==c)return;f++,c=++l}}if(null!==c)for(a=l-c,l=7;0!=l&&a>0;)u=s[l],s[l--]=s[c+a-1],s[c+--a]=u;else if(8!=l)return;return s},W=function(e){var t,n,r,i;if("number"==typeof e){for(t=[],n=0;n<4;n++)t.unshift(e%256),e=A(e/256);return t.join(".")}if("object"==typeof e){for(t="",r=function(e){for(var t=null,n=1,r=null,i=0,o=0;o<8;o++)0!==e[o]?(i>n&&(t=r,n=i),r=null,i=0):(null===r&&(r=o),++i);return i>n&&(t=r,n=i),t}(e),n=0;n<8;n++)i&&0===e[n]||(i&&(i=!1),r===n?(t+=n?":":"::",i=!0):(t+=e[n].toString(16),n<7&&(t+=":")));return"["+t+"]"}return e},H={},Y=p({},H,{" ":1,'"':1,"<":1,">":1,"`":1}),G=p({},Y,{"#":1,"?":1,"{":1,"}":1}),Q=p({},G,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),$=function(e,t){var n=d(e,0);return n>32&&n<127&&!f(t,e)?e:encodeURIComponent(e)},V={ftp:21,file:null,http:80,https:443,ws:80,wss:443},X=function(e){return f(V,e.scheme)},K=function(e){return""!=e.username||""!=e.password},Z=function(e){return!e.host||e.cannotBeABaseURL||"file"==e.scheme},J=function(e,t){var n;return 2==e.length&&L.test(e.charAt(0))&&(":"==(n=e.charAt(1))||!t&&"|"==n)},ee=function(e){var t;return e.length>1&&J(e.slice(0,2))&&(2==e.length||"/"===(t=e.charAt(2))||"\\"===t||"?"===t||"#"===t)},te=function(e){var t=e.path,n=t.length;!n||"file"==e.scheme&&1==n&&J(t[0],!0)||t.pop()},ne=function(e){return"."===e||"%2e"===e.toLowerCase()},re={},ie={},oe={},ae={},ue={},se={},le={},ce={},fe={},pe={},he={},de={},ve={},ye={},ge={},me={},be={},xe={},we={},Ee={},ke={},Ae=function(e,t,n,i){var o,a,u,s,l,c=n||re,p=0,d="",v=!1,y=!1,g=!1;for(n||(e.scheme="",e.username="",e.password="",e.host=null,e.port=null,e.path=[],e.query=null,e.fragment=null,e.cannotBeABaseURL=!1,t=t.replace(j,"")),t=t.replace(D,""),o=h(t);p<=o.length;){switch(a=o[p],c){case re:if(!a||!L.test(a)){if(n)return F;c=oe;continue}d+=a.toLowerCase(),c=ie;break;case ie:if(a&&(R.test(a)||"+"==a||"-"==a||"."==a))d+=a.toLowerCase();else{if(":"!=a){if(n)return F;d="",c=oe,p=0;continue}if(n&&(X(e)!=f(V,d)||"file"==d&&(K(e)||null!==e.port)||"file"==e.scheme&&!e.host))return;if(e.scheme=d,n)return void(X(e)&&V[e.scheme]==e.port&&(e.port=null));d="","file"==e.scheme?c=ye:X(e)&&i&&i.scheme==e.scheme?c=ae:X(e)?c=ce:"/"==o[p+1]?(c=ue,p++):(e.cannotBeABaseURL=!0,e.path.push(""),c=we)}break;case oe:if(!i||i.cannotBeABaseURL&&"#"!=a)return F;if(i.cannotBeABaseURL&&"#"==a){e.scheme=i.scheme,e.path=i.path.slice(),e.query=i.query,e.fragment="",e.cannotBeABaseURL=!0,c=ke;break}c="file"==i.scheme?ye:se;continue;case ae:if("/"!=a||"/"!=o[p+1]){c=se;continue}c=fe,p++;break;case ue:if("/"==a){c=pe;break}c=xe;continue;case se:if(e.scheme=i.scheme,a==r)e.username=i.username,e.password=i.password,e.host=i.host,e.port=i.port,e.path=i.path.slice(),e.query=i.query;else if("/"==a||"\\"==a&&X(e))c=le;else if("?"==a)e.username=i.username,e.password=i.password,e.host=i.host,e.port=i.port,e.path=i.path.slice(),e.query="",c=Ee;else{if("#"!=a){e.username=i.username,e.password=i.password,e.host=i.host,e.port=i.port,e.path=i.path.slice(),e.path.pop(),c=xe;continue}e.username=i.username,e.password=i.password,e.host=i.host,e.port=i.port,e.path=i.path.slice(),e.query=i.query,e.fragment="",c=ke}break;case le:if(!X(e)||"/"!=a&&"\\"!=a){if("/"!=a){e.username=i.username,e.password=i.password,e.host=i.host,e.port=i.port,c=xe;continue}c=pe}else c=fe;break;case ce:if(c=fe,"/"!=a||"/"!=d.charAt(p+1))continue;p++;break;case fe:if("/"!=a&&"\\"!=a){c=pe;continue}break;case pe:if("@"==a){v&&(d="%40"+d),v=!0,u=h(d);for(var m=0;m<u.length;m++){var b=u[m];if(":"!=b||g){var x=$(b,Q);g?e.password+=x:e.username+=x}else g=!0}d=""}else if(a==r||"/"==a||"?"==a||"#"==a||"\\"==a&&X(e)){if(v&&""==d)return"Invalid authority";p-=h(d).length+1,d="",c=he}else d+=a;break;case he:case de:if(n&&"file"==e.scheme){c=me;continue}if(":"!=a||y){if(a==r||"/"==a||"?"==a||"#"==a||"\\"==a&&X(e)){if(X(e)&&""==d)return T;if(n&&""==d&&(K(e)||null!==e.port))return;if(s=N(e,d))return s;if(d="",c=be,n)return;continue}"["==a?y=!0:"]"==a&&(y=!1),d+=a}else{if(""==d)return T;if(s=N(e,d))return s;if(d="",c=ve,n==de)return}break;case ve:if(!I.test(a)){if(a==r||"/"==a||"?"==a||"#"==a||"\\"==a&&X(e)||n){if(""!=d){var w=parseInt(d,10);if(w>65535)return C;e.port=X(e)&&w===V[e.scheme]?null:w,d=""}if(n)return;c=be;continue}return C}d+=a;break;case ye:if(e.scheme="file","/"==a||"\\"==a)c=ge;else{if(!i||"file"!=i.scheme){c=xe;continue}if(a==r)e.host=i.host,e.path=i.path.slice(),e.query=i.query;else if("?"==a)e.host=i.host,e.path=i.path.slice(),e.query="",c=Ee;else{if("#"!=a){ee(o.slice(p).join(""))||(e.host=i.host,e.path=i.path.slice(),te(e)),c=xe;continue}e.host=i.host,e.path=i.path.slice(),e.query=i.query,e.fragment="",c=ke}}break;case ge:if("/"==a||"\\"==a){c=me;break}i&&"file"==i.scheme&&!ee(o.slice(p).join(""))&&(J(i.path[0],!0)?e.path.push(i.path[0]):e.host=i.host),c=xe;continue;case me:if(a==r||"/"==a||"\\"==a||"?"==a||"#"==a){if(!n&&J(d))c=xe;else if(""==d){if(e.host="",n)return;c=be}else{if(s=N(e,d))return s;if("localhost"==e.host&&(e.host=""),n)return;d="",c=be}continue}d+=a;break;case be:if(X(e)){if(c=xe,"/"!=a&&"\\"!=a)continue}else if(n||"?"!=a)if(n||"#"!=a){if(a!=r&&(c=xe,"/"!=a))continue}else e.fragment="",c=ke;else e.query="",c=Ee;break;case xe:if(a==r||"/"==a||"\\"==a&&X(e)||!n&&("?"==a||"#"==a)){if(".."===(l=(l=d).toLowerCase())||"%2e."===l||".%2e"===l||"%2e%2e"===l?(te(e),"/"==a||"\\"==a&&X(e)||e.path.push("")):ne(d)?"/"==a||"\\"==a&&X(e)||e.path.push(""):("file"==e.scheme&&!e.path.length&&J(d)&&(e.host&&(e.host=""),d=d.charAt(0)+":"),e.path.push(d)),d="","file"==e.scheme&&(a==r||"?"==a||"#"==a))for(;e.path.length>1&&""===e.path[0];)e.path.shift();"?"==a?(e.query="",c=Ee):"#"==a&&(e.fragment="",c=ke)}else d+=$(a,G);break;case we:"?"==a?(e.query="",c=Ee):"#"==a?(e.fragment="",c=ke):a!=r&&(e.path[0]+=$(a,H));break;case Ee:n||"#"!=a?a!=r&&("'"==a&&X(e)?e.query+="%27":e.query+="#"==a?"%23":$(a,H)):(e.fragment="",c=ke);break;case ke:a!=r&&(e.fragment+=$(a,Y))}p++}},Se=function(e){var t,n,r=c(this,Se,"URL"),i=arguments.length>1?arguments[1]:void 0,a=String(e),u=E(r,{type:"URL"});if(void 0!==i)if(i instanceof Se)t=k(i);else if(n=Ae(t={},String(i)))throw TypeError(n);if(n=Ae(u,a,null,t))throw TypeError(n);var s=u.searchParams=new x,l=w(s);l.updateSearchParams(u.query),l.updateURL=function(){u.query=String(s)||null},o||(r.href=Te.call(r),r.origin=Ce.call(r),r.protocol=Le.call(r),r.username=Re.call(r),r.password=Ie.call(r),r.host=Ue.call(r),r.hostname=Oe.call(r),r.port=_e.call(r),r.pathname=Me.call(r),r.search=ze.call(r),r.searchParams=Pe.call(r),r.hash=je.call(r))},Fe=Se.prototype,Te=function(){var e=k(this),t=e.scheme,n=e.username,r=e.password,i=e.host,o=e.port,a=e.path,u=e.query,s=e.fragment,l=t+":";return null!==i?(l+="//",K(e)&&(l+=n+(r?":"+r:"")+"@"),l+=W(i),null!==o&&(l+=":"+o)):"file"==t&&(l+="//"),l+=e.cannotBeABaseURL?a[0]:a.length?"/"+a.join("/"):"",null!==u&&(l+="?"+u),null!==s&&(l+="#"+s),l},Ce=function(){var e=k(this),t=e.scheme,n=e.port;if("blob"==t)try{return new URL(t.path[0]).origin}catch(e){return"null"}return"file"!=t&&X(e)?t+"://"+W(e.host)+(null!==n?":"+n:""):"null"},Le=function(){return k(this).scheme+":"},Re=function(){return k(this).username},Ie=function(){return k(this).password},Ue=function(){var e=k(this),t=e.host,n=e.port;return null===t?"":null===n?W(t):W(t)+":"+n},Oe=function(){var e=k(this).host;return null===e?"":W(e)},_e=function(){var e=k(this).port;return null===e?"":String(e)},Me=function(){var e=k(this),t=e.path;return e.cannotBeABaseURL?t[0]:t.length?"/"+t.join("/"):""},ze=function(){var e=k(this).query;return e?"?"+e:""},Pe=function(){return k(this).searchParams},je=function(){var e=k(this).fragment;return e?"#"+e:""},De=function(e,t){return{get:e,set:t,configurable:!0,enumerable:!0}};if(o&&s(Fe,{href:De(Te,(function(e){var t=k(this),n=String(e),r=Ae(t,n);if(r)throw TypeError(r);w(t.searchParams).updateSearchParams(t.query)})),origin:De(Ce),protocol:De(Le,(function(e){var t=k(this);Ae(t,String(e)+":",re)})),username:De(Re,(function(e){var t=k(this),n=h(String(e));if(!Z(t)){t.username="";for(var r=0;r<n.length;r++)t.username+=$(n[r],Q)}})),password:De(Ie,(function(e){var t=k(this),n=h(String(e));if(!Z(t)){t.password="";for(var r=0;r<n.length;r++)t.password+=$(n[r],Q)}})),host:De(Ue,(function(e){var t=k(this);t.cannotBeABaseURL||Ae(t,String(e),he)})),hostname:De(Oe,(function(e){var t=k(this);t.cannotBeABaseURL||Ae(t,String(e),de)})),port:De(_e,(function(e){var t=k(this);Z(t)||(""==(e=String(e))?t.port=null:Ae(t,e,ve))})),pathname:De(Me,(function(e){var t=k(this);t.cannotBeABaseURL||(t.path=[],Ae(t,e+"",be))})),search:De(ze,(function(e){var t=k(this);""==(e=String(e))?t.query=null:("?"==e.charAt(0)&&(e=e.slice(1)),t.query="",Ae(t,e,Ee)),w(t.searchParams).updateSearchParams(t.query)})),searchParams:De(Pe),hash:De(je,(function(e){var t=k(this);""!=(e=String(e))?("#"==e.charAt(0)&&(e=e.slice(1)),t.fragment="",Ae(t,e,ke)):t.fragment=null}))}),l(Fe,"toJSON",(function(){return Te.call(this)}),{enumerable:!0}),l(Fe,"toString",(function(){return Te.call(this)}),{enumerable:!0}),b){var Ne=b.createObjectURL,Be=b.revokeObjectURL;Ne&&l(Se,"createObjectURL",(function(e){return Ne.apply(b,arguments)})),Be&&l(Se,"revokeObjectURL",(function(e){return Be.apply(b,arguments)}))}y(Se,"URL"),i({global:!0,forced:!a,sham:!o},{URL:Se})}},t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return function(){"use strict";function e(e,n){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,n){if(e){if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return u=e.done,e},e:function(e){s=!0,a=e},f:function(){try{u||null==r.return||r.return()}finally{if(s)throw a}}}}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}n.r(r),n.d(r,{Dropzone:function(){return b},default:function(){return A}}),n(2222),n(7327),n(2772),n(6992),n(1249),n(7042),n(561),n(8264),n(8309),n(489),n(1539),n(4916),n(9714),n(8783),n(4723),n(5306),n(3123),n(3210),n(2472),n(2990),n(8927),n(3105),n(5035),n(4345),n(7174),n(2846),n(4731),n(7209),n(6319),n(8867),n(7789),n(3739),n(9368),n(4483),n(2056),n(3462),n(678),n(7462),n(3824),n(5021),n(2974),n(5016),n(4747),n(3948),n(285);var o=function(){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t)}var n,r;return n=t,(r=[{key:"on",value:function(e,t){return this._callbacks=this._callbacks||{},this._callbacks[e]||(this._callbacks[e]=[]),this._callbacks[e].push(t),this}},{key:"emit",value:function(t){this._callbacks=this._callbacks||{};for(var n=this._callbacks[t],r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];if(n){var a,u=e(n,!0);try{for(u.s();!(a=u.n()).done;){var s=a.value;s.apply(this,i)}}catch(e){u.e(e)}finally{u.f()}}return this.element&&this.element.dispatchEvent(this.makeEvent("dropzone:"+t,{args:i})),this}},{key:"makeEvent",value:function(e,t){var n={bubbles:!0,cancelable:!0,detail:t};if("function"==typeof window.CustomEvent)return new CustomEvent(e,n);var r=document.createEvent("CustomEvent");return r.initCustomEvent(e,n.bubbles,n.cancelable,n.detail),r}},{key:"off",value:function(e,t){if(!this._callbacks||0===arguments.length)return this._callbacks={},this;var n=this._callbacks[e];if(!n)return this;if(1===arguments.length)return delete this._callbacks[e],this;for(var r=0;r<n.length;r++){var i=n[r];if(i===t){n.splice(r,1);break}}return this}}])&&i(n.prototype,r),t}();function a(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var s={url:null,method:"post",withCredentials:!1,timeout:null,parallelUploads:2,uploadMultiple:!1,chunking:!1,forceChunking:!1,chunkSize:2e6,parallelChunkUploads:!1,retryChunks:!1,retryChunksLimit:3,maxFilesize:256,paramName:"file",createImageThumbnails:!0,maxThumbnailFilesize:10,thumbnailWidth:120,thumbnailHeight:120,thumbnailMethod:"crop",resizeWidth:null,resizeHeight:null,resizeMimeType:null,resizeQuality:.8,resizeMethod:"contain",filesizeBase:1e3,maxFiles:null,headers:null,clickable:!0,ignoreHiddenFiles:!0,acceptedFiles:null,acceptedMimeTypes:null,autoProcessQueue:!0,autoQueue:!0,addRemoveLinks:!1,previewsContainer:null,disablePreviews:!1,hiddenInputContainer:"body",capture:null,renameFilename:null,renameFile:null,forceFallback:!1,dictDefaultMessage:"Drop files here to upload",dictFallbackMessage:"Your browser does not support drag'n'drop file uploads.",dictFallbackText:"Please use the fallback form below to upload your files like in the olden days.",dictFileTooBig:"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",dictInvalidFileType:"You can't upload files of this type.",dictResponseError:"Server responded with {{statusCode}} code.",dictCancelUpload:"Cancel upload",dictUploadCanceled:"Upload canceled.",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",dictRemoveFileConfirmation:null,dictMaxFilesExceeded:"You can not upload any more files.",dictFileSizeUnits:{tb:"TB",gb:"GB",mb:"MB",kb:"KB",b:"b"},init:function(){},params:function(e,t,n){if(n)return{dzuuid:n.file.upload.uuid,dzchunkindex:n.index,dztotalfilesize:n.file.size,dzchunksize:this.options.chunkSize,dztotalchunkcount:n.file.upload.totalChunkCount,dzchunkbyteoffset:n.index*this.options.chunkSize}},accept:function(e,t){return t()},chunksUploaded:function(e,t){t()},fallback:function(){var e;this.element.className="".concat(this.element.className," dz-browser-not-supported");var t,n=a(this.element.getElementsByTagName("div"),!0);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(/(^| )dz-message($| )/.test(r.className)){e=r,r.className="dz-message";break}}}catch(e){n.e(e)}finally{n.f()}e||(e=b.createElement('<div class="dz-message"><span></span></div>'),this.element.appendChild(e));var i=e.getElementsByTagName("span")[0];return i&&(null!=i.textContent?i.textContent=this.options.dictFallbackMessage:null!=i.innerText&&(i.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize:function(e,t,n,r){var i={srcX:0,srcY:0,srcWidth:e.width,srcHeight:e.height},o=e.width/e.height;null==t&&null==n?(t=i.srcWidth,n=i.srcHeight):null==t?t=n*o:null==n&&(n=t/o);var a=(t=Math.min(t,i.srcWidth))/(n=Math.min(n,i.srcHeight));if(i.srcWidth>t||i.srcHeight>n)if("crop"===r)o>a?(i.srcHeight=e.height,i.srcWidth=i.srcHeight*a):(i.srcWidth=e.width,i.srcHeight=i.srcWidth/a);else{if("contain"!==r)throw new Error("Unknown resizeMethod '".concat(r,"'"));o>a?n=t/o:t=n*o}return i.srcX=(e.width-i.srcWidth)/2,i.srcY=(e.height-i.srcHeight)/2,i.trgWidth=t,i.trgHeight=n,i},transformFile:function(e,t){return(this.options.resizeWidth||this.options.resizeHeight)&&e.type.match(/image.*/)?this.resizeImage(e,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,t):t(e)},previewTemplate:'<div class="dz-preview dz-file-preview"> <div class="dz-image"><img data-dz-thumbnail/></div> <div class="dz-details"> <div class="dz-size"><span data-dz-size></span></div> <div class="dz-filename"><span data-dz-name></span></div> </div> <div class="dz-progress"> <span class="dz-upload" data-dz-uploadprogress></span> </div> <div class="dz-error-message"><span data-dz-errormessage></span></div> <div class="dz-success-mark"> <svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Check</title> <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <path d="M23.5,31.8431458 L17.5852419,25.9283877 C16.0248253,24.3679711 13.4910294,24.366835 11.9289322,25.9289322 C10.3700136,27.4878508 10.3665912,30.0234455 11.9283877,31.5852419 L20.4147581,40.0716123 C20.5133999,40.1702541 20.6159315,40.2626649 20.7218615,40.3488435 C22.2835669,41.8725651 24.794234,41.8626202 26.3461564,40.3106978 L43.3106978,23.3461564 C44.8771021,21.7797521 44.8758057,19.2483887 43.3137085,17.6862915 C41.7547899,16.1273729 39.2176035,16.1255422 37.6538436,17.6893022 L23.5,31.8431458 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z" stroke-opacity="0.198794158" stroke="#747474" fill-opacity="0.816519475" fill="#FFFFFF"></path> </g> </svg> </div> <div class="dz-error-mark"> <svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Error</title> <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g stroke="#747474" stroke-opacity="0.198794158" fill="#FFFFFF" fill-opacity="0.816519475"> <path d="M32.6568542,29 L38.3106978,23.3461564 C39.8771021,21.7797521 39.8758057,19.2483887 38.3137085,17.6862915 C36.7547899,16.1273729 34.2176035,16.1255422 32.6538436,17.6893022 L27,23.3431458 L21.3461564,17.6893022 C19.7823965,16.1255422 17.2452101,16.1273729 15.6862915,17.6862915 C14.1241943,19.2483887 14.1228979,21.7797521 15.6893022,23.3461564 L21.3431458,29 L15.6893022,34.6538436 C14.1228979,36.2202479 14.1241943,38.7516113 15.6862915,40.3137085 C17.2452101,41.8726271 19.7823965,41.8744578 21.3461564,40.3106978 L27,34.6568542 L32.6538436,40.3106978 C34.2176035,41.8744578 36.7547899,41.8726271 38.3137085,40.3137085 C39.8758057,38.7516113 39.8771021,36.2202479 38.3106978,34.6538436 L32.6568542,29 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z"></path> </g> </g> </svg> </div> </div> ',drop:function(e){return this.element.classList.remove("dz-drag-hover")},dragstart:function(e){},dragend:function(e){return this.element.classList.remove("dz-drag-hover")},dragenter:function(e){return this.element.classList.add("dz-drag-hover")},dragover:function(e){return this.element.classList.add("dz-drag-hover")},dragleave:function(e){return this.element.classList.remove("dz-drag-hover")},paste:function(e){},reset:function(){return this.element.classList.remove("dz-started")},addedfile:function(e){var t=this;if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer&&!this.options.disablePreviews){e.previewElement=b.createElement(this.options.previewTemplate.trim()),e.previewTemplate=e.previewElement,this.previewsContainer.appendChild(e.previewElement);var n,r=a(e.previewElement.querySelectorAll("[data-dz-name]"),!0);try{for(r.s();!(n=r.n()).done;){var i=n.value;i.textContent=e.name}}catch(e){r.e(e)}finally{r.f()}var o,u=a(e.previewElement.querySelectorAll("[data-dz-size]"),!0);try{for(u.s();!(o=u.n()).done;)(i=o.value).innerHTML=this.filesize(e.size)}catch(e){u.e(e)}finally{u.f()}this.options.addRemoveLinks&&(e._removeLink=b.createElement('<a class="dz-remove" href="javascript:undefined;" data-dz-remove>'.concat(this.options.dictRemoveFile,"</a>")),e.previewElement.appendChild(e._removeLink));var s,l=function(n){return n.preventDefault(),n.stopPropagation(),e.status===b.UPLOADING?b.confirm(t.options.dictCancelUploadConfirmation,(function(){return t.removeFile(e)})):t.options.dictRemoveFileConfirmation?b.confirm(t.options.dictRemoveFileConfirmation,(function(){return t.removeFile(e)})):t.removeFile(e)},c=a(e.previewElement.querySelectorAll("[data-dz-remove]"),!0);try{for(c.s();!(s=c.n()).done;)s.value.addEventListener("click",l)}catch(e){c.e(e)}finally{c.f()}}},removedfile:function(e){return null!=e.previewElement&&null!=e.previewElement.parentNode&&e.previewElement.parentNode.removeChild(e.previewElement),this._updateMaxFilesReachedClass()},thumbnail:function(e,t){if(e.previewElement){e.previewElement.classList.remove("dz-file-preview");var n,r=a(e.previewElement.querySelectorAll("[data-dz-thumbnail]"),!0);try{for(r.s();!(n=r.n()).done;){var i=n.value;i.alt=e.name,i.src=t}}catch(e){r.e(e)}finally{r.f()}return setTimeout((function(){return e.previewElement.classList.add("dz-image-preview")}),1)}},error:function(e,t){if(e.previewElement){e.previewElement.classList.add("dz-error"),"string"!=typeof t&&t.error&&(t=t.error);var n,r=a(e.previewElement.querySelectorAll("[data-dz-errormessage]"),!0);try{for(r.s();!(n=r.n()).done;)n.value.textContent=t}catch(e){r.e(e)}finally{r.f()}}},errormultiple:function(){},processing:function(e){if(e.previewElement&&(e.previewElement.classList.add("dz-processing"),e._removeLink))return e._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple:function(){},uploadprogress:function(e,t,n){if(e.previewElement){var r,i=a(e.previewElement.querySelectorAll("[data-dz-uploadprogress]"),!0);try{for(i.s();!(r=i.n()).done;){var o=r.value;"PROGRESS"===o.nodeName?o.value=t:o.style.width="".concat(t,"%")}}catch(e){i.e(e)}finally{i.f()}}},totaluploadprogress:function(){},sending:function(){},sendingmultiple:function(){},success:function(e){if(e.previewElement)return e.previewElement.classList.add("dz-success")},successmultiple:function(){},canceled:function(e){return this.emit("error",e,this.options.dictUploadCanceled)},canceledmultiple:function(){},complete:function(e){if(e._removeLink&&(e._removeLink.innerHTML=this.options.dictRemoveFile),e.previewElement)return e.previewElement.classList.add("dz-complete")},completemultiple:function(){},maxfilesexceeded:function(){},maxfilesreached:function(){},queuecomplete:function(){},addedfiles:function(){}};function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function c(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function d(e,t,n){return t&&h(e.prototype,t),n&&h(e,n),e}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t){return!t||"object"!==l(t)&&"function"!=typeof t?g(e):t}function g(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var b=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}(i,e);var t,n,r=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=m(t);if(n){var i=m(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return y(this,e)});function i(e,t){var n,o,a;if(p(this,i),(n=r.call(this)).element=e,n.version=i.version,n.clickableElements=[],n.listeners=[],n.files=[],"string"==typeof n.element&&(n.element=document.querySelector(n.element)),!n.element||null==n.element.nodeType)throw new Error("Invalid dropzone element.");if(n.element.dropzone)throw new Error("Dropzone already attached.");i.instances.push(g(n)),n.element.dropzone=g(n);var u=null!=(a=i.optionsForElement(n.element))?a:{};if(n.options=i.extend({},s,u,null!=t?t:{}),n.options.previewTemplate=n.options.previewTemplate.replace(/\n*/g,""),n.options.forceFallback||!i.isBrowserSupported())return y(n,n.options.fallback.call(g(n)));if(null==n.options.url&&(n.options.url=n.element.getAttribute("action")),!n.options.url)throw new Error("No URL provided.");if(n.options.acceptedFiles&&n.options.acceptedMimeTypes)throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");if(n.options.uploadMultiple&&n.options.chunking)throw new Error("You cannot set both: uploadMultiple and chunking.");return n.options.acceptedMimeTypes&&(n.options.acceptedFiles=n.options.acceptedMimeTypes,delete n.options.acceptedMimeTypes),null!=n.options.renameFilename&&(n.options.renameFile=function(e){return n.options.renameFilename.call(g(n),e.name,e)}),"string"==typeof n.options.method&&(n.options.method=n.options.method.toUpperCase()),(o=n.getExistingFallback())&&o.parentNode&&o.parentNode.removeChild(o),!1!==n.options.previewsContainer&&(n.options.previewsContainer?n.previewsContainer=i.getElement(n.options.previewsContainer,"previewsContainer"):n.previewsContainer=n.element),n.options.clickable&&(!0===n.options.clickable?n.clickableElements=[n.element]:n.clickableElements=i.getElements(n.options.clickable,"clickable")),n.init(),n}return d(i,[{key:"getAcceptedFiles",value:function(){return this.files.filter((function(e){return e.accepted})).map((function(e){return e}))}},{key:"getRejectedFiles",value:function(){return this.files.filter((function(e){return!e.accepted})).map((function(e){return e}))}},{key:"getFilesWithStatus",value:function(e){return this.files.filter((function(t){return t.status===e})).map((function(e){return e}))}},{key:"getQueuedFiles",value:function(){return this.getFilesWithStatus(i.QUEUED)}},{key:"getUploadingFiles",value:function(){return this.getFilesWithStatus(i.UPLOADING)}},{key:"getAddedFiles",value:function(){return this.getFilesWithStatus(i.ADDED)}},{key:"getActiveFiles",value:function(){return this.files.filter((function(e){return e.status===i.UPLOADING||e.status===i.QUEUED})).map((function(e){return e}))}},{key:"init",value:function(){var e=this;"form"===this.element.tagName&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(i.createElement('<div class="dz-default dz-message"><button class="dz-button" type="button">'.concat(this.options.dictDefaultMessage,"</button></div>"))),this.clickableElements.length&&function t(){e.hiddenFileInput&&e.hiddenFileInput.parentNode.removeChild(e.hiddenFileInput),e.hiddenFileInput=document.createElement("input"),e.hiddenFileInput.setAttribute("type","file"),(null===e.options.maxFiles||e.options.maxFiles>1)&&e.hiddenFileInput.setAttribute("multiple","multiple"),e.hiddenFileInput.className="dz-hidden-input",null!==e.options.acceptedFiles&&e.hiddenFileInput.setAttribute("accept",e.options.acceptedFiles),null!==e.options.capture&&e.hiddenFileInput.setAttribute("capture",e.options.capture),e.hiddenFileInput.setAttribute("tabindex","-1"),e.hiddenFileInput.style.visibility="hidden",e.hiddenFileInput.style.position="absolute",e.hiddenFileInput.style.top="0",e.hiddenFileInput.style.left="0",e.hiddenFileInput.style.height="0",e.hiddenFileInput.style.width="0",i.getElement(e.options.hiddenInputContainer,"hiddenInputContainer").appendChild(e.hiddenFileInput),e.hiddenFileInput.addEventListener("change",(function(){var n=e.hiddenFileInput.files;if(n.length){var r,i=c(n,!0);try{for(i.s();!(r=i.n()).done;){var o=r.value;e.addFile(o)}}catch(e){i.e(e)}finally{i.f()}}e.emit("addedfiles",n),t()}))}(),this.URL=null!==window.URL?window.URL:window.webkitURL;var t,n=c(this.events,!0);try{for(n.s();!(t=n.n()).done;){var r=t.value;this.on(r,this.options[r])}}catch(e){n.e(e)}finally{n.f()}this.on("uploadprogress",(function(){return e.updateTotalUploadProgress()})),this.on("removedfile",(function(){return e.updateTotalUploadProgress()})),this.on("canceled",(function(t){return e.emit("complete",t)})),this.on("complete",(function(t){if(0===e.getAddedFiles().length&&0===e.getUploadingFiles().length&&0===e.getQueuedFiles().length)return setTimeout((function(){return e.emit("queuecomplete")}),0)}));var o=function(e){if(function(e){if(e.dataTransfer.types)for(var t=0;t<e.dataTransfer.types.length;t++)if("Files"===e.dataTransfer.types[t])return!0;return!1}(e))return e.stopPropagation(),e.preventDefault?e.preventDefault():e.returnValue=!1};return this.listeners=[{element:this.element,events:{dragstart:function(t){return e.emit("dragstart",t)},dragenter:function(t){return o(t),e.emit("dragenter",t)},dragover:function(t){var n;try{n=t.dataTransfer.effectAllowed}catch(e){}return t.dataTransfer.dropEffect="move"===n||"linkMove"===n?"move":"copy",o(t),e.emit("dragover",t)},dragleave:function(t){return e.emit("dragleave",t)},drop:function(t){return o(t),e.drop(t)},dragend:function(t){return e.emit("dragend",t)}}}],this.clickableElements.forEach((function(t){return e.listeners.push({element:t,events:{click:function(n){return(t!==e.element||n.target===e.element||i.elementInside(n.target,e.element.querySelector(".dz-message")))&&e.hiddenFileInput.click(),!0}}})})),this.enable(),this.options.init.call(this)}},{key:"destroy",value:function(){return this.disable(),this.removeAllFiles(!0),(null!=this.hiddenFileInput?this.hiddenFileInput.parentNode:void 0)&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,i.instances.splice(i.instances.indexOf(this),1)}},{key:"updateTotalUploadProgress",value:function(){var e,t=0,n=0;if(this.getActiveFiles().length){var r,i=c(this.getActiveFiles(),!0);try{for(i.s();!(r=i.n()).done;){var o=r.value;t+=o.upload.bytesSent,n+=o.upload.total}}catch(e){i.e(e)}finally{i.f()}e=100*t/n}else e=100;return this.emit("totaluploadprogress",e,n,t)}},{key:"_getParamName",value:function(e){return"function"==typeof this.options.paramName?this.options.paramName(e):"".concat(this.options.paramName).concat(this.options.uploadMultiple?"[".concat(e,"]"):"")}},{key:"_renameFile",value:function(e){return"function"!=typeof this.options.renameFile?e.name:this.options.renameFile(e)}},{key:"getFallbackForm",value:function(){var e,t;if(e=this.getExistingFallback())return e;var n='<div class="dz-fallback">';this.options.dictFallbackText&&(n+="<p>".concat(this.options.dictFallbackText,"</p>")),n+='<input type="file" name="'.concat(this._getParamName(0),'" ').concat(this.options.uploadMultiple?'multiple="multiple"':void 0,' /><input type="submit" value="Upload!"></div>');var r=i.createElement(n);return"FORM"!==this.element.tagName?(t=i.createElement('<form action="'.concat(this.options.url,'" enctype="multipart/form-data" method="').concat(this.options.method,'"></form>'))).appendChild(r):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=t?t:r}},{key:"getExistingFallback",value:function(){for(var e=function(e){var t,n=c(e,!0);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(/(^| )fallback($| )/.test(r.className))return r}}catch(e){n.e(e)}finally{n.f()}},t=0,n=["div","form"];t<n.length;t++){var r,i=n[t];if(r=e(this.element.getElementsByTagName(i)))return r}}},{key:"setupEventListeners",value:function(){return this.listeners.map((function(e){return function(){var t=[];for(var n in e.events){var r=e.events[n];t.push(e.element.addEventListener(n,r,!1))}return t}()}))}},{key:"removeEventListeners",value:function(){return this.listeners.map((function(e){return function(){var t=[];for(var n in e.events){var r=e.events[n];t.push(e.element.removeEventListener(n,r,!1))}return t}()}))}},{key:"disable",value:function(){var e=this;return this.clickableElements.forEach((function(e){return e.classList.remove("dz-clickable")})),this.removeEventListeners(),this.disabled=!0,this.files.map((function(t){return e.cancelUpload(t)}))}},{key:"enable",value:function(){return delete this.disabled,this.clickableElements.forEach((function(e){return e.classList.add("dz-clickable")})),this.setupEventListeners()}},{key:"filesize",value:function(e){var t=0,n="b";if(e>0){for(var r=["tb","gb","mb","kb","b"],i=0;i<r.length;i++){var o=r[i];if(e>=Math.pow(this.options.filesizeBase,4-i)/10){t=e/Math.pow(this.options.filesizeBase,4-i),n=o;break}}t=Math.round(10*t)/10}return"<strong>".concat(t,"</strong> ").concat(this.options.dictFileSizeUnits[n])}},{key:"_updateMaxFilesReachedClass",value:function(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")}},{key:"drop",value:function(e){if(e.dataTransfer){this.emit("drop",e);for(var t=[],n=0;n<e.dataTransfer.files.length;n++)t[n]=e.dataTransfer.files[n];if(t.length){var r=e.dataTransfer.items;r&&r.length&&null!=r[0].webkitGetAsEntry?this._addFilesFromItems(r):this.handleFiles(t)}this.emit("addedfiles",t)}}},{key:"paste",value:function(e){if(null!=(null!=(t=null!=e?e.clipboardData:void 0)?function(e){return e.items}(t):void 0)){var t;this.emit("paste",e);var n=e.clipboardData.items;return n.length?this._addFilesFromItems(n):void 0}}},{key:"handleFiles",value:function(e){var t,n=c(e,!0);try{for(n.s();!(t=n.n()).done;){var r=t.value;this.addFile(r)}}catch(e){n.e(e)}finally{n.f()}}},{key:"_addFilesFromItems",value:function(e){var t=this;return function(){var n,r=[],i=c(e,!0);try{for(i.s();!(n=i.n()).done;){var o,a=n.value;null!=a.webkitGetAsEntry&&(o=a.webkitGetAsEntry())?o.isFile?r.push(t.addFile(a.getAsFile())):o.isDirectory?r.push(t._addFilesFromDirectory(o,o.name)):r.push(void 0):null==a.getAsFile||null!=a.kind&&"file"!==a.kind?r.push(void 0):r.push(t.addFile(a.getAsFile()))}}catch(e){i.e(e)}finally{i.f()}return r}()}},{key:"_addFilesFromDirectory",value:function(e,t){var n=this,r=e.createReader(),i=function(e){return"log",n=function(t){return t.log(e)},null!=(t=console)&&"function"==typeof t.log?n(t):void 0;var t,n};return function e(){return r.readEntries((function(r){if(r.length>0){var i,o=c(r,!0);try{for(o.s();!(i=o.n()).done;){var a=i.value;a.isFile?a.file((function(e){if(!n.options.ignoreHiddenFiles||"."!==e.name.substring(0,1))return e.fullPath="".concat(t,"/").concat(e.name),n.addFile(e)})):a.isDirectory&&n._addFilesFromDirectory(a,"".concat(t,"/").concat(a.name))}}catch(e){o.e(e)}finally{o.f()}e()}return null}),i)}()}},{key:"accept",value:function(e,t){this.options.maxFilesize&&e.size>1024*this.options.maxFilesize*1024?t(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(e.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):i.isValidFile(e,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(t(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",e)):this.options.accept.call(this,e,t):t(this.options.dictInvalidFileType)}},{key:"addFile",value:function(e){var t=this;e.upload={uuid:i.uuidv4(),progress:0,total:e.size,bytesSent:0,filename:this._renameFile(e)},this.files.push(e),e.status=i.ADDED,this.emit("addedfile",e),this._enqueueThumbnail(e),this.accept(e,(function(n){n?(e.accepted=!1,t._errorProcessing([e],n)):(e.accepted=!0,t.options.autoQueue&&t.enqueueFile(e)),t._updateMaxFilesReachedClass()}))}},{key:"enqueueFiles",value:function(e){var t,n=c(e,!0);try{for(n.s();!(t=n.n()).done;){var r=t.value;this.enqueueFile(r)}}catch(e){n.e(e)}finally{n.f()}return null}},{key:"enqueueFile",value:function(e){var t=this;if(e.status!==i.ADDED||!0!==e.accepted)throw new Error("This file can't be queued because it has already been processed or was rejected.");if(e.status=i.QUEUED,this.options.autoProcessQueue)return setTimeout((function(){return t.processQueue()}),0)}},{key:"_enqueueThumbnail",value:function(e){var t=this;if(this.options.createImageThumbnails&&e.type.match(/image.*/)&&e.size<=1024*this.options.maxThumbnailFilesize*1024)return this._thumbnailQueue.push(e),setTimeout((function(){return t._processThumbnailQueue()}),0)}},{key:"_processThumbnailQueue",value:function(){var e=this;if(!this._processingThumbnail&&0!==this._thumbnailQueue.length){this._processingThumbnail=!0;var t=this._thumbnailQueue.shift();return this.createThumbnail(t,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,!0,(function(n){return e.emit("thumbnail",t,n),e._processingThumbnail=!1,e._processThumbnailQueue()}))}}},{key:"removeFile",value:function(e){if(e.status===i.UPLOADING&&this.cancelUpload(e),this.files=x(this.files,e),this.emit("removedfile",e),0===this.files.length)return this.emit("reset")}},{key:"removeAllFiles",value:function(e){null==e&&(e=!1);var t,n=c(this.files.slice(),!0);try{for(n.s();!(t=n.n()).done;){var r=t.value;(r.status!==i.UPLOADING||e)&&this.removeFile(r)}}catch(e){n.e(e)}finally{n.f()}return null}},{key:"resizeImage",value:function(e,t,n,r,o){var a=this;return this.createThumbnail(e,t,n,r,!0,(function(t,n){if(null==n)return o(e);var r=a.options.resizeMimeType;null==r&&(r=e.type);var u=n.toDataURL(r,a.options.resizeQuality);return"image/jpeg"!==r&&"image/jpg"!==r||(u=k.restore(e.dataURL,u)),o(i.dataURItoBlob(u))}))}},{key:"createThumbnail",value:function(e,t,n,r,i,o){var a=this,u=new FileReader;u.onload=function(){e.dataURL=u.result,"image/svg+xml"!==e.type?a.createThumbnailFromUrl(e,t,n,r,i,o):null!=o&&o(u.result)},u.readAsDataURL(e)}},{key:"displayExistingFile",value:function(e,t,n,r){var i=this,o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];if(this.emit("addedfile",e),this.emit("complete",e),o){var a=function(t){i.emit("thumbnail",e,t),n&&n()};e.dataURL=t,this.createThumbnailFromUrl(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,this.options.fixOrientation,a,r)}else this.emit("thumbnail",e,t),n&&n()}},{key:"createThumbnailFromUrl",value:function(e,t,n,r,i,o,a){var u=this,s=document.createElement("img");return a&&(s.crossOrigin=a),i="from-image"!=getComputedStyle(document.body).imageOrientation&&i,s.onload=function(){var a=function(e){return e(1)};return"undefined"!=typeof EXIF&&null!==EXIF&&i&&(a=function(e){return EXIF.getData(s,(function(){return e(EXIF.getTag(this,"Orientation"))}))}),a((function(i){e.width=s.width,e.height=s.height;var a=u.options.resize.call(u,e,t,n,r),l=document.createElement("canvas"),c=l.getContext("2d");switch(l.width=a.trgWidth,l.height=a.trgHeight,i>4&&(l.width=a.trgHeight,l.height=a.trgWidth),i){case 2:c.translate(l.width,0),c.scale(-1,1);break;case 3:c.translate(l.width,l.height),c.rotate(Math.PI);break;case 4:c.translate(0,l.height),c.scale(1,-1);break;case 5:c.rotate(.5*Math.PI),c.scale(1,-1);break;case 6:c.rotate(.5*Math.PI),c.translate(0,-l.width);break;case 7:c.rotate(.5*Math.PI),c.translate(l.height,-l.width),c.scale(-1,1);break;case 8:c.rotate(-.5*Math.PI),c.translate(-l.height,0)}E(c,s,null!=a.srcX?a.srcX:0,null!=a.srcY?a.srcY:0,a.srcWidth,a.srcHeight,null!=a.trgX?a.trgX:0,null!=a.trgY?a.trgY:0,a.trgWidth,a.trgHeight);var f=l.toDataURL("image/png");if(null!=o)return o(f,l)}))},null!=o&&(s.onerror=o),s.src=e.dataURL}},{key:"processQueue",value:function(){var e=this.options.parallelUploads,t=this.getUploadingFiles().length,n=t;if(!(t>=e)){var r=this.getQueuedFiles();if(r.length>0){if(this.options.uploadMultiple)return this.processFiles(r.slice(0,e-t));for(;n<e;){if(!r.length)return;this.processFile(r.shift()),n++}}}}},{key:"processFile",value:function(e){return this.processFiles([e])}},{key:"processFiles",value:function(e){var t,n=c(e,!0);try{for(n.s();!(t=n.n()).done;){var r=t.value;r.processing=!0,r.status=i.UPLOADING,this.emit("processing",r)}}catch(e){n.e(e)}finally{n.f()}return this.options.uploadMultiple&&this.emit("processingmultiple",e),this.uploadFiles(e)}},{key:"_getFilesWithXhr",value:function(e){return this.files.filter((function(t){return t.xhr===e})).map((function(e){return e}))}},{key:"cancelUpload",value:function(e){if(e.status===i.UPLOADING){var t,n=this._getFilesWithXhr(e.xhr),r=c(n,!0);try{for(r.s();!(t=r.n()).done;)t.value.status=i.CANCELED}catch(e){r.e(e)}finally{r.f()}void 0!==e.xhr&&e.xhr.abort();var o,a=c(n,!0);try{for(a.s();!(o=a.n()).done;){var u=o.value;this.emit("canceled",u)}}catch(e){a.e(e)}finally{a.f()}this.options.uploadMultiple&&this.emit("canceledmultiple",n)}else e.status!==i.ADDED&&e.status!==i.QUEUED||(e.status=i.CANCELED,this.emit("canceled",e),this.options.uploadMultiple&&this.emit("canceledmultiple",[e]));if(this.options.autoProcessQueue)return this.processQueue()}},{key:"resolveOption",value:function(e){if("function"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.apply(this,n)}return e}},{key:"uploadFile",value:function(e){return this.uploadFiles([e])}},{key:"uploadFiles",value:function(e){var t=this;this._transformFiles(e,(function(n){if(t.options.chunking){var r=n[0];e[0].upload.chunked=t.options.chunking&&(t.options.forceChunking||r.size>t.options.chunkSize),e[0].upload.totalChunkCount=Math.ceil(r.size/t.options.chunkSize)}if(e[0].upload.chunked){var o=e[0],a=n[0];o.upload.chunks=[];var u=function(){for(var n=0;void 0!==o.upload.chunks[n];)n++;if(!(n>=o.upload.totalChunkCount)){var r=n*t.options.chunkSize,u=Math.min(r+t.options.chunkSize,a.size),s={name:t._getParamName(0),data:a.webkitSlice?a.webkitSlice(r,u):a.slice(r,u),filename:o.upload.filename,chunkIndex:n};o.upload.chunks[n]={file:o,index:n,dataBlock:s,status:i.UPLOADING,progress:0,retries:0},t._uploadData(e,[s])}};if(o.upload.finishedChunkUpload=function(n,r){var a=!0;n.status=i.SUCCESS,n.dataBlock=null,n.xhr=null;for(var s=0;s<o.upload.totalChunkCount;s++){if(void 0===o.upload.chunks[s])return u();o.upload.chunks[s].status!==i.SUCCESS&&(a=!1)}a&&t.options.chunksUploaded(o,(function(){t._finished(e,r,null)}))},t.options.parallelChunkUploads)for(var s=0;s<o.upload.totalChunkCount;s++)u();else u()}else{for(var l=[],c=0;c<e.length;c++)l[c]={name:t._getParamName(c),data:n[c],filename:e[c].upload.filename};t._uploadData(e,l)}}))}},{key:"_getChunk",value:function(e,t){for(var n=0;n<e.upload.totalChunkCount;n++)if(void 0!==e.upload.chunks[n]&&e.upload.chunks[n].xhr===t)return e.upload.chunks[n]}},{key:"_uploadData",value:function(e,t){var n,r=this,o=new XMLHttpRequest,a=c(e,!0);try{for(a.s();!(n=a.n()).done;)n.value.xhr=o}catch(e){a.e(e)}finally{a.f()}e[0].upload.chunked&&(e[0].upload.chunks[t[0].chunkIndex].xhr=o);var u=this.resolveOption(this.options.method,e),s=this.resolveOption(this.options.url,e);o.open(u,s,!0),this.resolveOption(this.options.timeout,e)&&(o.timeout=this.resolveOption(this.options.timeout,e)),o.withCredentials=!!this.options.withCredentials,o.onload=function(t){r._finishedUploading(e,o,t)},o.ontimeout=function(){r._handleUploadError(e,o,"Request timedout after ".concat(r.options.timeout/1e3," seconds"))},o.onerror=function(){r._handleUploadError(e,o)},(null!=o.upload?o.upload:o).onprogress=function(t){return r._updateFilesUploadProgress(e,o,t)};var l={Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"};for(var f in this.options.headers&&i.extend(l,this.options.headers),l){var p=l[f];p&&o.setRequestHeader(f,p)}var h=new FormData;if(this.options.params){var d=this.options.params;for(var v in"function"==typeof d&&(d=d.call(this,e,o,e[0].upload.chunked?this._getChunk(e[0],o):null)),d){var y=d[v];if(Array.isArray(y))for(var g=0;g<y.length;g++)h.append(v,y[g]);else h.append(v,y)}}var m,b=c(e,!0);try{for(b.s();!(m=b.n()).done;){var x=m.value;this.emit("sending",x,o,h)}}catch(e){b.e(e)}finally{b.f()}this.options.uploadMultiple&&this.emit("sendingmultiple",e,o,h),this._addFormElementData(h);for(var w=0;w<t.length;w++){var E=t[w];h.append(E.name,E.data,E.filename)}this.submitRequest(o,h,e)}},{key:"_transformFiles",value:function(e,t){for(var n=this,r=[],i=0,o=function(o){n.options.transformFile.call(n,e[o],(function(n){r[o]=n,++i===e.length&&t(r)}))},a=0;a<e.length;a++)o(a)}},{key:"_addFormElementData",value:function(e){if("FORM"===this.element.tagName){var t,n=c(this.element.querySelectorAll("input, textarea, select, button"),!0);try{for(n.s();!(t=n.n()).done;){var r=t.value,i=r.getAttribute("name"),o=r.getAttribute("type");if(o&&(o=o.toLowerCase()),null!=i)if("SELECT"===r.tagName&&r.hasAttribute("multiple")){var a,u=c(r.options,!0);try{for(u.s();!(a=u.n()).done;){var s=a.value;s.selected&&e.append(i,s.value)}}catch(e){u.e(e)}finally{u.f()}}else(!o||"checkbox"!==o&&"radio"!==o||r.checked)&&e.append(i,r.value)}}catch(e){n.e(e)}finally{n.f()}}}},{key:"_updateFilesUploadProgress",value:function(e,t,n){if(e[0].upload.chunked){var r=e[0],i=this._getChunk(r,t);n?(i.progress=100*n.loaded/n.total,i.total=n.total,i.bytesSent=n.loaded):(i.progress=100,i.bytesSent=i.total),r.upload.progress=0,r.upload.total=0,r.upload.bytesSent=0;for(var o=0;o<r.upload.totalChunkCount;o++)r.upload.chunks[o]&&void 0!==r.upload.chunks[o].progress&&(r.upload.progress+=r.upload.chunks[o].progress,r.upload.total+=r.upload.chunks[o].total,r.upload.bytesSent+=r.upload.chunks[o].bytesSent);r.upload.progress=r.upload.progress/r.upload.totalChunkCount,this.emit("uploadprogress",r,r.upload.progress,r.upload.bytesSent)}else{var a,u=c(e,!0);try{for(u.s();!(a=u.n()).done;){var s=a.value;s.upload.total&&s.upload.bytesSent&&s.upload.bytesSent==s.upload.total||(n?(s.upload.progress=100*n.loaded/n.total,s.upload.total=n.total,s.upload.bytesSent=n.loaded):(s.upload.progress=100,s.upload.bytesSent=s.upload.total),this.emit("uploadprogress",s,s.upload.progress,s.upload.bytesSent))}}catch(e){u.e(e)}finally{u.f()}}}},{key:"_finishedUploading",value:function(e,t,n){var r;if(e[0].status!==i.CANCELED&&4===t.readyState){if("arraybuffer"!==t.responseType&&"blob"!==t.responseType&&(r=t.responseText,t.getResponseHeader("content-type")&&~t.getResponseHeader("content-type").indexOf("application/json")))try{r=JSON.parse(r)}catch(e){n=e,r="Invalid JSON response from server."}this._updateFilesUploadProgress(e,t),200<=t.status&&t.status<300?e[0].upload.chunked?e[0].upload.finishedChunkUpload(this._getChunk(e[0],t),r):this._finished(e,r,n):this._handleUploadError(e,t,r)}}},{key:"_handleUploadError",value:function(e,t,n){if(e[0].status!==i.CANCELED){if(e[0].upload.chunked&&this.options.retryChunks){var r=this._getChunk(e[0],t);if(r.retries++<this.options.retryChunksLimit)return void this._uploadData(e,[r.dataBlock]);console.warn("Retried this chunk too often. Giving up.")}this._errorProcessing(e,n||this.options.dictResponseError.replace("{{statusCode}}",t.status),t)}}},{key:"submitRequest",value:function(e,t,n){1==e.readyState?e.send(t):console.warn("Cannot send this request because the XMLHttpRequest.readyState is not OPENED.")}},{key:"_finished",value:function(e,t,n){var r,o=c(e,!0);try{for(o.s();!(r=o.n()).done;){var a=r.value;a.status=i.SUCCESS,this.emit("success",a,t,n),this.emit("complete",a)}}catch(e){o.e(e)}finally{o.f()}if(this.options.uploadMultiple&&(this.emit("successmultiple",e,t,n),this.emit("completemultiple",e)),this.options.autoProcessQueue)return this.processQueue()}},{key:"_errorProcessing",value:function(e,t,n){var r,o=c(e,!0);try{for(o.s();!(r=o.n()).done;){var a=r.value;a.status=i.ERROR,this.emit("error",a,t,n),this.emit("complete",a)}}catch(e){o.e(e)}finally{o.f()}if(this.options.uploadMultiple&&(this.emit("errormultiple",e,t,n),this.emit("completemultiple",e)),this.options.autoProcessQueue)return this.processQueue()}}],[{key:"initClass",value:function(){this.prototype.Emitter=o,this.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"],this.prototype._thumbnailQueue=[],this.prototype._processingThumbnail=!1}},{key:"extend",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];for(var i=0,o=n;i<o.length;i++){var a=o[i];for(var u in a){var s=a[u];e[u]=s}}return e}},{key:"uuidv4",value:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}}]),i}(o);b.initClass(),b.version="5.9.3",b.options={},b.optionsForElement=function(e){return e.getAttribute("id")?b.options[w(e.getAttribute("id"))]:void 0},b.instances=[],b.forElement=function(e){if("string"==typeof e&&(e=document.querySelector(e)),null==(null!=e?e.dropzone:void 0))throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");return e.dropzone},b.autoDiscover=!0,b.discover=function(){var e;if(document.querySelectorAll)e=document.querySelectorAll(".dropzone");else{e=[];var t=function(t){return function(){var n,r=[],i=c(t,!0);try{for(i.s();!(n=i.n()).done;){var o=n.value;/(^| )dropzone($| )/.test(o.className)?r.push(e.push(o)):r.push(void 0)}}catch(e){i.e(e)}finally{i.f()}return r}()};t(document.getElementsByTagName("div")),t(document.getElementsByTagName("form"))}return function(){var t,n=[],r=c(e,!0);try{for(r.s();!(t=r.n()).done;){var i=t.value;!1!==b.optionsForElement(i)?n.push(new b(i)):n.push(void 0)}}catch(e){r.e(e)}finally{r.f()}return n}()},b.blockedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i],b.isBrowserSupported=function(){var e=!0;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if("classList"in document.createElement("a")){void 0!==b.blacklistedBrowsers&&(b.blockedBrowsers=b.blacklistedBrowsers);var t,n=c(b.blockedBrowsers,!0);try{for(n.s();!(t=n.n()).done;)t.value.test(navigator.userAgent)&&(e=!1)}catch(e){n.e(e)}finally{n.f()}}else e=!1;else e=!1;return e},b.dataURItoBlob=function(e){for(var t=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],r=new ArrayBuffer(t.length),i=new Uint8Array(r),o=0,a=t.length,u=0<=a;u?o<=a:o>=a;u?o++:o--)i[o]=t.charCodeAt(o);return new Blob([r],{type:n})};var x=function(e,t){return e.filter((function(e){return e!==t})).map((function(e){return e}))},w=function(e){return e.replace(/[\-_](\w)/g,(function(e){return e.charAt(1).toUpperCase()}))};b.createElement=function(e){var t=document.createElement("div");return t.innerHTML=e,t.childNodes[0]},b.elementInside=function(e,t){if(e===t)return!0;for(;e=e.parentNode;)if(e===t)return!0;return!1},b.getElement=function(e,t){var n;if("string"==typeof e?n=document.querySelector(e):null!=e.nodeType&&(n=e),null==n)throw new Error("Invalid `".concat(t,"` option provided. Please provide a CSS selector or a plain HTML element."));return n},b.getElements=function(e,t){var n,r;if(e instanceof Array){r=[];try{var i,o=c(e,!0);try{for(o.s();!(i=o.n()).done;)n=i.value,r.push(this.getElement(n,t))}catch(e){o.e(e)}finally{o.f()}}catch(e){r=null}}else if("string"==typeof e){r=[];var a,u=c(document.querySelectorAll(e),!0);try{for(u.s();!(a=u.n()).done;)n=a.value,r.push(n)}catch(e){u.e(e)}finally{u.f()}}else null!=e.nodeType&&(r=[e]);if(null==r||!r.length)throw new Error("Invalid `".concat(t,"` option provided. Please provide a CSS selector, a plain HTML element or a list of those."));return r},b.confirm=function(e,t,n){return window.confirm(e)?t():null!=n?n():void 0},b.isValidFile=function(e,t){if(!t)return!0;t=t.split(",");var n,r=e.type,i=r.replace(/\/.*$/,""),o=c(t,!0);try{for(o.s();!(n=o.n()).done;){var a=n.value;if("."===(a=a.trim()).charAt(0)){if(-1!==e.name.toLowerCase().indexOf(a.toLowerCase(),e.name.length-a.length))return!0}else if(/\/\*$/.test(a)){if(i===a.replace(/\/.*$/,""))return!0}else if(r===a)return!0}}catch(e){o.e(e)}finally{o.f()}return!1},"undefined"!=typeof jQuery&&null!==jQuery&&(jQuery.fn.dropzone=function(e){return this.each((function(){return new b(this,e)}))}),b.ADDED="added",b.QUEUED="queued",b.ACCEPTED=b.QUEUED,b.UPLOADING="uploading",b.PROCESSING=b.UPLOADING,b.CANCELED="canceled",b.ERROR="error",b.SUCCESS="success";var E=function(e,t,n,r,i,o,a,u,s,l){var c=function(e){e.naturalWidth;var t=e.naturalHeight,n=document.createElement("canvas");n.width=1,n.height=t;var r=n.getContext("2d");r.drawImage(e,0,0);for(var i=r.getImageData(1,0,1,t).data,o=0,a=t,u=t;u>o;)0===i[4*(u-1)+3]?a=u:o=u,u=a+o>>1;var s=u/t;return 0===s?1:s}(t);return e.drawImage(t,n,r,i,o,a,u,s,l/c)},k=function(){function e(){p(this,e)}return d(e,null,[{key:"initClass",value:function(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}},{key:"encode64",value:function(e){for(var t="",n=void 0,r=void 0,i="",o=void 0,a=void 0,u=void 0,s="",l=0;o=(n=e[l++])>>2,a=(3&n)<<4|(r=e[l++])>>4,u=(15&r)<<2|(i=e[l++])>>6,s=63&i,isNaN(r)?u=s=64:isNaN(i)&&(s=64),t=t+this.KEY_STR.charAt(o)+this.KEY_STR.charAt(a)+this.KEY_STR.charAt(u)+this.KEY_STR.charAt(s),n=r=i="",o=a=u=s="",l<e.length;);return t}},{key:"restore",value:function(e,t){if(!e.match("data:image/jpeg;base64,"))return t;var n=this.decode64(e.replace("data:image/jpeg;base64,","")),r=this.slice2Segments(n),i=this.exifManipulation(t,r);return"data:image/jpeg;base64,".concat(this.encode64(i))}},{key:"exifManipulation",value:function(e,t){var n=this.getExifArray(t),r=this.insertExif(e,n);return new Uint8Array(r)}},{key:"getExifArray",value:function(e){for(var t=void 0,n=0;n<e.length;){if(255===(t=e[n])[0]&225===t[1])return t;n++}return[]}},{key:"insertExif",value:function(e,t){var n=e.replace("data:image/jpeg;base64,",""),r=this.decode64(n),i=r.indexOf(255,3),o=r.slice(0,i),a=r.slice(i),u=o;return(u=u.concat(t)).concat(a)}},{key:"slice2Segments",value:function(e){for(var t=0,n=[];!(255===e[t]&218===e[t+1]);){if(255===e[t]&216===e[t+1])t+=2;else{var r=t+(256*e[t+2]+e[t+3])+2,i=e.slice(t,r);n.push(i),t=r}if(t>e.length)break}return n}},{key:"decode64",value:function(e){var t=void 0,n=void 0,r="",i=void 0,o=void 0,a="",u=0,s=[];for(/[^A-Za-z0-9\+\/\=]/g.exec(e)&&console.warn("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\nExpect errors in decoding."),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");t=this.KEY_STR.indexOf(e.charAt(u++))<<2|(i=this.KEY_STR.indexOf(e.charAt(u++)))>>4,n=(15&i)<<4|(o=this.KEY_STR.indexOf(e.charAt(u++)))>>2,r=(3&o)<<6|(a=this.KEY_STR.indexOf(e.charAt(u++))),s.push(t),64!==o&&s.push(n),64!==a&&s.push(r),t=n=r="",i=o=a="",u<e.length;);return s}}]),e}();k.initClass(),b._autoDiscoverFunction=function(){if(b.autoDiscover)return b.discover()},function(e,t){var n=!1,r=!0,i=e.document,o=i.documentElement,a=i.addEventListener?"addEventListener":"attachEvent",u=i.addEventListener?"removeEventListener":"detachEvent",s=i.addEventListener?"":"on",l=function r(o){if("readystatechange"!==o.type||"complete"===i.readyState)return("load"===o.type?e:i)[u](s+o.type,r,!1),!n&&(n=!0)?t.call(e,o.type||o):void 0};if("complete"!==i.readyState){if(i.createEventObject&&o.doScroll){try{r=!e.frameElement}catch(e){}r&&function e(){try{o.doScroll("left")}catch(t){return void setTimeout(e,50)}return l("poll")}()}i[a](s+"DOMContentLoaded",l,!1),i[a](s+"readystatechange",l,!1),e[a](s+"load",l,!1)}}(window,b._autoDiscoverFunction),window.Dropzone=b;var A=b}(),r}()}));
|
||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).IMask={})}(this,(function(t){"use strict";function e(t){return"string"==typeof t||t instanceof String}function s(t){var e;return"object"==typeof t&&null!=t&&"Object"===(null==t||null==(e=t.constructor)?void 0:e.name)}function i(t,e){return Array.isArray(e)?i(t,((t,s)=>e.includes(s))):Object.entries(t).reduce(((t,s)=>{let[i,a]=s;return e(a,i)&&(t[i]=a),t}),{})}const a={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function u(t){switch(t){case a.LEFT:return a.FORCE_LEFT;case a.RIGHT:return a.FORCE_RIGHT;default:return t}}function n(t){return t.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function r(t,e){if(e===t)return!0;const s=Array.isArray(e),i=Array.isArray(t);let a;if(s&&i){if(e.length!=t.length)return!1;for(a=0;a<e.length;a++)if(!r(e[a],t[a]))return!1;return!0}if(s!=i)return!1;if(e&&t&&"object"==typeof e&&"object"==typeof t){const s=e instanceof Date,i=t instanceof Date;if(s&&i)return e.getTime()==t.getTime();if(s!=i)return!1;const u=e instanceof RegExp,n=t instanceof RegExp;if(u&&n)return e.toString()==t.toString();if(u!=n)return!1;const h=Object.keys(e);for(a=0;a<h.length;a++)if(!Object.prototype.hasOwnProperty.call(t,h[a]))return!1;for(a=0;a<h.length;a++)if(!r(t[h[a]],e[h[a]]))return!1;return!0}return!(!e||!t||"function"!=typeof e||"function"!=typeof t)&&e.toString()===t.toString()}class h{constructor(t){for(Object.assign(this,t);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?a.NONE:this.oldSelection.end!==this.cursorPos&&this.oldSelection.start!==this.cursorPos||this.oldSelection.end!==this.oldSelection.start?a.LEFT:a.RIGHT}}function o(t,e){return new o.InputMask(t,e)}function l(t){if(null==t)throw new Error("mask property should be defined");return t instanceof RegExp?o.MaskedRegExp:e(t)?o.MaskedPattern:t===Date?o.MaskedDate:t===Number?o.MaskedNumber:Array.isArray(t)||t===Array?o.MaskedDynamic:o.Masked&&t.prototype instanceof o.Masked?t:o.Masked&&t instanceof o.Masked?t.constructor:t instanceof Function?o.MaskedFunction:(console.warn("Mask not found for mask",t),o.Masked)}function p(t){if(!t)throw new Error("Options in not defined");if(o.Masked){if(t.prototype instanceof o.Masked)return{mask:t};const{mask:e,...a}=t instanceof o.Masked?{mask:t}:s(t)&&t.mask instanceof o.Masked?t:{};if(e){const t=e.mask;return{...i(e,((t,e)=>!e.startsWith("_"))),mask:e.constructor,_mask:t,...a}}}return s(t)?{...t}:{mask:t}}function d(t){if(o.Masked&&t instanceof o.Masked)return t;const e=p(t),s=l(e.mask);if(!s)throw new Error("Masked class is not found for provided mask "+e.mask+", appropriate module needs to be imported manually before creating mask.");return e.mask===s&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new s(e)}o.createMask=d;class c{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch{}return null!=t?t:this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch{}return null!=t?t:this.value.length}select(t,e){if(null!=t&&null!=e&&(t!==this.selectionStart||e!==this.selectionEnd))try{this._unsafeSelect(t,e)}catch{}}get isActive(){return!1}}o.MaskElement=c;class g extends c{constructor(t){super(),this.input=t,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var t,e,s;return null!=(t=null==(e=(s=this.input).getRootNode)?void 0:e.call(s))?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",t.drop),this.input.addEventListener("click",t.click),this.input.addEventListener("focus",t.focus),this.input.addEventListener("blur",t.commit),this._handlers=t}_onKeydown(t){return this._handlers.redo&&(90===t.keyCode&&t.shiftKey&&(t.metaKey||t.ctrlKey)||89===t.keyCode&&t.ctrlKey)?(t.preventDefault(),this._handlers.redo(t)):this._handlers.undo&&90===t.keyCode&&(t.metaKey||t.ctrlKey)?(t.preventDefault(),this._handlers.undo(t)):void(t.isComposing||this._handlers.selectionChange(t))}_onBeforeinput(t){return"historyUndo"===t.inputType&&this._handlers.undo?(t.preventDefault(),this._handlers.undo(t)):"historyRedo"===t.inputType&&this._handlers.redo?(t.preventDefault(),this._handlers.redo(t)):void 0}_onCompositionEnd(t){this._handlers.input(t)}_onInput(t){t.isComposing||this._handlers.input(t)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}o.HTMLMaskElement=g;class k extends g{constructor(t){super(t),this.input=t}get _unsafeSelectionStart(){return null!=this.input.selectionStart?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,e){this.input.setSelectionRange(t,e)}get value(){return this.input.value}set value(t){this.input.value=t}}o.HTMLMaskElement=g;class m extends g{get _unsafeSelectionStart(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),s=e&&e.anchorOffset,i=e&&e.focusOffset;return null==i||null==s||s<i?s:i}get _unsafeSelectionEnd(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),s=e&&e.anchorOffset,i=e&&e.focusOffset;return null==i||null==s||s>i?s:i}_unsafeSelect(t,e){if(!this.rootElement.createRange)return;const s=this.rootElement.createRange();s.setStart(this.input.firstChild||this.input,t),s.setEnd(this.input.lastChild||this.input,e);const i=this.rootElement,a=i.getSelection&&i.getSelection();a&&(a.removeAllRanges(),a.addRange(s))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}o.HTMLContenteditableMaskElement=m;class _{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return 0===this.states.length}push(t){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(t),this.states.length>_.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(t){return this.currentIndex=Math.min(Math.max(this.currentIndex+t,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}_.MAX_LENGTH=100;class f{constructor(t,e){this.el=t instanceof c?t:t.isContentEditable&&"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName?new m(t):new k(t),this.masked=d(e),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new _,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(t){var e;return null==t||(null==(e=this.masked)?void 0:e.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof o.Masked)&&this.masked.constructor===l(t))return void this.masked.updateOptions({mask:t});const e=t instanceof o.Masked?t:d({mask:t});e.unmaskedValue=this.masked.unmaskedValue,this.masked=e}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(t){this.rawInputValue!==t&&(this.masked.rawInputValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t,e){const s=this._listeners[t];s&&s.forEach((t=>t(e)))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){this.el&&this.el.isActive&&(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(t){const e=this.masked.unmaskedValue,s=this.masked.value,i=this.masked.rawInputValue,a=this.displayValue,u=this.unmaskedValue!==e||this.value!==s||this._rawInputValue!==i;this._unmaskedValue=e,this._value=s,this._rawInputValue=i,this.el.value!==a&&(this.el.value=a),"auto"===t?this.alignCursor():null!=t&&(this.cursorPos=t),u&&this._fireChangeEvents(),this._historyChanging||!u&&!this.history.isEmpty||this.history.push({unmaskedValue:e,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:e,...s}=t,i=!this.maskEquals(e),a=this.masked.optionsIsChanged(s);i&&(this.mask=e),a&&this.masked.updateOptions(s),(i||a)&&this.updateControl()}updateCursor(t){null!=t&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout((()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())}),10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,a.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,e){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e),this}off(t,e){if(!this._listeners[t])return this;if(!e)return delete this._listeners[t],this;const s=this._listeners[t].indexOf(e);return s>=0&&this._listeners[t].splice(s,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const e=new h({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),s=this.masked.rawInputValue,i=this.masked.splice(e.startChangePos,e.removed.length,e.inserted,e.removeDirection,{input:!0,raw:!0}).offset,u=s===this.masked.rawInputValue?e.removeDirection:a.NONE;let n=this.masked.nearestInputPos(e.startChangePos+i,u);u!==a.NONE&&(n=this.masked.nearestInputPos(n,a.NONE)),this.updateControl(n),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}o.InputMask=f;class v{static normalize(t){return Array.isArray(t)?t:[t,new v]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return Boolean(this.rawInserted)||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}o.ChangeDetails=v;class E{constructor(t,e,s){void 0===t&&(t=""),void 0===e&&(e=0),this.value=t,this.from=e,this.stop=s}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||null!=t&&this.from>=t)return"";const e=this.value[0];return this.value=this.value.slice(1),e}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class C{constructor(t){this._value="",this._update({...C.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,e){void 0===e&&(e={input:!0}),this.reset(),this.append(t,e,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,e){return t}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),Math.min(this.displayValue.length,e-t)}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),this.displayValue.slice(t,e)}extractTail(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),new E(this.extractInput(t,e),t)}appendTail(t){return e(t)&&(t=new E(String(t))),t.appendTo(this)}_appendCharRaw(t,e){return t?(this._value+=t,new v({inserted:t,rawInserted:t})):new v}_appendChar(t,e,s){void 0===e&&(e={});const i=this.state;let a;if([t,a]=this.doPrepareChar(t,e),t&&(a=a.aggregate(this._appendCharRaw(t,e)),!a.rawInserted&&"pad"===this.autofix)){const s=this.state;this.state=i;let u=this.pad(e);const n=this._appendCharRaw(t,e);u=u.aggregate(n),n.rawInserted||u.equals(a)?a=u:this.state=s}if(a.inserted){let t,u=!1!==this.doValidate(e);if(u&&null!=s){const e=this.state;if(!0===this.overwrite){t=s.state;for(let t=0;t<a.rawInserted.length;++t)s.unshift(this.displayValue.length-a.tailShift)}let i=this.appendTail(s);if(u=i.rawInserted.length===s.toString().length,!(u&&i.inserted||"shift"!==this.overwrite)){this.state=e,t=s.state;for(let t=0;t<a.rawInserted.length;++t)s.shift();i=this.appendTail(s),u=i.rawInserted.length===s.toString().length}u&&i.inserted&&(this.state=e)}u||(a=new v,this.state=i,s&&t&&(s.state=t))}return a}_appendPlaceholder(){return new v}_appendEager(){return new v}append(t,s,i){if(!e(t))throw new Error("value should be string");const a=e(i)?new E(String(i)):i;let u;null!=s&&s.tail&&(s._beforeTailState=this.state),[t,u]=this.doPrepare(t,s);for(let e=0;e<t.length;++e){const i=this._appendChar(t[e],s,a);if(!i.rawInserted&&!this.doSkipInvalid(t[e],s,a))break;u.aggregate(i)}return(!0===this.eager||"append"===this.eager)&&null!=s&&s.input&&t&&u.aggregate(this._appendEager()),null!=a&&(u.tailShift+=this.appendTail(a).tailShift),u}remove(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(e),new v}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const e=this.rawInputValue,s=this.value,i=t();return this.rawInputValue=e,this.value&&this.value!==s&&0===s.indexOf(this.value)&&(this.append(s.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,i}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const e=this.state,s=t(this);return this.state=e,delete this._isolated,s}doSkipInvalid(t,e,s){return Boolean(this.skipInvalid)}doPrepare(t,e){return void 0===e&&(e={}),v.normalize(this.prepare?this.prepare(t,this,e):t)}doPrepareChar(t,e){return void 0===e&&(e={}),v.normalize(this.prepareChar?this.prepareChar(t,this,e):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,e,s,i,n){void 0===s&&(s=""),void 0===i&&(i=a.NONE),void 0===n&&(n={input:!0});const r=t+e,h=this.extractTail(r),o=!0===this.eager||"remove"===this.eager;let l;o&&(i=u(i),l=this.extractInput(0,r,{raw:!0}));let p=t;const d=new v;if(i!==a.NONE&&(p=this.nearestInputPos(t,e>1&&0!==t&&!o?a.NONE:i),d.tailShift=p-t),d.aggregate(this.remove(p)),o&&i!==a.NONE&&l===this.rawInputValue)if(i===a.FORCE_LEFT){let t;for(;l===this.rawInputValue&&(t=this.displayValue.length);)d.aggregate(new v({tailShift:-1})).aggregate(this.remove(t-1))}else i===a.FORCE_RIGHT&&h.unshift();return d.aggregate(this.append(s,n,h))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!r(this,t)}typedValueEquals(t){const e=this.typedValue;return t===e||C.EMPTY_VALUES.includes(t)&&C.EMPTY_VALUES.includes(e)||!!this.format&&this.format(t,this)===this.format(this.typedValue,this)}pad(t){return new v}}C.DEFAULTS={skipInvalid:!0},C.EMPTY_VALUES=[void 0,null,""],o.Masked=C;class A{constructor(t,e){void 0===t&&(t=[]),void 0===e&&(e=0),this.chunks=t,this.from=e}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=e(t)?new E(String(t)):t;const s=this.chunks[this.chunks.length-1],i=s&&(s.stop===t.stop||null==t.stop)&&t.from===s.from+s.toString().length;if(t instanceof E)i?s.extend(t.toString()):this.chunks.push(t);else if(t instanceof A){if(null==t.stop){let e;for(;t.chunks.length&&null==t.chunks[0].stop;)e=t.chunks.shift(),e.from+=t.from,this.extend(e)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof o.MaskedPattern)){return new E(this.toString()).appendTo(t)}const e=new v;for(let s=0;s<this.chunks.length;++s){const i=this.chunks[s],a=t._mapPosToBlock(t.displayValue.length),u=i.stop;let n;if(null!=u&&(!a||a.index<=u)&&((i instanceof A||t._stops.indexOf(u)>=0)&&e.aggregate(t._appendPlaceholder(u)),n=i instanceof A&&t._blocks[u]),n){const s=n.appendTail(i);e.aggregate(s);const a=i.toString().slice(s.rawInserted.length);a&&e.aggregate(t.append(a,{tail:!0}))}else e.aggregate(t.append(i.toString(),{tail:!0}))}return e}get state(){return{chunks:this.chunks.map((t=>t.state)),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:e,...s}=t;Object.assign(this,s),this.chunks=e.map((t=>{const e="chunks"in t?new A:new E;return e.state=t,e}))}unshift(t){if(!this.chunks.length||null!=t&&this.from>=t)return"";const e=null!=t?t-this.from:t;let s=0;for(;s<this.chunks.length;){const t=this.chunks[s],i=t.unshift(e);if(t.toString()){if(!i)break;++s}else this.chunks.splice(s,1);if(i)return i}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const e=this.chunks[t],s=e.shift();if(e.toString()){if(!s)break;--t}else this.chunks.splice(t,1);if(s)return s}return""}}class F{constructor(t,e){this.masked=t,this._log=[];const{offset:s,index:i}=t._mapPosToBlock(e)||(e<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=s,this.index=i,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=(null==(e=this.block)?void 0:e.displayValue.length)||0){var e;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft((()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,a.FORCE_LEFT),0!==this.offset||void 0}))}pushLeftBeforeInput(){return this._pushLeft((()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,a.LEFT),!0}))}pushLeftBeforeRequired(){return this._pushLeft((()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,a.LEFT),!0}))}pushRightBeforeFilled(){return this._pushRight((()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,a.FORCE_RIGHT),this.offset!==this.block.value.length||void 0}))}pushRightBeforeInput(){return this._pushRight((()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,a.NONE),!0}))}pushRightBeforeRequired(){return this._pushRight((()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,a.NONE),!0}))}}class x{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(t,e){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(e),this._value||(this._isRawInput=!1),new v}nearestInputPos(t,e){void 0===e&&(e=a.NONE);const s=this._value.length;switch(e){case a.LEFT:case a.FORCE_LEFT:return 0;default:return s}}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),this._isRawInput?e-t:0}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),void 0===s&&(s={}),s.raw&&this._isRawInput&&this._value.slice(t,e)||""}get isComplete(){return!0}get isFilled(){return Boolean(this._value)}_appendChar(t,e){if(void 0===e&&(e={}),this.isFilled)return new v;const s=!0===this.eager||"append"===this.eager,i=this.char===t&&(this.isUnmasking||e.input||e.raw)&&(!e.raw||!s)&&!e.tail,a=new v({inserted:this.char,rawInserted:i?this.char:""});return this._value=this.char,this._isRawInput=i&&(e.raw||e.input),a}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new v;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new E("")}appendTail(t){return e(t)&&(t=new E(String(t))),t.appendTo(this)}append(t,e,s){const i=this._appendChar(t[0],e);return null!=s&&(i.tailShift+=this.appendTail(s).tailShift),i}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=Boolean(t._rawInputValue)}pad(t){return this._appendPlaceholder()}}class S{constructor(t){const{parent:e,isOptional:s,placeholderChar:i,displayChar:a,lazy:u,eager:n,...r}=t;this.masked=d(r),Object.assign(this,{parent:e,isOptional:s,placeholderChar:i,displayChar:a,lazy:u,eager:n})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.value.length),0===t&&e>=1?(this.isFilled=!1,this.masked.remove(t,e)):new v}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return Boolean(this.masked.value)||this.isOptional}_appendChar(t,e){if(void 0===e&&(e={}),this.isFilled)return new v;const s=this.masked.state;let i=this.masked._appendChar(t,this.currentMaskFlags(e));return i.inserted&&!1===this.doValidate(e)&&(i=new v,this.masked.state=s),i.inserted||this.isOptional||this.lazy||e.input||(i.inserted=this.placeholderChar),i.skip=!i.inserted&&!this.isOptional,this.isFilled=Boolean(i.inserted),i}append(t,e,s){return this.masked.append(t,this.currentMaskFlags(e),s)}_appendPlaceholder(){return this.isFilled||this.isOptional?new v:(this.isFilled=!0,new v({inserted:this.placeholderChar}))}_appendEager(){return new v}extractTail(t,e){return this.masked.extractTail(t,e)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this.value.length),this.masked.extractInput(t,e,s)}nearestInputPos(t,e){void 0===e&&(e=a.NONE);const s=this.value.length,i=Math.min(Math.max(t,0),s);switch(e){case a.LEFT:case a.FORCE_LEFT:return this.isComplete?i:0;case a.RIGHT:case a.FORCE_RIGHT:return this.isComplete?i:s;default:return i}}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.value.length),this.value.slice(t,e).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var e;return{...t,_beforeTailState:(null==t||null==(e=t._beforeTailState)?void 0:e.masked)||(null==t?void 0:t._beforeTailState)}}pad(t){return new v}}S.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class B extends C{updateOptions(t){super.updateOptions(t)}_update(t){const e=t.mask;e&&(t.validate=t=>t.search(e)>=0),super._update(t)}}o.MaskedRegExp=B;class b extends C{constructor(t){super({...b.DEFAULTS,...t,definitions:Object.assign({},S.DEFAULT_DEFINITIONS,null==t?void 0:t.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const e=this.mask;if(!e||!t)return;let s=!1,i=!1;for(let a=0;a<e.length;++a){if(this.blocks){const t=e.slice(a),s=Object.keys(this.blocks).filter((e=>0===t.indexOf(e)));s.sort(((t,e)=>e.length-t.length));const i=s[0];if(i){const{expose:t,repeat:e,...s}=p(this.blocks[i]),u={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...s,repeat:e,parent:this},n=null!=e?new o.RepeatBlock(u):d(u);n&&(this._blocks.push(n),t&&(this.exposeBlock=n),this._maskedBlocks[i]||(this._maskedBlocks[i]=[]),this._maskedBlocks[i].push(this._blocks.length-1)),a+=i.length-1;continue}}let u=e[a],n=u in t;if(u===b.STOP_CHAR){this._stops.push(this._blocks.length);continue}if("{"===u||"}"===u){s=!s;continue}if("["===u||"]"===u){i=!i;continue}if(u===b.ESCAPE_CHAR){if(++a,u=e[a],!u)break;n=!1}const r=n?new S({isOptional:i,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...p(t[u]),parent:this}):new x({char:u,eager:this.eager,isUnmasking:s});this._blocks.push(r)}}get state(){return{...super.state,_blocks:this._blocks.map((t=>t.state))}}set state(t){if(!t)return void this.reset();const{_blocks:e,...s}=t;this._blocks.forEach(((t,s)=>t.state=e[s])),super.state=s}reset(){super.reset(),this._blocks.forEach((t=>t.reset()))}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every((t=>t.isComplete))}get isFilled(){return this._blocks.every((t=>t.isFilled))}get isFixed(){return this._blocks.every((t=>t.isFixed))}get isOptional(){return this._blocks.every((t=>t.isOptional))}doCommit(){this._blocks.forEach((t=>t.doCommit())),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce(((t,e)=>t+e.unmaskedValue),"")}set unmaskedValue(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(e),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce(((t,e)=>t+e.value),"")}set value(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(e),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(e),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce(((t,e)=>t+e.displayValue),"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const e=new v;let s=null==(t=this._mapPosToBlock(this.displayValue.length))?void 0:t.index;if(null==s)return e;this._blocks[s].isFilled&&++s;for(let t=s;t<this._blocks.length;++t){const s=this._blocks[t]._appendEager();if(!s.inserted)break;e.aggregate(s)}return e}_appendCharRaw(t,e){void 0===e&&(e={});const s=this._mapPosToBlock(this.displayValue.length),i=new v;if(!s)return i;for(let u,n=s.index;u=this._blocks[n];++n){var a;const s=u._appendChar(t,{...e,_beforeTailState:null==(a=e._beforeTailState)||null==(a=a._blocks)?void 0:a[n]});if(i.aggregate(s),s.consumed)break}return i}extractTail(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const s=new A;return t===e||this._forEachBlocksInRange(t,e,((t,e,i,a)=>{const u=t.extractTail(i,a);u.stop=this._findStopBefore(e),u.from=this._blockStartPos(e),u instanceof A&&(u.blockIndex=e),s.extend(u)})),s}extractInput(t,e,s){if(void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),void 0===s&&(s={}),t===e)return"";let i="";return this._forEachBlocksInRange(t,e,((t,e,a,u)=>{i+=t.extractInput(a,u,s)})),i}_findStopBefore(t){let e;for(let s=0;s<this._stops.length;++s){const i=this._stops[s];if(!(i<=t))break;e=i}return e}_appendPlaceholder(t){const e=new v;if(this.lazy&&null==t)return e;const s=this._mapPosToBlock(this.displayValue.length);if(!s)return e;const i=s.index,a=null!=t?t:this._blocks.length;return this._blocks.slice(i,a).forEach((s=>{var i;s.lazy&&null==t||e.aggregate(s._appendPlaceholder(null==(i=s._blocks)?void 0:i.length))})),e}_mapPosToBlock(t){let e="";for(let s=0;s<this._blocks.length;++s){const i=this._blocks[s],a=e.length;if(e+=i.displayValue,t<=e.length)return{index:s,offset:t-a}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce(((t,e)=>t+e.displayValue.length),0)}_forEachBlocksInRange(t,e,s){void 0===e&&(e=this.displayValue.length);const i=this._mapPosToBlock(t);if(i){const t=this._mapPosToBlock(e),a=t&&i.index===t.index,u=i.offset,n=t&&a?t.offset:this._blocks[i.index].displayValue.length;if(s(this._blocks[i.index],i.index,u,n),t&&!a){for(let e=i.index+1;e<t.index;++e)s(this._blocks[e],e,0,this._blocks[e].displayValue.length);s(this._blocks[t.index],t.index,0,t.offset)}}}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const s=super.remove(t,e);return this._forEachBlocksInRange(t,e,((t,e,i,a)=>{s.aggregate(t.remove(i,a))})),s}nearestInputPos(t,e){if(void 0===e&&(e=a.NONE),!this._blocks.length)return 0;const s=new F(this,t);if(e===a.NONE)return s.pushRightBeforeInput()?s.pos:(s.popState(),s.pushLeftBeforeInput()?s.pos:this.displayValue.length);if(e===a.LEFT||e===a.FORCE_LEFT){if(e===a.LEFT){if(s.pushRightBeforeFilled(),s.ok&&s.pos===t)return t;s.popState()}if(s.pushLeftBeforeInput(),s.pushLeftBeforeRequired(),s.pushLeftBeforeFilled(),e===a.LEFT){if(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.ok&&s.pos<=t)return s.pos;if(s.popState(),s.ok&&s.pos<=t)return s.pos;s.popState()}return s.ok?s.pos:e===a.FORCE_LEFT?0:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:0))}return e===a.RIGHT||e===a.FORCE_RIGHT?(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.pushRightBeforeFilled()?s.pos:e===a.FORCE_RIGHT?this.displayValue.length:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:this.nearestInputPos(t,a.LEFT)))):t}totalInputPositions(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);let s=0;return this._forEachBlocksInRange(t,e,((t,e,i,a)=>{s+=t.totalInputPositions(i,a)})),s}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const e=this._maskedBlocks[t];return e?e.map((t=>this._blocks[t])):[]}pad(t){const e=new v;return this._forEachBlocksInRange(0,this.displayValue.length,(s=>e.aggregate(s.pad(t)))),e}}b.DEFAULTS={...C.DEFAULTS,lazy:!0,placeholderChar:"_"},b.STOP_CHAR="`",b.ESCAPE_CHAR="\\",b.InputDefinition=S,b.FixedDefinition=x,o.MaskedPattern=b;class D extends b{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:e=this.to||0,from:s=this.from||0,maxLength:i=this.maxLength||0,autofix:a=this.autofix,...u}=t;this.to=e,this.from=s,this.maxLength=Math.max(String(e).length,i),this.autofix=a;const n=String(this.from).padStart(this.maxLength,"0"),r=String(this.to).padStart(this.maxLength,"0");let h=0;for(;h<r.length&&r[h]===n[h];)++h;u.mask=r.slice(0,h).replace(/0/g,"\\0")+"0".repeat(this.maxLength-h),super._update(u)}get isComplete(){return super.isComplete&&Boolean(this.value)}boundaries(t){let e="",s="";const[,i,a]=t.match(/^(\D*)(\d*)(\D*)/)||[];return a&&(e="0".repeat(i.length)+a,s="9".repeat(i.length)+a),e=e.padEnd(this.maxLength,"0"),s=s.padEnd(this.maxLength,"9"),[e,s]}doPrepareChar(t,e){let s;return void 0===e&&(e={}),[t,s]=super.doPrepareChar(t.replace(/\D/g,""),e),t||(s.skip=!this.isComplete),[t,s]}_appendCharRaw(t,e){if(void 0===e&&(e={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,e);const s=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0"),[a,u]=this.boundaries(this.value+t);return Number(u)<this.from?super._appendCharRaw(s[this.value.length],e):Number(a)>this.to?!e.tail&&"pad"===this.autofix&&this.value.length+1<this.maxLength?super._appendCharRaw(s[this.value.length],e).aggregate(this._appendCharRaw(t,e)):super._appendCharRaw(i[this.value.length],e):super._appendCharRaw(t,e)}doValidate(t){const e=this.value;if(-1===e.search(/[^0]/)&&e.length<=this._matchFrom)return!0;const[s,i]=this.boundaries(e);return this.from<=Number(i)&&Number(s)<=this.to&&super.doValidate(t)}pad(t){const e=new v;if(this.value.length===this.maxLength)return e;const s=this.value,i=this.maxLength-this.value.length;if(i){this.reset();for(let s=0;s<i;++s)e.aggregate(super._appendCharRaw("0",t));s.split("").forEach((t=>this._appendCharRaw(t)))}return e}}o.MaskedRange=D;class y extends b{static extractPatternOptions(t){const{mask:s,pattern:i,...a}=t;return{...a,mask:e(s)?s:i}}constructor(t){super(y.extractPatternOptions({...y.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:s,pattern:i,blocks:a,...u}={...y.DEFAULTS,...t},n=Object.assign({},y.GET_DEFAULT_BLOCKS());t.min&&(n.Y.from=t.min.getFullYear()),t.max&&(n.Y.to=t.max.getFullYear()),t.min&&t.max&&n.Y.from===n.Y.to&&(n.m.from=t.min.getMonth()+1,n.m.to=t.max.getMonth()+1,n.m.from===n.m.to&&(n.d.from=t.min.getDate(),n.d.to=t.max.getDate())),Object.assign(n,this.blocks,a),super._update({...u,mask:e(s)?s:i,blocks:n})}doValidate(t){const e=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&null!=e&&(null==this.min||this.min<=e)&&(null==this.max||e<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}optionsIsChanged(t){return super.optionsIsChanged(y.extractPatternOptions(t))}}y.GET_DEFAULT_BLOCKS=()=>({d:{mask:D,from:1,to:31,maxLength:2},m:{mask:D,from:1,to:12,maxLength:2},Y:{mask:D,from:1900,to:9999}}),y.DEFAULTS={...b.DEFAULTS,mask:Date,pattern:"d{.}`m{.}`Y",format:(t,e)=>{if(!t)return"";return[String(t.getDate()).padStart(2,"0"),String(t.getMonth()+1).padStart(2,"0"),t.getFullYear()].join(".")},parse:(t,e)=>{const[s,i,a]=t.split(".").map(Number);return new Date(a,i-1,s)}},o.MaskedDate=y;class M extends C{constructor(t){super({...M.DEFAULTS,...t}),this.currentMask=void 0}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),"mask"in t&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(t.mask)?t.mask.map((t=>{const{expose:e,...s}=p(t),i=d({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...s});return e&&(this.exposeMask=i),i})):[])}_appendCharRaw(t,e){void 0===e&&(e={});const s=this._applyDispatch(t,e);return this.currentMask&&s.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(e))),s}_applyDispatch(t,e,s){void 0===t&&(t=""),void 0===e&&(e={}),void 0===s&&(s="");const i=e.tail&&null!=e._beforeTailState?e._beforeTailState._value:this.value,a=this.rawInputValue,u=e.tail&&null!=e._beforeTailState?e._beforeTailState._rawInputValue:a,n=a.slice(u.length),r=this.currentMask,h=new v,o=null==r?void 0:r.state;return this.currentMask=this.doDispatch(t,{...e},s),this.currentMask&&(this.currentMask!==r?(this.currentMask.reset(),u&&(this.currentMask.append(u,{raw:!0}),h.tailShift=this.currentMask.value.length-i.length),n&&(h.tailShift+=this.currentMask.append(n,{raw:!0,tail:!0}).tailShift)):o&&(this.currentMask.state=o)),h}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const e=new v;return t&&e.aggregate(this._applyDispatch("",{},t)),e.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var e,s;return{...t,_beforeTailState:(null==(e=t._beforeTailState)?void 0:e.currentMaskRef)===this.currentMask&&(null==(s=t._beforeTailState)?void 0:s.currentMask)||t._beforeTailState}}doDispatch(t,e,s){return void 0===e&&(e={}),void 0===s&&(s=""),this.dispatch(t,this,e,s)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,e){void 0===e&&(e={});let[s,i]=super.doPrepare(t,e);if(this.currentMask){let t;[s,t]=super.doPrepare(s,this.currentMaskFlags(e)),i=i.aggregate(t)}return[s,i]}doPrepareChar(t,e){void 0===e&&(e={});let[s,i]=super.doPrepareChar(t,e);if(this.currentMask){let t;[s,t]=super.doPrepareChar(s,this.currentMaskFlags(e)),i=i.aggregate(t)}return[s,i]}reset(){var t;null==(t=this.currentMask)||t.reset(),this.compiledMasks.forEach((t=>t.reset()))}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(t){if(this.exposeMask)return this.exposeMask.typedValue=t,this.currentMask=this.exposeMask,void this._applyDispatch();let e=String(t);this.currentMask&&(this.currentMask.typedValue=t,e=this.currentMask.unmaskedValue),this.unmaskedValue=e}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return Boolean(null==(t=this.currentMask)?void 0:t.isComplete)}get isFilled(){var t;return Boolean(null==(t=this.currentMask)?void 0:t.isFilled)}remove(t,e){const s=new v;return this.currentMask&&s.aggregate(this.currentMask.remove(t,e)).aggregate(this._applyDispatch()),s}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map((t=>t.state)),currentMaskRef:this.currentMask,currentMask:null==(t=this.currentMask)?void 0:t.state}}set state(t){const{compiledMasks:e,currentMaskRef:s,currentMask:i,...a}=t;e&&this.compiledMasks.forEach(((t,s)=>t.state=e[s])),null!=s&&(this.currentMask=s,this.currentMask.state=i),super.state=a}extractInput(t,e,s){return this.currentMask?this.currentMask.extractInput(t,e,s):""}extractTail(t,e){return this.currentMask?this.currentMask.extractTail(t,e):super.extractTail(t,e)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,e){return this.currentMask?this.currentMask.nearestInputPos(t,e):super.nearestInputPos(t,e)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every(((e,s)=>{if(!t[s])return;const{mask:i,...a}=t[s];return r(e,a)&&e.maskEquals(i)})):super.maskEquals(t)}typedValueEquals(t){var e;return Boolean(null==(e=this.currentMask)?void 0:e.typedValueEquals(t))}}M.DEFAULTS={...C.DEFAULTS,dispatch:(t,e,s,i)=>{if(!e.compiledMasks.length)return;const u=e.rawInputValue,n=e.compiledMasks.map(((n,r)=>{const h=e.currentMask===n,o=h?n.displayValue.length:n.nearestInputPos(n.displayValue.length,a.FORCE_LEFT);return n.rawInputValue!==u?(n.reset(),n.append(u,{raw:!0})):h||n.remove(o),n.append(t,e.currentMaskFlags(s)),n.appendTail(i),{index:r,weight:n.rawInputValue.length,totalInputPositions:n.totalInputPositions(0,Math.max(o,n.nearestInputPos(n.displayValue.length,a.FORCE_LEFT)))}}));return n.sort(((t,e)=>e.weight-t.weight||e.totalInputPositions-t.totalInputPositions)),e.compiledMasks[n[0].index]}},o.MaskedDynamic=M;class I extends b{constructor(t){super({...I.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:e,...s}=t;if(e){const t=e.map((t=>t.length)),i=Math.min(...t),a=Math.max(...t)-i;s.mask="*".repeat(i),a&&(s.mask+="["+"*".repeat(a)+"]"),this.enum=e}super._update(s)}_appendCharRaw(t,e){void 0===e&&(e={});const s=Math.min(this.nearestInputPos(0,a.FORCE_RIGHT),this.value.length),i=this.enum.filter((e=>this.matchValue(e,this.unmaskedValue+t,s)));if(i.length){1===i.length&&this._forEachBlocksInRange(0,this.value.length,((t,s)=>{const a=i[0][s];s>=this.value.length||a===t.value||(t.reset(),t._appendChar(a,e))}));const t=super._appendCharRaw(i[0][this.value.length],e);return 1===i.length&&i[0].slice(this.unmaskedValue.length).split("").forEach((e=>t.aggregate(super._appendCharRaw(e)))),t}return new v({skip:!this.isComplete})}extractTail(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),new E("",t)}remove(t,e){if(void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),t===e)return new v;const s=Math.min(super.nearestInputPos(0,a.FORCE_RIGHT),this.value.length);let i;for(i=t;i>=0;--i){if(this.enum.filter((t=>this.matchValue(t,this.value.slice(s,i),s))).length>1)break}const u=super.remove(i,e);return u.tailShift+=i-t,u}get isComplete(){return this.enum.indexOf(this.value)>=0}}I.DEFAULTS={...b.DEFAULTS,matchValue:(t,e,s)=>t.indexOf(e,s)===s},o.MaskedEnum=I;class V extends C{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}var T;o.MaskedFunction=V;class w extends C{constructor(t){super({...w.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),e=(this.scale?"("+n(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+"\\d*"+e),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(n).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(n(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const e=t.split(this.radix);return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),e.join(this.radix)}doPrepareChar(t,e){void 0===e&&(e={});const[s,i]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(e.input&&e.raw||!e.input&&!e.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),e);return t&&!s&&(i.skip=!0),!s||this.allowPositive||this.value||"-"===s||i.aggregate(this._appendChar("-")),[s,i]}_separatorsCount(t,e){void 0===e&&(e=!1);let s=0;for(let i=0;i<t;++i)this._value.indexOf(this.thousandsSeparator,i)===i&&(++s,e&&(t+=this.thousandsSeparator.length));return s}_separatorsCountFromSlice(t){return void 0===t&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e),this._removeThousandsSeparators(super.extractInput(t,e,s))}_appendCharRaw(t,e){void 0===e&&(e={});const s=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,i=this._separatorsCountFromSlice(s);this._value=this._removeThousandsSeparators(this.value);const a=this._value;this._value+=t;const u=this.number;let n,r=!isNaN(u),h=!1;if(r){let t;null!=this.min&&this.min<0&&this.number<this.min&&(t=this.min),null!=this.max&&this.max>0&&this.number>this.max&&(t=this.max),null!=t&&(this.autofix?(this._value=this.format(t,this).replace(w.UNMASKED_RADIX,this.radix),h||(h=a===this._value&&!e.tail)):r=!1),r&&(r=Boolean(this._value.match(this._numberRegExp)))}r?n=new v({inserted:this._value.slice(a.length),rawInserted:h?"":t,skip:h}):(this._value=a,n=new v),this._value=this._insertThousandsSeparators(this._value);const o=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,l=this._separatorsCountFromSlice(o);return n.tailShift+=(l-i)*this.thousandsSeparator.length,n}_findSeparatorAround(t){if(this.thousandsSeparator){const e=t-this.thousandsSeparator.length+1,s=this.value.indexOf(this.thousandsSeparator,e);if(s<=t)return s}return-1}_adjustRangeWithSeparators(t,e){const s=this._findSeparatorAround(t);s>=0&&(t=s);const i=this._findSeparatorAround(e);return i>=0&&(e=i+this.thousandsSeparator.length),[t,e]}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e);const s=this.value.slice(0,t),i=this.value.slice(e),a=this._separatorsCount(s.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(s+i));const u=this._separatorsCountFromSlice(s);return new v({tailShift:(u-a)*this.thousandsSeparator.length})}nearestInputPos(t,e){if(!this.thousandsSeparator)return t;switch(e){case a.NONE:case a.LEFT:case a.FORCE_LEFT:{const s=this._findSeparatorAround(t-1);if(s>=0){const i=s+this.thousandsSeparator.length;if(t<i||this.value.length<=i||e===a.FORCE_LEFT)return s}break}case a.RIGHT:case a.FORCE_RIGHT:{const e=this._findSeparatorAround(t);if(e>=0)return e+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let e=t;null!=this.min&&(e=Math.max(e,this.min)),null!=this.max&&(e=Math.min(e,this.max)),e!==t&&(this.unmaskedValue=this.format(e,this));let s=this.value;this.normalizeZeros&&(s=this._normalizeZeros(s)),this.padFractionalZeros&&this.scale>0&&(s=this._padFractionalZeros(s)),this._value=s}super.doCommit()}_normalizeZeros(t){const e=this._removeThousandsSeparators(t).split(this.radix);return e[0]=e[0].replace(/^(\D*)(0*)(\d*)/,((t,e,s,i)=>e+i)),t.length&&!/\d$/.test(e[0])&&(e[0]=e[0]+"0"),e.length>1&&(e[1]=e[1].replace(/0*$/,""),e[1].length||(e.length=1)),this._insertThousandsSeparators(e.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const e=t.split(this.radix);return e.length<2&&e.push(""),e[1]=e[1].padEnd(this.scale,"0"),e.join(this.radix)}doSkipInvalid(t,e,s){void 0===e&&(e={});const i=0===this.scale&&t!==this.thousandsSeparator&&(t===this.radix||t===w.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,e,s)&&!i}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,w.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(w.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return null!=this.min&&this.min<0||null!=this.max&&this.max<0}get allowPositive(){return null!=this.min&&this.min>0||null!=this.max&&this.max>0}typedValueEquals(t){return(super.typedValueEquals(t)||w.EMPTY_VALUES.includes(t)&&w.EMPTY_VALUES.includes(this.typedValue))&&!(0===t&&""===this.value)}}T=w,w.UNMASKED_RADIX=".",w.EMPTY_VALUES=[...C.EMPTY_VALUES,0],w.DEFAULTS={...C.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[T.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:t=>t.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},o.MaskedNumber=w;const R={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function P(t,e,s){void 0===e&&(e=R.MASKED),void 0===s&&(s=R.MASKED);const i=d(t);return t=>i.runIsolated((i=>(i[e]=t,i[s])))}function O(t,e,s,i){return P(e,s,i)(t)}o.PIPE_TYPE=R,o.createPipe=P,o.pipe=O;class L extends b{get repeatFrom(){var t;return null!=(t=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)?t:0}get repeatTo(){var t;return null!=(t=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)?t:1/0}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){var e,s,i;const{repeat:a,...u}=p(t);this._blockOpts=Object.assign({},this._blockOpts,u);const n=d(this._blockOpts);this.repeat=null!=(e=null!=(s=null!=a?a:n.repeat)?s:this.repeat)?e:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&(null==(i=this._blocks)?void 0:i.length)||0,this.repeatFrom)),blocks:{m:n},eager:n.eager,overwrite:n.overwrite,skipInvalid:n.skipInvalid,lazy:n.lazy,placeholderChar:n.placeholderChar,displayChar:n.displayChar})}_allocateBlock(t){return t<this._blocks.length?this._blocks[t]:this.repeatTo===1/0||this._blocks.length<this.repeatTo?(this._blocks.push(d(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]):void 0}_appendCharRaw(t,e){void 0===e&&(e={});const s=new v;for(let r,h,o=null!=(i=null==(a=this._mapPosToBlock(this.displayValue.length))?void 0:a.index)?i:Math.max(this._blocks.length-1,0);r=null!=(u=this._blocks[o])?u:h=!h&&this._allocateBlock(o);++o){var i,a,u,n;const l=r._appendChar(t,{...e,_beforeTailState:null==(n=e._beforeTailState)||null==(n=n._blocks)?void 0:n[o]});if(l.skip&&h){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(s.aggregate(l),l.consumed)break}return s}_trimEmptyTail(t,e){var s,i;void 0===t&&(t=0);const a=Math.max((null==(s=this._mapPosToBlock(t))?void 0:s.index)||0,this.repeatFrom,0);let u;null!=e&&(u=null==(i=this._mapPosToBlock(e))?void 0:i.index),null==u&&(u=this._blocks.length-1);let n=0;for(let t=u;a<=t&&!this._blocks[t].unmaskedValue;--t,++n);n&&(this._blocks.splice(u-n+1,n),this.mask=this.mask.slice(n))}reset(){super.reset(),this._trimEmptyTail()}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const s=super.remove(t,e);return this._trimEmptyTail(t,e),s}totalInputPositions(t,e){return void 0===t&&(t=0),null==e&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,e)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}}o.RepeatBlock=L;try{globalThis.IMask=o}catch{}t.ChangeDetails=v,t.ChunksTailDetails=A,t.DIRECTION=a,t.HTMLContenteditableMaskElement=m,t.HTMLInputMaskElement=k,t.HTMLMaskElement=g,t.InputMask=f,t.MaskElement=c,t.Masked=C,t.MaskedDate=y,t.MaskedDynamic=M,t.MaskedEnum=I,t.MaskedFunction=V,t.MaskedNumber=w,t.MaskedPattern=b,t.MaskedRange=D,t.MaskedRegExp=B,t.PIPE_TYPE=R,t.PatternFixedDefinition=x,t.PatternInputDefinition=S,t.RepeatBlock=L,t.createMask=d,t.createPipe=P,t.default=o,t.forceDirection=u,t.normalizeOpts=p,t.pipe=O,Object.defineProperty(t,"__esModule",{value:!0})}));
|
||
/*
|
||
* International Telephone Input v25.11.3
|
||
* https://github.com/jackocnr/intl-tel-input.git
|
||
* Licensed under the MIT license
|
||
*/
|
||
(function(factory) {
|
||
if (typeof module === 'object' && module.exports) {
|
||
module.exports = factory();
|
||
} else {
|
||
window.intlTelInput = factory();
|
||
}
|
||
}(() => {
|
||
var factoryOutput=(()=>{var U=Object.defineProperty;var ht=Object.getOwnPropertyDescriptor;var pt=Object.getOwnPropertyNames;var Ct=Object.prototype.hasOwnProperty;var mt=(r,t)=>{for(var e in t)U(r,e,{get:t[e],enumerable:!0})},yt=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of pt(t))!Ct.call(r,n)&&n!==e&&U(r,n,{get:()=>t[n],enumerable:!(i=ht(t,n))||i.enumerable});return r};var ft=r=>yt(U({},"__esModule",{value:!0}),r);var At={};mt(At,{Iti:()=>k,default:()=>wt});var gt=[["af","93",0,null,"0"],["ax","358",1,["18","4"],"0"],["al","355",0,null,"0"],["dz","213",0,null,"0"],["as","1",5,["684"],"1"],["ad","376"],["ao","244"],["ai","1",6,["264"],"1"],["ag","1",7,["268"],"1"],["ar","54",0,null,"0"],["am","374",0,null,"0"],["aw","297"],["ac","247"],["au","61",0,["4"],"0"],["at","43",0,null,"0"],["az","994",0,null,"0"],["bs","1",8,["242"],"1"],["bh","973"],["bd","880",0,null,"0"],["bb","1",9,["246"],"1"],["by","375",0,null,"8"],["be","32",0,null,"0"],["bz","501"],["bj","229"],["bm","1",10,["441"],"1"],["bt","975"],["bo","591",0,null,"0"],["ba","387",0,null,"0"],["bw","267"],["br","55",0,null,"0"],["io","246"],["vg","1",11,["284"],"1"],["bn","673"],["bg","359",0,null,"0"],["bf","226"],["bi","257"],["kh","855",0,null,"0"],["cm","237"],["ca","1",1,["204","226","236","249","250","257","263","289","306","343","354","365","367","368","382","403","416","418","428","431","437","438","450","468","474","506","514","519","548","579","581","584","587","604","613","639","647","672","683","705","709","742","753","778","780","782","807","819","825","867","873","879","902","905","942"],"1"],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"],"1"],["cf","236"],["td","235"],["cl","56"],["cn","86",0,null,"0"],["cx","61",2,["4","89164"],"0"],["cc","61",1,["4","89162"],"0"],["co","57",0,null,"0"],["km","269"],["cg","242"],["cd","243",0,null,"0"],["ck","682"],["cr","506"],["ci","225"],["hr","385",0,null,"0"],["cu","53",0,null,"0"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"],"1"],["do","1",2,["809","829","849"],"1"],["ec","593",0,null,"0"],["eg","20",0,null,"0"],["sv","503"],["gq","240"],["er","291",0,null,"0"],["ee","372"],["sz","268"],["et","251",0,null,"0"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0,["4"],"0"],["fr","33",0,null,"0"],["gf","594",0,null,"0"],["pf","689"],["ga","241"],["gm","220"],["ge","995",0,null,"0"],["de","49",0,null,"0"],["gh","233",0,null,"0"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"],"1"],["gp","590",0,null,"0"],["gu","1",15,["671"],"1"],["gt","502"],["gg","44",1,["1481","7781","7839","7911"],"0"],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36",0,null,"06"],["is","354"],["in","91",0,null,"0"],["id","62",0,null,"0"],["ir","98",0,null,"0"],["iq","964",0,null,"0"],["ie","353",0,null,"0"],["im","44",2,["1624","74576","7524","7624","7924"],"0"],["il","972",0,null,"0"],["it","39",0,["3"]],["jm","1",4,["658","876"],"1"],["jp","81",0,null,"0"],["je","44",3,["1534","7509","7700","7797","7829","7937"],"0"],["jo","962",0,null,"0"],["kz","7",1,["33","7"],"8"],["ke","254",0,null,"0"],["ki","686",0,null,"0"],["xk","383",0,null,"0"],["kw","965"],["kg","996",0,null,"0"],["la","856",0,null,"0"],["lv","371"],["lb","961",0,null,"0"],["ls","266"],["lr","231",0,null,"0"],["ly","218",0,null,"0"],["li","423",0,null,"0"],["lt","370",0,null,"0"],["lu","352"],["mo","853"],["mg","261",0,null,"0"],["mw","265",0,null,"0"],["my","60",0,null,"0"],["mv","960"],["ml","223"],["mt","356"],["mh","692",0,null,"1"],["mq","596",0,null,"0"],["mr","222"],["mu","230"],["yt","262",1,["269","639"],"0"],["mx","52"],["fm","691"],["md","373",0,null,"0"],["mc","377",0,null,"0"],["mn","976",0,null,"0"],["me","382",0,null,"0"],["ms","1",16,["664"],"1"],["ma","212",0,["6","7"],"0"],["mz","258"],["mm","95",0,null,"0"],["na","264",0,null,"0"],["nr","674"],["np","977",0,null,"0"],["nl","31",0,null,"0"],["nc","687"],["nz","64",0,null,"0"],["ni","505"],["ne","227"],["ng","234",0,null,"0"],["nu","683"],["nf","672"],["kp","850",0,null,"0"],["mk","389",0,null,"0"],["mp","1",17,["670"],"1"],["no","47",0,["4","9"]],["om","968"],["pk","92",0,null,"0"],["pw","680"],["ps","970",0,null,"0"],["pa","507"],["pg","675"],["py","595",0,null,"0"],["pe","51",0,null,"0"],["ph","63",0,null,"0"],["pl","48"],["pt","351"],["pr","1",3,["787","939"],"1"],["qa","974"],["re","262",0,null,"0"],["ro","40",0,null,"0"],["ru","7",0,["33"],"8"],["rw","250",0,null,"0"],["ws","685"],["sm","378"],["st","239"],["sa","966",0,null,"0"],["sn","221"],["rs","381",0,null,"0"],["sc","248"],["sl","232",0,null,"0"],["sg","65"],["sx","1",21,["721"],"1"],["sk","421",0,null,"0"],["si","386",0,null,"0"],["sb","677"],["so","252",0,null,"0"],["za","27",0,null,"0"],["kr","82",0,null,"0"],["ss","211",0,null,"0"],["es","34"],["lk","94",0,null,"0"],["bl","590",1,null,"0"],["sh","290"],["kn","1",18,["869"],"1"],["lc","1",19,["758"],"1"],["mf","590",2,null,"0"],["pm","508",0,null,"0"],["vc","1",20,["784"],"1"],["sd","249",0,null,"0"],["sr","597"],["sj","47",1,["4","79","9"]],["se","46",0,null,"0"],["ch","41",0,null,"0"],["sy","963",0,null,"0"],["tw","886",0,null,"0"],["tj","992"],["tz","255",0,null,"0"],["th","66",0,null,"0"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"],"1"],["tn","216"],["tr","90",0,null,"0"],["tm","993",0,null,"8"],["tc","1",23,["649"],"1"],["tv","688"],["vi","1",24,["340"],"1"],["ug","256",0,null,"0"],["ua","380",0,null,"0"],["ae","971",0,null,"0"],["gb","44",0,null,"0"],["us","1",0,null,"1"],["uy","598",0,null,"0"],["uz","998"],["vu","678"],["va","39",1,["06698","3"]],["ve","58",0,null,"0"],["vn","84",0,null,"0"],["wf","681"],["eh","212",1,["5288","5289","6","7"],"0"],["ye","967",0,null,"0"],["zm","260",0,null,"0"],["zw","263",0,null,"0"]],j=[];for(let r of gt)j.push({name:"",iso2:r[0],dialCode:r[1],priority:r[2]||0,areaCodes:r[3]||null,nodeById:{},nationalPrefix:r[4]||null,normalisedName:"",initials:"",dialCodePlus:""});var L=j;var It={ad:"Andorra",ae:"United Arab Emirates",af:"Afghanistan",ag:"Antigua & Barbuda",ai:"Anguilla",al:"Albania",am:"Armenia",ao:"Angola",ar:"Argentina",as:"American Samoa",at:"Austria",au:"Australia",aw:"Aruba",ax:"\xC5land Islands",az:"Azerbaijan",ba:"Bosnia & Herzegovina",bb:"Barbados",bd:"Bangladesh",be:"Belgium",bf:"Burkina Faso",bg:"Bulgaria",bh:"Bahrain",bi:"Burundi",bj:"Benin",bl:"St. Barth\xE9lemy",bm:"Bermuda",bn:"Brunei",bo:"Bolivia",bq:"Caribbean Netherlands",br:"Brazil",bs:"Bahamas",bt:"Bhutan",bw:"Botswana",by:"Belarus",bz:"Belize",ca:"Canada",cc:"Cocos (Keeling) Islands",cd:"Congo - Kinshasa",cf:"Central African Republic",cg:"Congo - Brazzaville",ch:"Switzerland",ci:"C\xF4te d\u2019Ivoire",ck:"Cook Islands",cl:"Chile",cm:"Cameroon",cn:"China",co:"Colombia",cr:"Costa Rica",cu:"Cuba",cv:"Cape Verde",cw:"Cura\xE7ao",cx:"Christmas Island",cy:"Cyprus",cz:"Czechia",de:"Germany",dj:"Djibouti",dk:"Denmark",dm:"Dominica",do:"Dominican Republic",dz:"Algeria",ec:"Ecuador",ee:"Estonia",eg:"Egypt",eh:"Western Sahara",er:"Eritrea",es:"Spain",et:"Ethiopia",fi:"Finland",fj:"Fiji",fk:"Falkland Islands",fm:"Micronesia",fo:"Faroe Islands",fr:"France",ga:"Gabon",gb:"United Kingdom",gd:"Grenada",ge:"Georgia",gf:"French Guiana",gg:"Guernsey",gh:"Ghana",gi:"Gibraltar",gl:"Greenland",gm:"Gambia",gn:"Guinea",gp:"Guadeloupe",gq:"Equatorial Guinea",gr:"Greece",gt:"Guatemala",gu:"Guam",gw:"Guinea-Bissau",gy:"Guyana",hk:"Hong Kong SAR China",hn:"Honduras",hr:"Croatia",ht:"Haiti",hu:"Hungary",id:"Indonesia",ie:"Ireland",il:"Israel",im:"Isle of Man",in:"India",io:"British Indian Ocean Territory",iq:"Iraq",ir:"Iran",is:"Iceland",it:"Italy",je:"Jersey",jm:"Jamaica",jo:"Jordan",jp:"Japan",ke:"Kenya",kg:"Kyrgyzstan",kh:"Cambodia",ki:"Kiribati",km:"Comoros",kn:"St. Kitts & Nevis",kp:"North Korea",kr:"South Korea",kw:"Kuwait",ky:"Cayman Islands",kz:"Kazakhstan",la:"Laos",lb:"Lebanon",lc:"St. Lucia",li:"Liechtenstein",lk:"Sri Lanka",lr:"Liberia",ls:"Lesotho",lt:"Lithuania",lu:"Luxembourg",lv:"Latvia",ly:"Libya",ma:"Morocco",mc:"Monaco",md:"Moldova",me:"Montenegro",mf:"St. Martin",mg:"Madagascar",mh:"Marshall Islands",mk:"North Macedonia",ml:"Mali",mm:"Myanmar (Burma)",mn:"Mongolia",mo:"Macao SAR China",mp:"Northern Mariana Islands",mq:"Martinique",mr:"Mauritania",ms:"Montserrat",mt:"Malta",mu:"Mauritius",mv:"Maldives",mw:"Malawi",mx:"Mexico",my:"Malaysia",mz:"Mozambique",na:"Namibia",nc:"New Caledonia",ne:"Niger",nf:"Norfolk Island",ng:"Nigeria",ni:"Nicaragua",nl:"Netherlands",no:"Norway",np:"Nepal",nr:"Nauru",nu:"Niue",nz:"New Zealand",om:"Oman",pa:"Panama",pe:"Peru",pf:"French Polynesia",pg:"Papua New Guinea",ph:"Philippines",pk:"Pakistan",pl:"Poland",pm:"St. Pierre & Miquelon",pr:"Puerto Rico",ps:"Palestinian Territories",pt:"Portugal",pw:"Palau",py:"Paraguay",qa:"Qatar",re:"R\xE9union",ro:"Romania",rs:"Serbia",ru:"Russia",rw:"Rwanda",sa:"Saudi Arabia",sb:"Solomon Islands",sc:"Seychelles",sd:"Sudan",se:"Sweden",sg:"Singapore",sh:"St. Helena",si:"Slovenia",sj:"Svalbard & Jan Mayen",sk:"Slovakia",sl:"Sierra Leone",sm:"San Marino",sn:"Senegal",so:"Somalia",sr:"Suriname",ss:"South Sudan",st:"S\xE3o Tom\xE9 & Pr\xEDncipe",sv:"El Salvador",sx:"Sint Maarten",sy:"Syria",sz:"Eswatini",tc:"Turks & Caicos Islands",td:"Chad",tg:"Togo",th:"Thailand",tj:"Tajikistan",tk:"Tokelau",tl:"Timor-Leste",tm:"Turkmenistan",tn:"Tunisia",to:"Tonga",tr:"Turkey",tt:"Trinidad & Tobago",tv:"Tuvalu",tw:"Taiwan",tz:"Tanzania",ua:"Ukraine",ug:"Uganda",us:"United States",uy:"Uruguay",uz:"Uzbekistan",va:"Vatican City",vc:"St. Vincent & Grenadines",ve:"Venezuela",vg:"British Virgin Islands",vi:"U.S. Virgin Islands",vn:"Vietnam",vu:"Vanuatu",wf:"Wallis & Futuna",ws:"Samoa",ye:"Yemen",yt:"Mayotte",za:"South Africa",zm:"Zambia",zw:"Zimbabwe"},Y=It;var bt={selectedCountryAriaLabel:"Change country, selected ${countryName} (${dialCode})",noCountrySelected:"Select country",countryListAriaLabel:"List of countries",searchPlaceholder:"Search",clearSearchAriaLabel:"Clear search",zeroSearchResults:"No results found",oneSearchResult:"1 result found",multipleSearchResults:"${count} results found",ac:"Ascension Island",xk:"Kosovo"},q=bt;var vt={...Y,...q},B=vt;var w={OPEN_COUNTRY_DROPDOWN:"open:countrydropdown",CLOSE_COUNTRY_DROPDOWN:"close:countrydropdown",COUNTRY_CHANGE:"countrychange",INPUT:"input"},h={HIDE:"iti__hide",V_HIDE:"iti__v-hide",ARROW_UP:"iti__arrow--up",GLOBE:"iti__globe",FLAG:"iti__flag",COUNTRY_ITEM:"iti__country",HIGHLIGHT:"iti__highlight"},y={ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",SPACE:" ",ENTER:"Enter",ESC:"Escape",TAB:"Tab"},W={PASTE:"insertFromPaste",DELETE_FWD:"deleteContentForward"},N={ALPHA_UNICODE:/\p{L}/u,NON_PLUS_NUMERIC:/[^+0-9]/,NON_PLUS_NUMERIC_GLOBAL:/[^+0-9]/g,HIDDEN_SEARCH_CHAR:/^[a-zA-ZÀ-ÿа-яА-Я ]$/},X={SEARCH_DEBOUNCE_MS:100,HIDDEN_SEARCH_RESET_MS:1e3,NEXT_TICK:0},F={UNKNOWN_NUMBER_TYPE:-99,UNKNOWN_VALIDATION_ERROR:-99},P={SANE_SELECTED_WITH_DIAL_WIDTH:78,SANE_SELECTED_NO_DIAL_WIDTH:42,INPUT_PADDING_EXTRA_LEFT:6},M={PLUS:"+",NANP:"1"},O={ISO2:"gb",DIAL_CODE:"44",MOBILE_PREFIX:"7",MOBILE_CORE_LENGTH:10},J={ISO2:"us",DIAL_CODE:"1"},A={AGGRESSIVE:"aggressive",POLITE:"polite",OFF:"off"},x={AUTO:"auto"},$={COUNTRY_CODE:"countryCode",DIAL_CODE:"dialCode"},p={EXPANDED:"aria-expanded",LABEL:"aria-label",SELECTED:"aria-selected",ACTIVE_DESCENDANT:"aria-activedescendant",HASPOPUP:"aria-haspopup",CONTROLS:"aria-controls",HIDDEN:"aria-hidden",AUTOCOMPLETE:"aria-autocomplete",MODAL:"aria-modal"};var G=r=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(r).matches,Et=()=>{if(typeof navigator<"u"&&typeof window<"u"){let r=/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),t=G("(max-width: 500px)"),e=G("(max-height: 600px)"),i=G("(pointer: coarse)");return r||t||i&&e}return!1},K={allowPhonewords:!1,allowDropdown:!0,autoPlaceholder:A.POLITE,containerClass:"",countryOrder:null,countrySearch:!0,customPlaceholder:null,dropdownContainer:null,excludeCountries:[],fixDropdownWidth:!0,formatAsYouType:!0,formatOnDisplay:!0,geoIpLookup:null,hiddenInput:null,i18n:{},initialCountry:"",loadUtils:null,nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",showFlags:!0,separateDialCode:!1,strictMode:!1,useFullscreenPopup:Et(),validationNumberTypes:["MOBILE"]},Q=(r,t)=>{r.useFullscreenPopup&&(r.fixDropdownWidth=!1),r.onlyCountries.length===1&&(r.initialCountry=r.onlyCountries[0]),r.separateDialCode&&(r.nationalMode=!1),r.allowDropdown&&!r.showFlags&&!r.separateDialCode&&(r.nationalMode=!1),r.useFullscreenPopup&&!r.dropdownContainer&&(r.dropdownContainer=document.body),r.i18n={...t,...r.i18n}};var D=r=>r.replace(/\D/g,""),R=(r="")=>r.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase();var Z=(r,t)=>{let e=R(t),i=[],n=[],s=[],o=[],a=[],u=[];for(let c of r)c.iso2===e?i.push(c):c.normalisedName.startsWith(e)?n.push(c):c.normalisedName.includes(e)?s.push(c):e===c.dialCode||e===c.dialCodePlus?o.push(c):c.dialCodePlus.includes(e)?a.push(c):c.initials.includes(e)&&u.push(c);let d=(c,m)=>c.priority-m.priority;return[...i.sort(d),...n.sort(d),...s.sort(d),...o.sort(d),...a.sort(d),...u.sort(d)]},tt=(r,t)=>{let e=t.toLowerCase();for(let i of r)if(i.name.toLowerCase().startsWith(e))return i;return null};var H=r=>Object.keys(r).filter(t=>!!r[t]).join(" "),C=(r,t,e)=>{let i=document.createElement(r);return t&&Object.entries(t).forEach(([n,s])=>i.setAttribute(n,s)),e&&e.appendChild(i),i};var et=()=>`
|
||
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${p.HIDDEN}="true">
|
||
<circle cx="11" cy="11" r="7" />
|
||
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
||
</svg>`,it=r=>{let t=`iti-${r}-clear-mask`;return`
|
||
<svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${p.HIDDEN}="true" focusable="false">
|
||
<mask id="${t}" maskUnits="userSpaceOnUse">
|
||
<rect width="16" height="16" fill="white" />
|
||
<path d="M5.2 5.2 L10.8 10.8 M10.8 5.2 L5.2 10.8" stroke="black" stroke-linecap="round" class="iti__search-clear-x" />
|
||
</mask>
|
||
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${t})" />
|
||
</svg>`};var T=class{constructor(t,e,i){this.highlightedItem=null;t.dataset.intlTelInputId=i.toString(),this.telInput=t,this.options=e,this.id=i,this.a=!!t.getAttribute("placeholder"),this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.separateDialCode&&(this.o=this.telInput.style.paddingLeft)}generateMarkup(t){this.countries=t,this._at();let e=this._au();this._av(e),e.appendChild(this.telInput),this._ay(),this._az(e)}_at(){this.telInput.classList.add("iti__tel-input"),!this.telInput.hasAttribute("autocomplete")&&!this.telInput.form?.hasAttribute("autocomplete")&&this.telInput.setAttribute("autocomplete","off")}_au(){let{allowDropdown:t,showFlags:e,containerClass:i,useFullscreenPopup:n}=this.options,s=H({iti:!0,"iti--allow-dropdown":t,"iti--show-flags":e,"iti--inline-dropdown":!n,[i]:!!i}),o=C("div",{class:s});return this.isRTL&&o.setAttribute("dir","ltr"),this.telInput.before(o),o}_av(t){let{allowDropdown:e,separateDialCode:i,showFlags:n}=this.options;if(e||n||i){this.countryContainer=C("div",{class:`iti__country-container ${h.V_HIDE}`},t),e?(this.selectedCountry=C("button",{type:"button",class:"iti__selected-country",[p.EXPANDED]:"false",[p.LABEL]:this.options.i18n.noCountrySelected,[p.HASPOPUP]:"dialog",[p.CONTROLS]:`iti-${this.id}__dropdown-content`},this.countryContainer),this.telInput.disabled&&this.selectedCountry.setAttribute("disabled","true")):this.selectedCountry=C("div",{class:"iti__selected-country"},this.countryContainer);let s=C("div",{class:"iti__selected-country-primary"},this.selectedCountry);this.selectedCountryInner=C("div",{class:h.FLAG},s),e&&(this.dropdownArrow=C("div",{class:"iti__arrow",[p.HIDDEN]:"true"},s)),i&&(this.selectedDialCode=C("div",{class:"iti__selected-dial-code"},this.selectedCountry)),e&&this._aw()}}_aw(){let{fixDropdownWidth:t,useFullscreenPopup:e,countrySearch:i,i18n:n,dropdownContainer:s,containerClass:o}=this.options,a=t?"":"iti--flexible-dropdown-width";if(this.dropdownContent=C("div",{id:`iti-${this.id}__dropdown-content`,class:`iti__dropdown-content ${h.HIDE} ${a}`,role:"dialog",[p.MODAL]:"true"}),this.isRTL&&this.dropdownContent.setAttribute("dir","rtl"),i&&this._ax(),this.countryList=C("ul",{class:"iti__country-list",id:`iti-${this.id}__country-listbox`,role:"listbox",[p.LABEL]:n.countryListAriaLabel},this.dropdownContent),this._ba(),i&&this.updateSearchResultsA11yText(),s){let u=H({iti:!0,"iti--container":!0,"iti--fullscreen-popup":e,"iti--inline-dropdown":!e,[o]:!!o});this.dropdown=C("div",{class:u}),this.dropdown.appendChild(this.dropdownContent)}else this.countryContainer.appendChild(this.dropdownContent)}_ax(){let{i18n:t}=this.options,e=C("div",{class:"iti__search-input-wrapper"},this.dropdownContent);this.searchIcon=C("span",{class:"iti__search-icon",[p.HIDDEN]:"true"},e),this.searchIcon.innerHTML=et(),this.searchInput=C("input",{id:`iti-${this.id}__search-input`,type:"search",class:"iti__search-input",placeholder:t.searchPlaceholder,role:"combobox",[p.EXPANDED]:"true",[p.LABEL]:t.searchPlaceholder,[p.CONTROLS]:`iti-${this.id}__country-listbox`,[p.AUTOCOMPLETE]:"list",autocomplete:"off"},e),this.k=C("button",{type:"button",class:`iti__search-clear ${h.HIDE}`,[p.LABEL]:t.clearSearchAriaLabel,tabindex:"-1"},e),this.k.innerHTML=it(this.id),this.l=C("span",{class:"iti__a11y-text"},this.dropdownContent),this.searchNoResults=C("div",{class:`iti__no-results ${h.HIDE}`,[p.HIDDEN]:"true"},this.dropdownContent),this.searchNoResults.textContent=t.zeroSearchResults}_ay(){this.countryContainer&&(this.updateInputPadding(),this.countryContainer.classList.remove(h.V_HIDE))}_az(t){let{hiddenInput:e}=this.options;if(e){let i=this.telInput.getAttribute("name")||"",n=e(i);if(n.phone){let s=this.telInput.form?.querySelector(`input[name="${n.phone}"]`);s?this.hiddenInput=s:(this.hiddenInput=C("input",{type:"hidden",name:n.phone}),t.appendChild(this.hiddenInput))}if(n.country){let s=this.telInput.form?.querySelector(`input[name="${n.country}"]`);s?this.m=s:(this.m=C("input",{type:"hidden",name:n.country}),t.appendChild(this.m))}}}_ba(){let t=document.createDocumentFragment();for(let e=0;e<this.countries.length;e++){let i=this.countries[e],n=H({[h.COUNTRY_ITEM]:!0,[h.HIGHLIGHT]:e===0}),s=C("li",{id:`iti-${this.id}__item-${i.iso2}`,class:n,tabindex:"-1",role:"option",[p.SELECTED]:"false"});s.dataset.dialCode=i.dialCode,s.dataset.countryCode=i.iso2,i.nodeById[this.id]=s,this.options.showFlags&&C("div",{class:`${h.FLAG} iti__${i.iso2}`},s);let o=C("span",{class:"iti__country-name"},s);o.textContent=i.name;let a=C("span",{class:"iti__dial-code"},s);this.isRTL&&a.setAttribute("dir","ltr"),a.textContent=`+${i.dialCode}`,t.appendChild(s)}this.countryList.appendChild(t)}updateInputPadding(){if(this.selectedCountry){let t=this.options.separateDialCode?P.SANE_SELECTED_WITH_DIAL_WIDTH:P.SANE_SELECTED_NO_DIAL_WIDTH,i=(this.selectedCountry.offsetWidth||this._bb()||t)+P.INPUT_PADDING_EXTRA_LEFT;this.telInput.style.paddingLeft=`${i}px`}}_bb(){if(this.telInput.parentNode){let t;try{t=window.top.document.body}catch{t=document.body}let e=this.telInput.parentNode.cloneNode(!1);e.style.visibility="hidden",t.appendChild(e);let i=this.countryContainer.cloneNode();e.appendChild(i);let n=this.selectedCountry.cloneNode(!0);i.appendChild(n);let s=n.offsetWidth;return t.removeChild(e),s}return 0}updateSearchResultsA11yText(){let{i18n:t}=this.options,e=this.countryList.childElementCount,i;e===0?i=t.zeroSearchResults:t.searchResultsText?i=t.searchResultsText(e):e===1?i=t.oneSearchResult:i=t.multipleSearchResults.replace("${count}",e.toString()),this.l.textContent=i}scrollTo(t){let e=this.countryList,i=document.documentElement.scrollTop,n=e.offsetHeight,s=e.getBoundingClientRect().top+i,o=s+n,a=t.offsetHeight,u=t.getBoundingClientRect().top+i,d=u+a,c=u-s+e.scrollTop;if(u<s)e.scrollTop=c;else if(d>o){let m=n-a;e.scrollTop=c-m}}highlightListItem(t,e){let i=this.highlightedItem;if(i&&(i.classList.remove(h.HIGHLIGHT),i.setAttribute(p.SELECTED,"false")),this.highlightedItem=t,this.highlightedItem&&(this.highlightedItem.classList.add(h.HIGHLIGHT),this.highlightedItem.setAttribute(p.SELECTED,"true"),this.options.countrySearch)){let n=this.highlightedItem.getAttribute("id")||"";this.searchInput.setAttribute(p.ACTIVE_DESCENDANT,n)}e&&this.highlightedItem.focus()}filterCountries(t){this.countryList.innerHTML="";let e=!0;for(let i of t){let n=i.nodeById[this.id];n&&(this.countryList.appendChild(n),e&&(this.highlightListItem(n,!1),e=!1))}e?(this.highlightListItem(null,!1),this.searchNoResults&&this.searchNoResults.classList.remove(h.HIDE)):this.searchNoResults&&this.searchNoResults.classList.add(h.HIDE),this.countryList.scrollTop=0,this.updateSearchResultsA11yText()}destroy(){this.telInput.iti=void 0,delete this.telInput.dataset.intlTelInputId,this.options.separateDialCode&&(this.telInput.style.paddingLeft=this.o);let t=this.telInput.parentNode;t.before(this.telInput),t.remove(),this.telInput=null,this.countryContainer=null,this.selectedCountry=null,this.selectedCountryInner=null,this.selectedDialCode=null,this.dropdownArrow=null,this.dropdownContent=null,this.searchInput=null,this.searchIcon=null,this.k=null,this.searchNoResults=null,this.l=null,this.countryList=null,this.dropdown=null,this.hiddenInput=null,this.m=null,this.highlightedItem=null;for(let e of this.countries)delete e.nodeById[this.id];this.countries=null}};var nt=r=>{let{onlyCountries:t,excludeCountries:e}=r;if(t.length){let i=t.map(n=>n.toLowerCase());return L.filter(n=>i.includes(n.iso2))}else if(e.length){let i=e.map(n=>n.toLowerCase());return L.filter(n=>!i.includes(n.iso2))}return L},st=(r,t)=>{for(let e of r){let i=e.iso2.toLowerCase();t.i18n[i]&&(e.name=t.i18n[i])}},ot=(r,t)=>{let e=new Set,i=0,n={},s=(o,a,u)=>{if(!o||!a)return;a.length>i&&(i=a.length),n.hasOwnProperty(a)||(n[a]=[]);let d=n[a];if(d.includes(o))return;let c=u!==void 0?u:d.length;d[c]=o};for(let o of r){e.has(o.dialCode)||e.add(o.dialCode);for(let a=1;a<o.dialCode.length;a++){let u=o.dialCode.substring(0,a);s(o.iso2,u)}s(o.iso2,o.dialCode,o.priority)}(t.onlyCountries.length||t.excludeCountries.length)&&e.forEach(o=>{n[o]=n[o].filter(Boolean)});for(let o of r)if(o.areaCodes){let a=n[o.dialCode][0];for(let u of o.areaCodes){for(let d=1;d<u.length;d++){let c=u.substring(0,d),m=o.dialCode+c;s(a,m),s(o.iso2,m)}s(o.iso2,o.dialCode+u)}}return{dialCodes:e,dialCodeMaxLen:i,dialCodeToIso2Map:n}},rt=(r,t)=>{t.countryOrder&&(t.countryOrder=t.countryOrder.map(e=>e.toLowerCase())),r.sort((e,i)=>{let{countryOrder:n}=t;if(n){let s=n.indexOf(e.iso2),o=n.indexOf(i.iso2),a=s>-1,u=o>-1;if(a||u)return a&&u?s-o:a?-1:1}return e.name.localeCompare(i.name)})},at=r=>{for(let t of r)t.normalisedName=R(t.name),t.initials=t.normalisedName.split(/[^a-z]/).map(e=>e[0]).join(""),t.dialCodePlus=`+${t.dialCode}`};var lt=(r,t,e,i)=>{let n=r;if(e&&t){t=`+${i.dialCode}`;let s=n[t.length]===" "||n[t.length]==="-"?t.length+1:t.length;n=n.substring(s)}return n},ut=(r,t,e,i,n)=>{let s=e?e.formatNumberAsYouType(r,i.iso2):r,{dialCode:o}=i;return n&&t.charAt(0)!=="+"&&s.includes(`+${o}`)?(s.split(`+${o}`)[1]||"").trim():s};var dt=(r,t,e,i)=>{if(e===0&&!i)return 0;let n=0;for(let s=0;s<t.length;s++){if(/[+0-9]/.test(t[s])&&n++,n===r&&!i)return s+1;if(i&&n===r+1)return s}return t.length};var _t=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],z=r=>{let t=D(r);if(t.startsWith(M.NANP)&&t.length>=4){let e=t.substring(1,4);return _t.includes(e)}return!1};for(let r of L)r.name=B[r.iso2];var Lt=0,Nt=new Set(L.map(r=>r.iso2)),V=r=>Nt.has(r),k=class r{constructor(t,e={}){this.id=Lt++,this.options={...K,...e},Q(this.options,B),this.ui=new T(t,this.options,this.id),this.i=r._b(),this.promise=this._c(),this.countries=nt(this.options);let{dialCodes:i,dialCodeMaxLen:n,dialCodeToIso2Map:s}=ot(this.countries,this.options);this.dialCodes=i,this.dialCodeMaxLen=n,this.dialCodeToIso2Map=s,this.j=new Map(this.countries.map(o=>[o.iso2,o])),this._init()}static _b(){return typeof navigator<"u"?/Android/i.test(navigator.userAgent):!1}_c(){let t=new Promise((i,n)=>{this.b=i,this.c=n}),e=new Promise((i,n)=>{this.d=i,this.e=n});return Promise.all([t,e])}_init(){this.selectedCountryData={},this.g=new AbortController,this._a(),this.ui.generateMarkup(this.countries),this._d(),this._e(),this._h()}_a(){st(this.countries,this.options),rt(this.countries,this.options),at(this.countries)}_d(t=!1){let e=this.ui.telInput.getAttribute("value"),i=this.ui.telInput.value,s=e&&e.startsWith("+")&&(!i||!i.startsWith("+"))?e:i,o=this._ao(s),a=z(s),{initialCountry:u,geoIpLookup:d}=this.options,c=u===x.AUTO&&d;if(o&&!a)this._ai(s);else if(!c||t){let m=u?u.toLowerCase():"";V(m)?this._aj(m):o&&a?this._aj(J.ISO2):this._aj("")}s&&this._ah(s)}_e(){this._j(),this.options.allowDropdown&&this._g(),(this.ui.hiddenInput||this.ui.m)&&this.ui.telInput.form&&this._f()}_f(){let t=()=>{this.ui.hiddenInput&&(this.ui.hiddenInput.value=this.getNumber()),this.ui.m&&(this.ui.m.value=this.selectedCountryData.iso2||"")};this.ui.telInput.form?.addEventListener("submit",t,{signal:this.g.signal})}_g(){let t=this.g.signal,e=o=>{this.ui.dropdownContent.classList.contains(h.HIDE)?this.ui.telInput.focus():o.preventDefault()},i=this.ui.telInput.closest("label");i&&i.addEventListener("click",e,{signal:t});let n=()=>{this.ui.dropdownContent.classList.contains(h.HIDE)&&!this.ui.telInput.disabled&&!this.ui.telInput.readOnly&&this._l()};this.ui.selectedCountry.addEventListener("click",n,{signal:t});let s=o=>{this.ui.dropdownContent.classList.contains(h.HIDE)&&[y.ARROW_UP,y.ARROW_DOWN,y.SPACE,y.ENTER].includes(o.key)&&(o.preventDefault(),o.stopPropagation(),this._l()),o.key===y.TAB&&this._am()};this.ui.countryContainer.addEventListener("keydown",s,{signal:t})}_h(){let{loadUtils:t,initialCountry:e,geoIpLookup:i}=this.options;if(t&&!l.utils){let s=()=>{l.attachUtils(t)?.catch(()=>{})};if(l.documentReady())s();else{let o=()=>{s()};window.addEventListener("load",o,{signal:this.g.signal})}}else this.d();e===x.AUTO&&i&&!this.selectedCountryData.iso2?this._i():this.b()}_i(){l.autoCountry?this.handleAutoCountry():l.startedLoadingAutoCountry||(l.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup((t="")=>{let e=t.toLowerCase();V(e)?(l.autoCountry=e,setTimeout(()=>S("handleAutoCountry"))):(this._d(!0),S("rejectAutoCountryPromise"))},()=>{this._d(!0),S("rejectAutoCountryPromise")}))}_m(){this._l(),this.ui.searchInput.value="+",this._ae("")}_j(){this._p(),this._n(),this._o()}_p(){let{strictMode:t,formatAsYouType:e,separateDialCode:i,allowDropdown:n,countrySearch:s}=this.options,o=!1;N.ALPHA_UNICODE.test(this.ui.telInput.value)&&(o=!0);let a=u=>{if(this.i&&u?.data==="+"&&i&&n&&s){let g=this.ui.telInput.selectionStart||0,E=this.ui.telInput.value.substring(0,g-1),b=this.ui.telInput.value.substring(g);this.ui.telInput.value=E+b,this._m();return}this._ai(this.ui.telInput.value)&&this._ar();let d=u?.data&&N.NON_PLUS_NUMERIC.test(u.data),c=u?.inputType===W.PASTE&&this.ui.telInput.value;d||c&&!t?o=!0:N.NON_PLUS_NUMERIC.test(this.ui.telInput.value)||(o=!1);let m=u?.detail&&u.detail.isSetNumber;if(e&&!o&&!m){let g=this.ui.telInput.selectionStart||0,b=this.ui.telInput.value.substring(0,g).replace(N.NON_PLUS_NUMERIC_GLOBAL,"").length,_=u?.inputType===W.DELETE_FWD,f=this._ap(),I=ut(f,this.ui.telInput.value,l.utils,this.selectedCountryData,this.options.separateDialCode),v=dt(b,I,g,_);this.ui.telInput.value=I,this.ui.telInput.setSelectionRange(v,v)}};this.ui.telInput.addEventListener("input",a,{signal:this.g.signal})}_n(){let{strictMode:t,separateDialCode:e,allowDropdown:i,countrySearch:n}=this.options;if(t||e){let s=o=>{if(o.key&&o.key.length===1&&!o.altKey&&!o.ctrlKey&&!o.metaKey){if(e&&i&&n&&o.key==="+"){o.preventDefault(),this._m();return}if(t){let a=this.ui.telInput.value,d=!a.startsWith("+")&&this.ui.telInput.selectionStart===0&&o.key==="+",c=/^[0-9]$/.test(o.key),m=e?c:d||c,g=a.slice(0,this.ui.telInput.selectionStart)+o.key+a.slice(this.ui.telInput.selectionEnd),E=this._ap(g),b=l.utils.getCoreNumber(E,this.selectedCountryData.iso2),_=this.n&&b.length>this.n,I=this._s(E)!==null;(!m||_&&!I&&!d)&&o.preventDefault()}}};this.ui.telInput.addEventListener("keydown",s,{signal:this.g.signal})}}_o(){if(this.options.strictMode){let t=e=>{e.preventDefault();let i=this.ui.telInput,n=i.selectionStart,s=i.selectionEnd,o=i.value.slice(0,n),a=i.value.slice(s),u=this.selectedCountryData.iso2,d=e.clipboardData.getData("text"),c=n===0&&s>0,m=!i.value.startsWith("+")||c,g=d.replace(N.NON_PLUS_NUMERIC_GLOBAL,""),E=g.startsWith("+"),b=g.replace(/\+/g,""),_=E&&m?`+${b}`:b,f=o+_+a,I=l.utils.getCoreNumber(f,u);for(;I.length===0&&f.length>0;)f=f.slice(0,-1),I=l.utils.getCoreNumber(f,u);if(!I)return;if(this.n&&I.length>this.n)if(i.selectionEnd===i.value.length){let ct=I.length-this.n;f=f.slice(0,f.length-ct)}else return;i.value=f;let v=n+_.length;i.setSelectionRange(v,v),i.dispatchEvent(new InputEvent("input",{bubbles:!0}))};this.ui.telInput.addEventListener("paste",t,{signal:this.g.signal})}}_k(t){let e=Number(this.ui.telInput.getAttribute("maxlength"));return e&&t.length>e?t.substring(0,e):t}_as(t,e={}){let i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});this.ui.telInput.dispatchEvent(i)}_l(){let{fixDropdownWidth:t,countrySearch:e}=this.options;if(this.h=new AbortController,t&&(this.ui.dropdownContent.style.width=`${this.ui.telInput.offsetWidth}px`),this.ui.dropdownContent.classList.remove(h.HIDE),this.ui.selectedCountry.setAttribute(p.EXPANDED,"true"),this._x(),e){let i=this.ui.countryList.firstElementChild;i&&(this.ui.highlightListItem(i,!1),this.ui.countryList.scrollTop=0),this.ui.searchInput.focus()}this._y(),this.ui.dropdownArrow.classList.add(h.ARROW_UP),this._as(w.OPEN_COUNTRY_DROPDOWN)}_x(){if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.ui.dropdown),!this.options.useFullscreenPopup){let t=this.ui.telInput.getBoundingClientRect(),e=this.ui.telInput.offsetHeight;if(this.options.dropdownContainer){this.ui.dropdown.style.top=`${t.top+e}px`,this.ui.dropdown.style.left=`${t.left}px`;let i=()=>this._am();window.addEventListener("scroll",i,{signal:this.h.signal})}}}_y(){let t=this.h.signal;this._z(t),this._aa(t),this._ab(t),this._ac(t),this.options.countrySearch&&this._ad(t)}_z(t){let e=i=>{let n=i.target?.closest(`.${h.COUNTRY_ITEM}`);n&&this.ui.highlightListItem(n,!1)};this.ui.countryList.addEventListener("mouseover",e,{signal:t})}_aa(t){let e=i=>{let n=i.target?.closest(`.${h.COUNTRY_ITEM}`);n&&this._al(n)};this.ui.countryList.addEventListener("click",e,{signal:t})}_ab(t){let e=i=>{!!i.target.closest(`#iti-${this.id}__dropdown-content`)||this._am()};setTimeout(()=>{document.documentElement.addEventListener("click",e,{signal:t})},0)}_ac(t){let e="",i=null,n=s=>{[y.ARROW_UP,y.ARROW_DOWN,y.ENTER,y.ESC].includes(s.key)&&(s.preventDefault(),s.stopPropagation(),s.key===y.ARROW_UP||s.key===y.ARROW_DOWN?this._af(s.key):s.key===y.ENTER?this._ag():s.key===y.ESC&&this._am()),!this.options.countrySearch&&N.HIDDEN_SEARCH_CHAR.test(s.key)&&(s.stopPropagation(),i&&clearTimeout(i),e+=s.key.toLowerCase(),this._q(e),i=setTimeout(()=>{e=""},X.HIDDEN_SEARCH_RESET_MS))};document.addEventListener("keydown",n,{signal:t})}_ad(t){let e=()=>{let o=this.ui.searchInput.value.trim();this._ae(o),this.ui.searchInput.value?this.ui.k.classList.remove(h.HIDE):this.ui.k.classList.add(h.HIDE)},i=null,n=()=>{i&&clearTimeout(i),i=setTimeout(()=>{e(),i=null},100)};this.ui.searchInput.addEventListener("input",n,{signal:t});let s=()=>{this.ui.searchInput.value="",this.ui.searchInput.focus(),e()};this.ui.k.addEventListener("click",s,{signal:t})}_q(t){let e=tt(this.countries,t);if(e){let i=e.nodeById[this.id];this.ui.highlightListItem(i,!1),this.ui.scrollTo(i)}}_ae(t){let e;t===""?e=this.countries:e=Z(this.countries,t),this.ui.filterCountries(e)}_af(t){let e=t===y.ARROW_UP?this.ui.highlightedItem?.previousElementSibling:this.ui.highlightedItem?.nextElementSibling;!e&&this.ui.countryList.childElementCount>1&&(e=t===y.ARROW_UP?this.ui.countryList.lastElementChild:this.ui.countryList.firstElementChild),e&&(this.ui.scrollTo(e),this.ui.highlightListItem(e,!1))}_ag(){this.ui.highlightedItem&&this._al(this.ui.highlightedItem)}_ah(t){let e=t;if(this.options.formatOnDisplay&&l.utils&&this.selectedCountryData){let i=this.options.nationalMode||!e.startsWith("+")&&!this.options.separateDialCode,{NATIONAL:n,INTERNATIONAL:s}=l.utils.numberFormat,o=i?n:s;e=l.utils.formatNumber(e,this.selectedCountryData.iso2,o)}e=this._aq(e),this.ui.telInput.value=e}_ai(t){let e=this._s(t);return e!==null?this._aj(e):!1}_r(t){let{dialCode:e,nationalPrefix:i}=this.selectedCountryData;if(t.startsWith("+")||!e)return t;let o=i&&t.startsWith(i)&&!this.options.separateDialCode?t.substring(1):t;return`+${e}${o}`}_s(t){let e=t.indexOf("+"),i=e?t.substring(e):t,n=this.selectedCountryData.iso2,s=this.selectedCountryData.dialCode;i=this._r(i);let o=this._ao(i,!0),a=D(i);if(o){let u=D(o),d=this.dialCodeToIso2Map[u];if(d.length===1)return d[0]===n?null:d[0];if(!n&&this.f&&d.includes(this.f))return this.f;if(s===M.NANP&&z(a))return null;let{areaCodes:m,priority:g}=this.selectedCountryData;if(m){let I=m.map(v=>`${s}${v}`);for(let v of I)if(a.startsWith(v))return null}let b=m&&!(g===0)&&a.length>u.length,_=n&&d.includes(n)&&!b,f=n===d[0];if(!_&&!f)return d[0]}else{if(i.startsWith("+")&&a.length)return"";if((!i||i==="+")&&!n)return this.f}return null}_aj(t){let{separateDialCode:e,showFlags:i,i18n:n}=this.options,s=this.selectedCountryData.iso2||"";if(this.selectedCountryData=t?this.j.get(t):{},this.selectedCountryData.iso2&&(this.f=this.selectedCountryData.iso2),this.ui.selectedCountry){let o=t&&i?`${h.FLAG} iti__${t}`:`${h.FLAG} ${h.GLOBE}`,a,u;if(t){let{name:d,dialCode:c}=this.selectedCountryData;u=d,a=n.selectedCountryAriaLabel.replace("${countryName}",d).replace("${dialCode}",`+${c}`)}else u=n.noCountrySelected,a=n.noCountrySelected;this.ui.selectedCountryInner.className=o,this.ui.selectedCountry.setAttribute("title",u),this.ui.selectedCountry.setAttribute(p.LABEL,a)}if(e){let o=this.selectedCountryData.dialCode?`+${this.selectedCountryData.dialCode}`:"";this.ui.selectedDialCode.textContent=o,this.ui.updateInputPadding()}return this._ak(),this._t(),s!==t}_t(){let{strictMode:t,placeholderNumberType:e,validationNumberTypes:i}=this.options,{iso2:n}=this.selectedCountryData;if(t&&l.utils)if(n){let s=l.utils.numberType[e],o=l.utils.getExampleNumber(n,!1,s,!0),a=o;for(;l.utils.isPossibleNumber(o,n,i);)a=o,o+="0";let u=l.utils.getCoreNumber(a,n);this.n=u.length,n==="by"&&(this.n=u.length+1)}else this.n=null}_ak(){let{autoPlaceholder:t,placeholderNumberType:e,nationalMode:i,customPlaceholder:n}=this.options,s=t===A.AGGRESSIVE||!this.ui.a&&t===A.POLITE;if(l.utils&&s){let o=l.utils.numberType[e],a=this.selectedCountryData.iso2?l.utils.getExampleNumber(this.selectedCountryData.iso2,i,o):"";a=this._aq(a),typeof n=="function"&&(a=n(a,this.selectedCountryData)),this.ui.telInput.setAttribute("placeholder",a)}}_al(t){let e=t.dataset[$.COUNTRY_CODE],i=this._aj(e);this._am();let n=t.dataset[$.DIAL_CODE];this._an(n),this.options.formatOnDisplay&&this._ah(this.ui.telInput.value),this.ui.telInput.focus(),i&&this._ar()}_am(){this.ui.dropdownContent.classList.contains(h.HIDE)||(this.ui.dropdownContent.classList.add(h.HIDE),this.ui.selectedCountry.setAttribute(p.EXPANDED,"false"),this.ui.highlightedItem&&this.ui.highlightedItem.setAttribute(p.SELECTED,"false"),this.options.countrySearch&&this.ui.searchInput.removeAttribute(p.ACTIVE_DESCENDANT),this.ui.dropdownArrow.classList.remove(h.ARROW_UP),this.h.abort(),this.h=null,this.options.dropdownContainer&&this.ui.dropdown.remove(),this._as(w.CLOSE_COUNTRY_DROPDOWN))}_an(t){let e=this.ui.telInput.value,i=`+${t}`,n;if(e.startsWith("+")){let s=this._ao(e);s?n=e.replace(s,i):n=i,this.ui.telInput.value=n}}_ao(t,e){let i="";if(t.startsWith("+")){let n="";for(let s=0;s<t.length;s++){let o=t.charAt(s);if(/[0-9]/.test(o)){if(n+=o,!!!this.dialCodeToIso2Map[n])break;if(e)i=t.substring(0,s+1);else if(this.dialCodes.has(n)){i=t.substring(0,s+1);break}if(n.length===this.dialCodeMaxLen)break}}}return i}_ap(t){let e=t||this.ui.telInput.value.trim(),{dialCode:i}=this.selectedCountryData,n,s=D(e);return this.options.separateDialCode&&!e.startsWith("+")&&i&&s?n=`+${i}`:n="",n+e}_aq(t){let e=this._ao(t),i=lt(t,e,this.options.separateDialCode,this.selectedCountryData);return this._k(i)}_ar(){this._as(w.COUNTRY_CHANGE)}handleAutoCountry(){this.options.initialCountry===x.AUTO&&l.autoCountry&&(this.f=l.autoCountry,this.selectedCountryData.iso2||this.ui.selectedCountryInner.classList.contains(h.GLOBE)||this.setCountry(this.f),this.b())}handleUtils(){l.utils&&(this.ui.telInput.value&&this._ah(this.ui.telInput.value),this.selectedCountryData.iso2&&(this._ak(),this._t())),this.d()}destroy(){this.ui.telInput&&(this.options.allowDropdown&&this._am(),this.g.abort(),this.g=null,this.ui.destroy(),l.instances instanceof Map?l.instances.delete(this.id):delete l.instances[this.id])}getExtension(){return l.utils?l.utils.getExtension(this._ap(),this.selectedCountryData.iso2):""}getNumber(t){if(l.utils){let{iso2:e}=this.selectedCountryData;return l.utils.formatNumber(this._ap(),e,t)}return""}getNumberType(){return l.utils?l.utils.getNumberType(this._ap(),this.selectedCountryData.iso2):F.UNKNOWN_NUMBER_TYPE}getSelectedCountryData(){return this.selectedCountryData}getValidationError(){if(l.utils){let{iso2:t}=this.selectedCountryData;return l.utils.getValidationError(this._ap(),t)}return F.UNKNOWN_VALIDATION_ERROR}isValidNumber(){let{dialCode:t,iso2:e}=this.selectedCountryData;if(t===O.DIAL_CODE&&l.utils){let i=this._ap(),n=l.utils.getCoreNumber(i,e);if(n[0]===O.MOBILE_PREFIX&&n.length!==O.MOBILE_CORE_LENGTH)return!1}return this._v(!1)}isValidNumberPrecise(){return this._v(!0)}_u(t){return l.utils?l.utils.isPossibleNumber(t,this.selectedCountryData.iso2,this.options.validationNumberTypes):null}_v(t){if(!l.utils)return null;if(!this.selectedCountryData.iso2)return!1;let e=o=>t?this._w(o):this._u(o),i=this._ap(),n=i.search(N.ALPHA_UNICODE);if(n>-1&&!this.options.allowPhonewords){let o=i.substring(0,n),a=e(o),u=e(i);return a&&u}return e(i)}_w(t){return l.utils?l.utils.isValidNumber(t,this.selectedCountryData.iso2,this.options.validationNumberTypes):null}setCountry(t){let e=t?.toLowerCase();if(!V(e))throw new Error(`Invalid country code: '${e}'`);let i=this.selectedCountryData.iso2;(t&&e!==i||!t&&i)&&(this._aj(e),this._an(this.selectedCountryData.dialCode),this.options.formatOnDisplay&&this._ah(this.ui.telInput.value),this._ar())}setNumber(t){let e=this._ai(t);this._ah(t),e&&this._ar(),this._as(w.INPUT,{isSetNumber:!0})}setPlaceholderNumberType(t){this.options.placeholderNumberType=t,this._ak()}setDisabled(t){this.ui.telInput.disabled=t,t?this.ui.selectedCountry.setAttribute("disabled","true"):this.ui.selectedCountry.removeAttribute("disabled")}},Dt=r=>{if(!l.utils&&!l.startedLoadingUtilsScript){let t;if(typeof r=="function")try{t=Promise.resolve(r())}catch(e){return Promise.reject(e)}else return Promise.reject(new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof r}`));return l.startedLoadingUtilsScript=!0,t.then(e=>{let i=e?.default;if(!i||typeof i!="object")throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");return l.utils=i,S("handleUtils"),!0}).catch(e=>{throw S("rejectUtilsScriptPromise",e),e})}return null},S=(r,...t)=>{Object.values(l.instances).forEach(e=>{let i=e[r];typeof i=="function"&&i.apply(e,t)})},l=Object.assign((r,t)=>{let e=new k(r,t);return l.instances[e.id]=e,r.iti=e,e},{defaults:K,documentReady:()=>document.readyState==="complete",getCountryData:()=>L,getInstance:r=>{let t=r.dataset.intlTelInputId;return t?l.instances[t]:null},instances:{},attachUtils:Dt,startedLoadingUtilsScript:!1,startedLoadingAutoCountry:!1,version:"25.11.3"}),wt=l;return ft(At);})();
|
||
return factoryOutput.default;
|
||
}));
|
||
; |