import*as e from"@wordpress/interactivity";var t={6941(e,t,r){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,s=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(s=n))}),t.splice(s,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=r(3212)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},3212(e,t,r){e.exports=function(e){function t(e){let r,s,o,i=null;function a(...e){if(!a.enabled)return;const n=a,s=Number(new Date),o=s-(r||s);n.diff=o,n.prev=r,n.curr=s,r=s,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(r,s)=>{if("%%"===r)return"%";i++;const o=t.formatters[s];if("function"==typeof o){const t=e[i];r=o.call(n,t),e.splice(i,1),i--}return r}),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(s!==t.namespaces&&(s=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(a),a}function n(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function s(e,t){let r=0,n=0,s=-1,o=0;for(;r"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of r)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const r of t.skips)if(s(e,r))return!1;for(const r of t.names)if(s(e,r))return!0;return!1},t.humanize=r(4997),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(r=>{t[r]=e[r]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t=1.5*r;return Math.round(e/r)+" "+n+(s?"s":"")}e.exports=function(e,l){l=l||{};var c=typeof e;if("string"===c&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!a)return;var l=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return l*i;case"weeks":case"week":case"w":return l*o;case"days":case"day":case"d":return l*s;case"hours":case"hour":case"hrs":case"hr":case"h":return l*n;case"minutes":case"minute":case"mins":case"min":case"m":return l*r;case"seconds":case"second":case"secs":case"sec":case"s":return l*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return}}(e);if("number"===c&&isFinite(e))return l.long?function(e){var o=Math.abs(e);if(o>=s)return a(e,o,s,"day");if(o>=n)return a(e,o,n,"hour");if(o>=r)return a(e,o,r,"minute");if(o>=t)return a(e,o,t,"second");return e+" ms"}(e):function(e){var o=Math.abs(e);if(o>=s)return Math.round(e/s)+"d";if(o>=n)return Math.round(e/n)+"h";if(o>=r)return Math.round(e/r)+"m";if(o>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},3043(e,t,r){r.d(t,{Kz:()=>l,rM:()=>c});var n=r(2833),s=r(6941);const o=r.n(s)()("jetpack-forms:interactivity"),i=(0,n.getConfig)("jetpack/form"),a=e=>document.getElementById("jp-form-"+e),l=e=>{const t=a(e);if(!t)return;const r=t.querySelector(".is-current-step").querySelectorAll("input, select, textarea, .jetpack-form-file-field__dropzone-inner, [tabindex]:not([disabled])");r[0]?.focus()},c=async e=>{const t=a(e);if(!t)return{success:!1,error:"Form not found"};try{const e=new FormData(t),r=`${i?.admin_ajax_url||"/wp-admin/admin-ajax.php"}?action=grunion-contact-form`,n=await fetch(r,{method:"POST",body:e,headers:{Accept:"application/json"}}),s=await n.json();return n.ok?s:(o(`Form submission failed: ${s?.data?.code}`,n),s&&s.data&&s.data.error?{success:!1,error:s.data.error}:{success:!1,error:i?.error_types?.network_error})}catch(e){return o("Form submission failed",e),{success:!1,error:i?.error_types?.network_error}}}},7119(e){e.exports='\n'},8234(e){e.exports='\n'},4238(e){e.exports='\n'},1200(e){e.exports='\n'},3012(e){e.exports='\n'},8586(e){e.exports='\n'},9144(e){e.exports='\n'},4401(e){e.exports='\n'},5335(e){e.exports='\n'},7343(e){e.exports='\n'},842(e){e.exports='\n'},8640(e){e.exports='\n'},4971(e){e.exports='\n'},3312(e){e.exports='\n'},1401(e){e.exports='\n'},8804(e){e.exports='\n'},9971(e){e.exports='\n'},201(e){e.exports='\n'},2833(t,r,n){t.exports=(e=>{var t={};return n.d(t,e),t})({getConfig:()=>e.getConfig,getContext:()=>e.getContext,getElement:()=>e.getElement,store:()=>e.store,withSyncEvent:()=>e.withSyncEvent})},402(e,t,r){r.d(t,{Vp:()=>s});const n={stars:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.62L12 2 9.19 8.62 2 9.24l5.46 4.73L5.82 21z",hearts:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"};function s(e,t,r,s=""){const o=n[r]||n.stars;let i=s?`${s}`:"";for(let r=1;r<=t;r++){i+=``}return i}},3983(e,t,r){r.d(t,{Po:()=>n,jr:()=>s});const n=e=>null==e||("string"==typeof e&&""===e.trim()||(!(!Array.isArray(e)||0!==e.length&&!e.every(e=>n(e)))||!("object"!=typeof e||0!==Object.keys(e).length&&!Object.values(e).every(e=>n(e))))),s=(e,t,r,s=null)=>{if(n(t)&&r)return"is_required";if(!r&&n(t))return"yes";if("date"===e)return((e,t)=>{let r,n,s;if(!e)return!1;switch(t){case"mm/dd/yy":[n,s,r]=e.split("/").map(Number);break;case"dd/mm/yy":[s,n,r]=e.split("/").map(Number);break;case"yy-mm-dd":[r,n,s]=e.split("-").map(Number);break;default:return!1}if(isNaN(r)||isNaN(n)||isNaN(s))return!1;const o=new Date(r,n-1,s);return o.getFullYear()===r&&o.getMonth()===n-1&&o.getDate()===s})(t,s)?"yes":"invalid_date";if("number"===e)return function(e,t){if(!/^-?\d+(\.\d+)?$/.test(e))return"invalid_number";const r=parseFloat(e);return t&&void 0!==t.min&&rparseFloat(t.max)?"invalid_max_number":"yes"}(t,s);if("file"===e)return t.some(e=>e.error)?"invalid_file_has_errors":t.some(e=>!e.isUploaded)?"invalid_file_uploading":"yes";let o=null;switch(e){case"url":o=/^(?:(?:[Hh][Tt][Tt][Pp][Ss]?|[Ff][Tt][Pp]):\/\/)?(?:\S+(?::\S*)?@|\d{1,3}(?:\.\d{1,3}){3}|(?:[a-zA-Z\d\u00a1-\uffff](?:[a-zA-Z\d\u00a1-\uffff-]*[a-zA-Z\d\u00a1-\uffff])?)(?:\.[a-zA-Z\d\u00a1-\uffff](?:[a-zA-Z\d\u00a1-\uffff-]*[a-zA-Z\d\u00a1-\uffff])?)*(?:\.[a-zA-Z\u00a1-\uffff]{2,6}))(?::\d+)?(?:[^\s]*)?$/;break;case"email":o=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;break;case"telephone":o=/^\+?[0-9\s\-()]+$/}return o&&!o.test(t)?"invalid_"+e:"yes"}},3020(e,t,r){function n(e){return"rating"===e?.type?{rating:e.rating??0,maxRating:e.maxRating??5,iconStyle:e.iconStyle??"stars"}:null}function s(e){return function(e){return"rating"===e?.type}(e)&&e?.displayValue?e.displayValue:null}r.d(t,{$t:()=>s,eL:()=>n})},1384(e,t,r){r.d(t,{eL:()=>o.eL});var n=r(2833),s=r(402),o=r(3020);(0,n.store)("jetpack/form",{callbacks:{watchRatingIcons(){const{ref:e}=(0,n.getElement)(),t=(0,n.getContext)();let r=t.submission?.rating;if(!r&&e?.dataset?.rating)try{r=JSON.parse(e.dataset.rating)}catch{}if(!r)return;const{rating:o,maxRating:i,iconStyle:a,screenReaderText:l}=r;e.innerHTML=(0,s.Vp)(o,i,a,l)}}})},7131(e,t,r){var n=r(2833),s=r(5505);(0,n.store)("jetpack/form",{callbacks:{watchFieldTypeIcon(){const{ref:e}=(0,n.getElement)();if(!e)return;if(e.dataset.renderedType&&""!==e.innerHTML.trim())return;const t=(0,n.getContext)(),r=t.submission?.type||"text";e.innerHTML=(0,s.L)(r),e.dataset.renderedType=r}}})},5505(e,t,r){r.d(t,{L:()=>y});var n=r(7119),s=r(8234),o=r(4238),i=r(1200),a=r(3012),l=r(8586),c=r(9144),u=r(4401),d=r(5335),f=r(7343),C=r(842),p=r(8640),m=r(4971),g=r(3312),h=r(1401),w=r(8804),v=r(9971);const b={text:h,textarea:w,name:u,email:i,phone:g,telephone:g,url:r(201),date:o,time:v,number:d,select:C,radio:p,checkbox:n,"checkbox-multiple":c,file:a,rating:f,consent:s,"image-select":l,slider:m};function y(e){return b[e]||b.text}},2416(e,t,r){r.d(t,{$R:()=>i,ID:()=>a,KR:()=>o,aX:()=>s});var n=r(3020);const s=e=>{const t=e||null;return t?t.endsWith("?")?t:t.replace(/[.:]$/,"")+":":null},o=e=>{if("image-select"===e?.type)return e.choices.map(e=>{let t=e.perceived;return e.showLabels&&null!=e.label&&""!==e.label&&(t+=" - "+e.label),t}).join(", ");if("url"===e?.type&&e?.url)return e.url;const t=(0,n.$t)(e);return t||(e?.name&&e?.size?e.name+" ("+e.size+")":e)},i=e=>"image-select"===e?.type?e.choices.map(e=>{const t=e.perceived??"",r=e.showLabels&&null!=e.label&&""!==e.label?e.label:"";return{src:e.image?.src??"",letterCode:t,label:r}}):null,a=e=>{if("url"===e?.type&&e?.url){let t=e.url;return/^https?:\/\//i.test(t)||(t="https://"+t),t}return null}}},r={};function n(e){var s=r[e];if(void 0!==s)return s.exports;var o=r[e]={exports:{}};return t[e](o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(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.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var s=n(2833),o=n(3983),i=n(1384),a=n(2416),l=n(3043);n(7131);const c=s.withSyncEvent||(e=>(...t)=>e(...t)),u="jetpack/form",d=(0,s.getConfig)(u);let f=null;const C=(e=[])=>{const t=(0,s.getContext)();t.submissionData=e,t.formattedSubmissionData=e.map(e=>{const t=(0,a.$R)(e.value),r=(0,a.ID)(e.value),n=h(e.value),s=(0,i.eL)(e.value);return{label:(0,a.aX)(e.label),value:(0,a.KR)(e.value),images:t,url:r,files:n,rating:s,type:e.type||"text",showPlainValue:!(r||s||t&&0!==t.length||n&&0!==n.length)}})},p=(e,t,r="",n="",i=!1,a=null)=>{const l=(0,s.getContext)();if(l.fields||(l.fields={}),!l.fields[e]){let s=!1,c=null;if("radio"===t&&n&&n.includes(": ")){const e=n.indexOf(": "),t=n.substring(0,e);t.length<30&&(s=!0,c=t)}l.fields[e]={id:e,type:t,label:r,value:n,isRequired:i,extra:a,error:(0,o.jr)(t,n,i,a),step:l?.step?l.step:1,isOtherSelected:s,otherLabel:c}}},m=e=>{if("number"===e.type){if("invalid_min_number"===e.error)return d.error_types.invalid_min_number.replace("%d",e.extra.min);if("invalid_max_number"===e.error)return d.error_types.invalid_max_number.replace("%d",e.extra.max)}return d.error_types&&d.error_types[e.error]};let g=new Map;const h=e=>"file"===e?.type&&e?.files?e.files.map(e=>{const t=e.name??"",r=g.get(t),n=!(!r?.previewUrl&&!r?.iconUrl);return{name:t,size:e.size??"",url:e.url??"",previewUrl:r?.previewUrl??null,iconUrl:r?.iconUrl??null,hasPreview:n}}):null,w=(e,t)=>{if(e){if(e.focus(),"checkbox"===e.type)e.checked=!e.checked,t.classList.toggle("is-checked",e.checked);else if("radio"===e.type){e.checked=!0;const r=t.closest(".jetpack-fieldset-image-options__wrapper");if(r){r.querySelectorAll(".jetpack-input-image-option").forEach(t=>{const r=t.querySelector("input");t.classList.toggle("is-checked",r.id===e.id)})}}e.dispatchEvent(new Event("change",{bubbles:!0}))}},v=(e,t)=>t?`${e}: ${t}`:e,{state:b,actions:y}=(0,s.store)(u,{state:{validators:{},get fieldHasErrors(){const e=(0,s.getContext)(),t=e.fieldId,r=e.fields[t]||{};if(!e.showErrors&&r.error&&"is_required"===r.error)return!1;if(e.isSingleInputForm&&e.submissionError)return!0;if(e.isForcedHorizontal&&e.submissionError){const n=r.error&&"yes"!==r.error;if(e.showErrors&&n)return!0;return t===Object.keys(e.fields||{})[0]}return(e.showErrors||r.showFieldError)&&r.error&&"yes"!==r.error},get fieldAriaInvalid(){return b.fieldHasErrors?"true":null},get isOtherSelected(){const e=(0,s.getContext)(),t=e.fieldId,r=e.fields[t];return r?.isOtherSelected||!1},get isFormEmpty(){const e=(0,s.getContext)();return!(e?.maxSteps&&e.maxSteps>0)&&!Object.values(e.fields).some(e=>!(0,o.Po)(e.value))},get isStepActive(){const e=(0,s.getContext)();return e.currentStep===e.stepIndex+1},get isStepCompleted(){const e=(0,s.getContext)();return e.currentStep>e.stepIndex+1},get isFieldEmpty(){const e=(0,s.getContext)(),t=e.fieldId,r=e.fields[t]||{};return(0,o.Po)(r?.value)},get hasFieldValue(){return!b.isFieldEmpty},get isSubmitting(){return(0,s.getContext)().isSubmitting},get isAriaDisabled(){return b.isSubmitting},get isSuccessMessageAriaHidden(){return(0,s.getContext)().submissionSuccess?null:"true"},get errorMessage(){const e=(0,s.getContext)(),t=e.fieldId,r=e.fields[t]||{};if(e.isSingleInputForm&&e.submissionError)return e.submissionError;if(e.isForcedHorizontal&&e.submissionError){const n=r.error&&"yes"!==r.error;if(e.showErrors&&n)return m(r);return t===Object.keys(e.fields||{})[0]?e.submissionError:""}return(e.showErrors||r.showFieldError)&&r.error?m(r):""},get isFormValid(){if(b.isFormEmpty)return!1;const e=(0,s.getContext)();return e.isMultiStep?!Object.values(e.fields).some(t=>"yes"!==t.error&&t.step===e.currentStep):!Object.values(e.fields).some(e=>"yes"!==e.error)},get showFormErrors(){const e=(0,s.getContext)();return!b.isFormValid&&e.showErrors&&!(e.isSingleInputForm||e.isForcedHorizontal)},get showSubmissionError(){const e=(0,s.getContext)();return!(e.isForcedHorizontal||e.isSingleInputForm||!e.submissionError||b.showFormErrors)},get getFormErrorMessage(){if(b.isFormEmpty){if((0,s.getContext)().isMultiStep)return d.error_types.invalid_form_empty}return d.error_types.invalid_form},get getErrorList(){const e=[];if(b.isFormEmpty)return e;const t=(0,s.getContext)();return t.showErrors&&Object.values(t.fields).forEach(r=>{var n;t.isMultiStep&&r.step!==t.currentStep||r.error&&"yes"!==r.error&&e.push({anchor:"#"+r.id,label:(n=r.label,((new DOMParser).parseFromString(n,"text/html").body.textContent||"")+": "+m(r)),id:r.id})}),e},get getFieldValue(){const e=(0,s.getContext)(),t=e.fieldId,r=e.fields[t];return r?.value||""}},actions:{updateField:(e,t,r)=>{const n=(0,s.getContext)(),{fieldType:i}=n;((e,t,r=!1,n=null)=>{const i=(0,s.getContext)();let a=i.fields[e];if(!a){const{fieldType:t,fieldLabel:r,fieldValue:n,fieldIsRequired:s,fieldExtra:o}=i;p(e,t,r,n,s,o),a=i.fields[e]}if(a){const{type:e,isRequired:s,extra:i}=a;a.value=t,a.error=n?n(t,s,i):(0,o.jr)(e,t,s,i),a.showFieldError=r}})(e,t,r,r?b.validators?.[i]:null)},updateFieldValue:(e,t)=>{y.updateField(e,t)},handleNumberKeyPress:c(e=>{/^[0-9.]*$/.test(e.key)||e.preventDefault(),"."===e.key&&e.target.value.includes(".")&&e.preventDefault()}),onFieldChange:e=>{let t=e.target.value;const r=(0,s.getContext)(),n=r.fieldId,o=r.fields[n];if("checkbox"===r.fieldType&&(t=e.target.checked?"1":""),"radio"===r.fieldType&&o?.isOtherSelected){if(t!==(o.otherLabel||"Other")){o.isOtherSelected=!1,o.otherLabel=null;const t=e.target.closest("fieldset"),r=t?.querySelector('input[name$="-other-text"]');r&&(r.value="")}}y.updateField(n,t)},onOtherRadioChange:e=>{const t=(0,s.getContext)(),r=t.fieldId,n=t.fields[r];if(!e.target.checked)return;const o=e.target.getAttribute("data-other-label")||e.target.value||"Other";n.isOtherSelected=!0,n.otherLabel=o;const i=e.target.closest("fieldset"),a=i?.querySelector('input[name$="-other-text"]'),l=a?.value||"";y.updateField(r,v(o,l)),a&&setTimeout(()=>a.focus(),100)},onOtherTextInput:e=>{const t=(0,s.getContext)(),r=t.fieldId,n=t.fields[r];if(!n?.isOtherSelected)return;const o=n.otherLabel||"Other";y.updateField(r,v(o,e.target.value))},onMultipleFieldChange:e=>{const t=(0,s.getContext)(),r=t.fieldId,n=t.fields[r],o=e.target.value;let i=[...n.value||[]];e.target.checked?i.push(o):i=i.filter(e=>e!==o),y.updateField(r,i)},onKeyDownImageOption:e=>{if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),y.onImageOptionClick(e)),/^[a-z]$/i.test(e.key)){const t=e.target.closest(".jetpack-fieldset-image-options__wrapper"),r=document.evaluate(`.//div[contains(@class, "jetpack-input-image-option__label-code") and contains(text(), "${e.key.toUpperCase()}")]`,t,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;if(r){const e=r.closest(".jetpack-input-image-option"),t=e.querySelector(".jetpack-input-image-option__input");w(t,e)}}},onImageOptionClick:e=>{let t=e.target;for(;t&&!t.classList.contains("jetpack-input-image-option");)t=t.parentElement;if(t){const e=t.querySelector(".jetpack-input-image-option__input");w(e,t)}},onFieldBlur:e=>{const t=(0,s.getContext)();y.updateField(t.fieldId,e.target.value,!0)},onFormReset:()=>{const e=(0,s.getContext)();e.fields=[],e.showErrors=!1;const t=document.getElementById(e.elementId);if(t){t.querySelectorAll("[data-wp-on--jetpack-form-reset]").forEach(e=>{e.dispatchEvent(new CustomEvent("jetpack-form-reset",{bubbles:!1}))})}e.isMultiStep&&(e.currentStep=1)},onFormSubmit:c(function*(e){const t=(0,s.getContext)();if(!b.isFormValid)return t.showErrors=!0,e.preventDefault(),void e.stopPropagation();if(t.isMultiStep&&t.currentStep{(0,l.Kz)(r)},100)}if(t.isSubmitting=!0,t.useAjax){e.preventDefault(),e.stopPropagation(),t.submissionError=null,g=(e=>{const t=new Map,r=document.getElementById("jp-form-"+e);return r?(r.querySelectorAll(".jetpack-form-file-field__preview").forEach(e=>{const r=e.querySelector(".jetpack-form-file-field__file-name"),n=e.querySelector(".jetpack-form-file-field__image");if(r&&n){const e=r.textContent?.trim(),s=window.getComputedStyle(n),o=s.backgroundImage,i=s.maskImage||s.webkitMaskImage;e&&t.set(e,{previewUrl:o&&"none"!==o?o:null,iconUrl:i&&"none"!==i?i:null})}}),t):t})(t.formHash);const{success:r,error:n,data:s,refreshArgs:o}=yield(0,l.rM)(t.formHash);if(r){if(C(s),t.submissionSuccess=!0,o){const e=new URL(window.location.href);e.searchParams.set("contact-form-id",o["contact-form-id"]),e.searchParams.set("contact-form-sent",o["contact-form-sent"]),e.searchParams.set("contact-form-hash",o["contact-form-hash"]),e.searchParams.set("_wpnonce",o._wpnonce),window.history.replaceState(null,"",e.toString())}}else t.submissionError=n,f&&clearTimeout(f),f=setTimeout(()=>{t.submissionError=null},5e3),C([]);t.isSubmitting=!1,g.clear()}}),scrollIntoView:c(e=>{const t=(0,s.getContext)(),r=document.querySelector(t.item.anchor);if(r)return r.focus({preventScroll:!0}),r.scrollIntoView({behavior:"smooth"}),void e.preventDefault();const n=t.item.anchor.substring(1),o=document.querySelector('[name="'+n+'"]');if(o)return o.focus({preventScroll:!0}),o.scrollIntoView({behavior:"smooth"}),void e.preventDefault();const i=document.getElementById(n+"-label");i&&(i.querySelector("input").focus({preventScroll:!0}),i.scrollIntoView({behavior:"smooth"}),e.preventDefault())}),goBack:e=>{e.preventDefault(),e.stopPropagation();const t=(0,s.getContext)(),r=document.getElementById(t.elementId);r?.reset?.(),C([]),t.submissionError=null,t.hasClickedBack=!0,t.submissionSuccess=!1;const n=new URL(window.location.href);n.searchParams.delete("contact-form-id"),n.searchParams.delete("contact-form-sent"),n.searchParams.delete("contact-form-hash"),n.searchParams.delete("_wpnonce"),window.history.replaceState(null,"",n.toString())}},callbacks:{initializeField(){const e=(0,s.getContext)(),{fieldId:t,fieldType:r,fieldLabel:n,fieldValue:o,fieldIsRequired:i,fieldExtra:a}=e;p(t,r,n,o,i,a)},scrollToWrapper(){const e=(0,s.getContext)();if(e.submissionSuccess||e.hasClickedBack){const t=document.getElementById(`contact-form-${e.formId}`);if(t?.scrollIntoView({behavior:"smooth"}),e.submissionSuccess&&!e.hasClickedBack){const t=document.getElementById(`contact-form-success-${e.formHash}`);t?.focus()}e.hasClickedBack=!1}},focusOnValidationError(){const e=(0,s.getContext)();if(b.showFormErrors){if(e.didFocusValidationError)return;const{ref:t}=(0,s.getElement)();t&&(t.focus(),e.didFocusValidationError=!0)}else e.didFocusValidationError&&(e.didFocusValidationError=!1)},focusOnSubmissionError(){const e=(0,s.getContext)();if(b.showSubmissionError){if(e.didFocusSubmissionError)return;const{ref:t}=(0,s.getElement)();t&&(t.focus(),e.didFocusSubmissionError=!0)}else e.didFocusSubmissionError&&(e.didFocusSubmissionError=!1)},setImageOptionCheckColor(){const{ref:e}=(0,s.getElement)();if(!e)return;const t=window.getComputedStyle(e).color,r=window.jetpackForms.getInverseReadableColor(t),n=e.getAttribute("style")??"";e.setAttribute("style",n+`--jetpack-input-image-option--check-color: ${r}`)},setImageOptionOutlineColor(){const{ref:e}=(0,s.getElement)();if(!e)return;const{borderColor:t}=window.getComputedStyle(e),r=e.getAttribute("style")??"";e.setAttribute("style",r+`--jetpack-input-image-option--outline-color: ${t}`)},watchSubmissionValueVisibility(){const e=(0,s.getContext)();if(!e.submission)return;const{ref:t}=(0,s.getElement)(),r=!(!e.submission.url&&!e.submission.rating);t.hidden=r}}});