(()=>{var t={2962:()=>{window.jetpackForms=window.jetpackForms||{},window.jetpackForms.getBackgroundColor=function(t){let o=window.getComputedStyle(t).backgroundColor;for(;"rgba(0, 0, 0, 0)"===o&&t.parentNode&&t.parentNode.nodeType===window.Node.ELEMENT_NODE;)if("wp-block-cover"!==(t=t.parentNode).className)o=window.getComputedStyle(t).backgroundColor;else{const e=t.querySelector(".wp-block-cover__background");o=window.getComputedStyle(e).backgroundColor}return o},window.jetpackForms.generateStyleVariables=function(t){if(!t)return;const o=window["editor-canvas"]?window["editor-canvas"].document:document,e=o.querySelector("body"),r=o.createElement("div");r.className="contact-form__style-probe",r.style="position: absolute; z-index: -1; width: 1px; height: 1px; visibility: hidden",r.innerHTML='\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t',t.parentNode.appendChild(r);const n=r.querySelector(".btn-primary"),c=r.querySelector(".btn-outline"),a=r.querySelector('input[type="text"]'),d=window.jetpackForms.getBackgroundColor(e),i=window.jetpackForms.getBackgroundColor(a),l=window.getComputedStyle(a).backgroundColor,{border:p,borderColor:u,backgroundColor:b,color:s}=window.getComputedStyle(n),{backgroundColor:k,border:m,borderWidth:f,borderRadius:w,color:g,padding:j,lineHeight:y}=window.getComputedStyle(c),v=window.jetpackForms.getBackgroundColor(c),{color:C,padding:S,paddingTop:h,paddingLeft:_,border:x,borderColor:F,borderWidth:N,borderStyle:T,borderRadius:q,fontSize:E,fontFamily:z,lineHeight:B}=window.getComputedStyle(a);return r.remove(),{"--jetpack--contact-form--primary-color":b,"--jetpack--contact-form--background-color":d,"--jetpack--contact-form--text-color":C,"--jetpack--contact-form--border":x,"--jetpack--contact-form--border-color":F,"--jetpack--contact-form--border-size":N,"--jetpack--contact-form--border-style":T,"--jetpack--contact-form--border-radius":q,"--jetpack--contact-form--input-background":l,"--jetpack--contact-form--input-background-fallback":i,"--jetpack--contact-form--input-padding":S,"--jetpack--contact-form--input-padding-top":h,"--jetpack--contact-form--input-padding-left":_,"--jetpack--contact-form--font-size":E,"--jetpack--contact-form--font-family":z,"--jetpack--contact-form--line-height":B,"--jetpack--contact-form--button-primary--color":s,"--jetpack--contact-form--button-primary--background-color":b,"--jetpack--contact-form--button-primary--border":p,"--jetpack--contact-form--button-primary--border-color":u,"--jetpack--contact-form--button-outline--padding":j,"--jetpack--contact-form--button-outline--border":m,"--jetpack--contact-form--button-outline--background-color":k,"--jetpack--contact-form--button-outline--background-color-fallback":v,"--jetpack--contact-form--button-outline--border-size":f,"--jetpack--contact-form--button-outline--border-radius":w,"--jetpack--contact-form--button-outline--text-color":g,"--jetpack--contact-form--button-outline--line-height":y}}}},o={};function e(r){var n=o[r];if(void 0!==n)return n.exports;var c=o[r]={exports:{}};return t[r](c,c.exports,e),c.exports}e.n=t=>{var o=t&&t.__esModule?()=>t.default:()=>t;return e.d(o,{a:o}),o},e.d=(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},e.o=(t,o)=>Object.prototype.hasOwnProperty.call(t,o),(()=>{"use strict";e(2962);const{generateStyleVariables:t}=window.jetpackForms,o=setTimeout((()=>{r()}),3e3);function r(){const o=document.querySelectorAll(".wp-block-jetpack-contact-form-container");for(const e of o){const o=t(e);if(!o)return;for(const t in o)e.style.setProperty(t,o[t])}}window.addEventListener("load",(()=>{clearTimeout(o),r()}))})()})();; (()=>{document.addEventListener("DOMContentLoaded",(()=>{t()}));const{__:__,_n:_n}=wp.i18n,e={ /* translators: text read by a screen reader when a warning icon is displayed in front of an error message. */ warning:__("Warning.","jetpack-forms"), /* translators: error message shown when one or more fields of the form are invalid. */ invalidForm:__("Please make sure all fields are valid.","jetpack-forms"), /* translators: error message shown when a multiple choice field requires at least one option to be selected. */ checkboxMissingValue:__("Please select at least one option.","jetpack-forms"), /* translators: error message shown when a user enters an invalid date */ invalidDate:__("The date is not valid.","jetpack-forms"), /* translators: text read by a screen reader when a form is being submitted */ submittingForm:__("Submitting form","jetpack-forms"), /* translators: generic error message */ genericError:__("Please correct this field","jetpack-forms"), /* translators: error message shown when no field has been filled out */ emptyForm:__("The form you are trying to submit is emtpy.","jetpack-forms"),errorCount:e=>/* translators: message displayed when errors need to be fixed. %d is the number of errors. */ _n("You need to fix %d error.","You need to fix %d errors.",e,"jetpack-forms")},t=()=>{document.querySelectorAll(".wp-block-jetpack-contact-form-container form.contact-form").forEach(r)};const r=e=>{e.hasAttribute("novalidate")||e.setAttribute("novalidate",!0);const t={hasInsetLabel:m(e)};let r={};const i=a=>{if(a.preventDefault(),o(e))return;L(e,r,t);const s=n(e);(function(e){const t=e.cloneNode(!0);Array.from(t.querySelectorAll('input[type="hidden"]')).forEach((e=>e.remove()));const r=new FormData(t);return!Array.from(r.values()).some((e=>e instanceof File?!!e.size:!!e?.trim?.()))})(e)&&s?T(e,[],{disableLiveRegion:!0,type:"emptyForm"}):s?(r={},e.removeEventListener("submit",i),x(e)):r=j(e,t)};e.addEventListener("submit",i)},n=e=>{let t=e.checkValidity();if(!t)return!1;const r=f(e);for(const e of r)if(s(e)&&!d(e))return!1;const n=h(e);for(const e of n)if(!u(e))return!1;return t},o=e=>!0===e.getAttribute("data-submitting"),i=e=>"fieldset"===e.tagName.toLowerCase()&&e.classList.contains("grunion-checkbox-multiple-options"),a=e=>"fieldset"===e.tagName.toLowerCase()&&e.classList.contains("grunion-radio-options"),s=e=>e.hasAttribute("data-required"),c=e=>{return"input"===(t=e).tagName.toLowerCase()&&t.classList.contains("jp-contact-form-date")&&e.value?u(e):e.validity.valid;var t},l=e=>{const t=Array.from(e.querySelectorAll('input[type="radio"]'));return t.length>0&&t.every((e=>e.validity.valid))},d=e=>{if(!s(e))return!0;const t=Array.from(e.querySelectorAll('input[type="checkbox"]'));return t.length>0&&t.some((e=>e.checked))},u=t=>{const r=t.getAttribute("data-format"),n=t.value,o=window.jQuery;if(n&&r&&void 0!==o)try{o.datepicker.parseDate(r,n),t.setCustomValidity("")}catch{return t.setCustomValidity(e.invalidDate),!1}return!0},m=e=>{const t=e.querySelector(".wp-block-jetpack-contact-form");if(!t)return!1;const r=t.classList;return r.contains("is-style-outlined")||r.contains("is-style-animated")},p=e=>e.querySelector('[type="submit"]')||e.querySelector('button:not([type="reset"])'),f=e=>Array.from(e.querySelectorAll(".grunion-checkbox-multiple-options")),h=e=>Array.from(e.querySelectorAll("input.jp-contact-form-date")),b=e=>{const t=C((e=>Array.from(e.elements).filter((e=>!["hidden","submit"].includes(e.type)&&null!==e.offsetParent)))(e)),r={simple:t.default,singleChoice:[],multipleChoice:[]},n=t.radios.reduce(((e,t)=>e.includes(t.name)?e:[...e,t.name]),[]);for(const t of n){const n=e.querySelector(`input[type="radio"][name="${t}"]`);if(n){const e=n.closest("fieldset");e&&r.singleChoice.push(e)}}const o=t.checkboxes.reduce(((e,t)=>e.includes(t.name)?e:[...e,t.name]),[]);for(const t of o){const n=e.querySelector(`input[type="checkbox"][name="${t}"]`);if(n){const e=n.closest("fieldset");e&&r.multipleChoice.push(e)}}return r},y=e=>e.querySelector(".contact-form__error"),v=e=>e.querySelectorAll("[aria-invalid]"),g=t=>{const r=document.createDocumentFragment();return r.appendChild((()=>{const t=document.createElement("span"),r=document.createElement("span"),n=document.createElement("i");return r.textContent=e.warning,r.classList.add("visually-hidden"),n.setAttribute("aria-hidden",!0),t.classList.add("contact-form__warning-icon"),t.appendChild(r),t.appendChild(n),t})()),r.appendChild((e=>{const t=document.createElement("span");return t.textContent=e,t})(t)),r},A=e=>{const t=document.createElement("div");return t.id=e,t.classList.add("contact-form__input-error"),t},C=e=>e.reduce(((e,t)=>{switch(t.type){case"radio":e.radios.push(t);break;case"checkbox":t.name.indexOf("[]")===t.name.length-2?e.checkboxes.push(t):e.default.push(t);break;default:e.default.push(t)}return e}),{default:[],radios:[],checkboxes:[]}),L=(e,t,r)=>{k(e,r);for(const r in t)e.querySelectorAll(`[name="${r}"]`).forEach((e=>e.removeEventListener(t[r][0],t[r][1])))},k=(e,t)=>{q(e),E(e,t)},q=e=>{const t=y(e);t&&t.replaceChildren()},E=(e,t)=>{for(const r of v(e))a(r)||i(r)?S(r):w(r,t)},S=e=>{e.removeAttribute("aria-invalid"),e.removeAttribute("aria-describedby");const t=e.querySelector(".contact-form__input-error");t&&t.replaceChildren()},w=(e,t)=>{e.removeAttribute("aria-invalid"),e.removeAttribute("aria-describedby");const r=e.closest(t.hasInsetLabel?".contact-form__inset-label-wrap":".grunion-field-wrap");if(!r)return;const n=r.querySelector(".contact-form__input-error");n&&n.replaceChildren()},x=e=>{_(e),e.setAttribute("data-submitting",!0),e.submit()},_=t=>{const r=p(t);r&&(r.setAttribute("aria-disabled",!0),r.appendChild((()=>{const t=document.createElement("span"),r=document.createElement("span"),n=document.createElement("span");return r.setAttribute("aria-hidden",!0),r.innerHTML='',n.classList.add("visually-hidden"),n.textContent=e.submittingForm,t.classList.add("contact-form__spinner"),t.appendChild(r),t.appendChild(n),t})()))},j=(e,t)=>(D(e,t),M(e,t)),M=(e,t)=>{let r={};const n=()=>V(e);for(const c of v(e)){let l;l=a(c)&&(o=c,Array.from(o.querySelectorAll('input[type="radio"]')).some((e=>e.hasAttribute("required")||e.hasAttribute("aria-required"))))?F(c,n,e,t):i(c)&&s(c)?$(c,n,e,t):N(c,n,e,t),r={...r,...l}}var o;return r},F=(e,t,r,n)=>{const o={},i=()=>{l(e)?S(e):R(e,r,n),t()},a=e.querySelectorAll('input[type="radio"]');for(const e of a)e.addEventListener("blur",i),e.addEventListener("change",i),o[e.name]=["blur",i],o[e.name]=["change",i];return o},$=(e,t,r,n)=>{const o={},i=()=>{d(e)?S(e):Z(e,r,n),t()},a=e.querySelectorAll('input[type="checkbox"]');for(const e of a)e.addEventListener("blur",i),e.addEventListener("change",i),o[e.name]=["blur",i],o[e.name]=["change",i];return o},N=(e,t,r,n)=>{const o=e.validity.valueMissing,i={},a=()=>{c(e)?w(e,n):I(e,r,n),t()},s=()=>{e.validity.valueMissing?I(e,r,n):w(e,n),t()};return e.addEventListener("blur",a),i[e.name]=["blur",a],o&&(e.addEventListener("input",s),i[e.name]=["input",s]),i},D=(e,t)=>{const r=P(e,t);T(e,r)},T=(t,r,n={})=>{let o=y(t);if(!o){o=(()=>{const e=document.createElement("div");return e.classList.add("contact-form__error"),e})();const e=p(t);e?e.parentNode.parentNode.insertBefore(o,e.parentNode):t.appendChild(o)}const{disableLiveRegion:s}=n;s?(o.removeAttribute("aria-live"),o.removeAttribute("role")):(o.setAttribute("aria-live","assertive"),o.setAttribute("role","alert"));const c=r.length;if(!c&&e[n.type])return void o.appendChild(g(e[n.type]));const l=[e.invalidForm];c>0&&l.push(e.errorCount(c).replace("%d",c)),o.appendChild(g(l.join(" "))),c>0&&o.appendChild(((e,t)=>{const r=document.createElement("ul");for(const n of t){const t=n.id;if(!t)continue;let o;if(o=i(n)||a(n)?n.querySelector("legend"):e.querySelector(`label[for="${t}"]`),!o)continue;const s=document.createElement("li"),c=document.createElement("a");c.textContent=o.innerText,c.setAttribute("href",`#${t}`),s.appendChild(c),r.appendChild(s)}return r})(t,r))},V=e=>{q(e),n(e)||T(e,v(e),{disableLiveRegion:!0})},P=(e,t)=>{const r=[],{simple:n,singleChoice:o,multipleChoice:i}=b(e);for(const o of n)c(o)||(I(o,e,t),r.push(o));for(const n of o)l(n)||(R(n,e,t),r.push(n));for(const n of i)d(n)||(Z(n,e,t),r.push(n));return r},I=(e,t,r)=>{const n=`${e.name}-error`;let o=t.querySelector(`#${n}`);if(!o){o=A(n);const t=e.closest(r.hasInsetLabel?".contact-form__inset-label-wrap":".grunion-field-wrap");t&&t.appendChild(o)}o.replaceChildren(g(e.validationMessage)),e.setAttribute("aria-invalid","true"),e.setAttribute("aria-describedby",n)},R=(e,t,r)=>{B(e,t,r)},Z=(t,r,n)=>{B(t,r,{...n,message:e.checkboxMissingValue})},B=(t,r,n)=>{const o=t.querySelector("input");if(!o)return;const i=`${o.name.replace("[]","")}-error`;let a=r.querySelector(`#${i}`);a||(a=A(i)),a.replaceChildren(g(o.validationMessage||n.message||e.genericError)),t.appendChild(a),t.setAttribute("aria-invalid","true"),t.setAttribute("aria-describedby",i)}})();;