1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[62900],{23371:(e,t,i)=>{i.d(t,{a:()=>l});var r=i(6029),a=i(55729),n=i(43072);let o=null,l=e=>{let{onVerify:t}=e,i=(0,a.useRef)(null),l=(0,a.useRef)(null),[u,s]=(0,n.Wx)({triggerOnce:!0,rootMargin:"200px 0px"}),p=(0,a.useCallback)(e=>{i.current=e,u(e)},[u]);return(0,a.useEffect)(()=>{if(!s)return;let e=!1;return(o||(o=new Promise((e,t)=>{if(window.grecaptcha?.render)return void e();if(window.onRecaptchaApiLoaded=()=>{e()},document.querySelector('script[src^="https://www.google.com/recaptcha/api.js"]'))return;let i=document.createElement("script");i.src="https://www.google.com/recaptcha/api.js?render=explicit&onload=onRecaptchaApiLoaded",i.async=!0,i.defer=!0,i.onerror=()=>t(Error("Failed to load reCAPTCHA script")),document.head.appendChild(i)}))).then(()=>{!e&&i.current&&window.grecaptcha&&(l.current=window.grecaptcha.render(i.current,{sitekey:"6LdhTBcsAAAAAB0T_hvslvcdHTHHkDBglYOGLdcA",callback:e=>{t(e)}}))}).catch(e=>{console.error("Failed to load reCAPTCHA script:",e)}),()=>{e=!0,window.grecaptcha&&null!=l.current&&window.grecaptcha.reset(l.current)}},[s,t]),(0,r.jsx)("div",{ref:p})}},57384:(e,t,i)=>{i.d(t,{A:()=>n});var r=i(1887),a=i.n(r);function n(e){return e?a()(e,"mm-dd-yyyy"):""}},64484:(e,t,i)=>{i.d(t,{Ay:()=>y});var r=i(55729),a=i(34330),n=i(21425),o=i(77079),l=i(32812),u=i(53643),s=i(69937),p=i(1106),d=i(57384),c=i(45158);let f=new Set,m=new Set;function h(e){switch(e.type){case"date":case"file":case"signature":return{input:e,inputType:e.type,value:void 0,showError:!1};case"time":case"text":case"email":case"phone":case"select":return{input:e,inputType:e.type,value:"",showError:!1};case"checkbox":return{input:e,inputType:e.type,value:[],showError:!1};case"static_text":case"payment":return{input:e,inputType:e.type,value:null,showError:!1};default:return{input:e,inputType:"text",value:"",showError:!1}}}function y(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,{config:{email:y},isPreview:w,isClaimed:g}=(0,r.useContext)(n.Q),{editorActive:v,setEditorActiveRoute:b,domain:T}=(0,r.useContext)(o.n),{orgInfo:E}=(0,r.useContext)(a._P),{inputs:A,successMessage:S,redirectUrl:I,recaptchaEnabled:q}=e,k=w||!g||v,C=(0,l.A)(),x=e.title,[_,F]=(0,r.useState)(null),{form:j,onChangeFormValue:N,onError:O,onSend:B,showPopUp:R,setShowPopUp:M,hasError:P,disabled:L,loading:H,requestError:W,hiddenFields:$}=function(e,t,i){let[a,n]=(0,r.useState)(()=>e.map(h)),o=(0,r.useMemo)(()=>(function(e,t,i){if(!t||0===t.length)return new Set;let r=new Set,a=new Map;e.forEach(e=>{a.set(e.input.id,e)});let n=new Map;return t.forEach(e=>{(e.targetFieldIds||e.targetFieldId?e.targetFieldIds||[e.targetFieldId].filter(Boolean):[]).forEach(t=>{if(!i.find(e=>e.id===t))return;let r=n.get(t)||new Set;r.add(e.action),n.set(t,r)})}),n.forEach((e,t)=>{e.has("show")&&!e.has("hide")&&r.add(t)}),t.forEach(e=>{let t=i.find(t=>t.id===e.sourceFieldId);if(!t)return;let n=e.targetFieldIds||e.targetFieldId?e.targetFieldIds||[e.targetFieldId].filter(Boolean):[];if(0===n.length)return;let o=n.filter(e=>!!i.find(t=>t.id===e));if(0===o.length)return;let l=a.get(e.sourceFieldId);if(!l)return;let s=!1,p=e.condition;if("checkbox"===p.fieldType){let e=l.value;if("hasSelection"===p.operator)s=e.length>0;else if("hasNoSelection"===p.operator)s=0===e.length;else if("hasOption"===p.operator&&p.optionId&&"checkbox"===t.type&&t.options){let i=t.options.find(e=>e.id===p.optionId);if(i){let t=(0,u.A)(i.label);s=e.includes(t)}}}else if("select"===p.fieldType){let e=l.value;if("equals"===p.operator&&void 0!==p.optionId){if("select"===t.type&&t.options){let i=t.options.find(e=>e.id===p.optionId);i&&(s=e===(0,u.A)(i.label))}}else"isNotEmpty"===p.operator?s=!!e&&e.length>0:"isEmpty"===p.operator&&(s=!e||0===e.length)}else if("text"===p.fieldType||"email"===p.fieldType||"phone"===p.fieldType){let e=l.value;"isEmpty"===p.operator?s=!e||0===e.length:"isNotEmpty"===p.operator?s=!!e&&e.length>0:"equals"===p.operator&&void 0!==p.value?s=e===p.value:"contains"===p.operator&&void 0!==p.value&&(s=e.includes(p.value))}else if("date"===p.fieldType||"time"===p.fieldType){let e=l.value;"isEmpty"===p.operator?s=!e||"string"==typeof e&&0===e.length:"isNotEmpty"===p.operator&&(s=!!e&&("string"!=typeof e||e.length>0))}else if("file"===p.fieldType||"signature"===p.fieldType){let e=l.value;"isEmpty"===p.operator?s=!e:"isNotEmpty"===p.operator&&(s=!!e)}s&&o.forEach(t=>{"hide"===e.action?r.add(t):"show"===e.action&&r.delete(t)})}),r})(a,i,e),[a,i,e]),l=JSON.stringify(e),s=(0,r.useCallback)(()=>{n(e.map(h))},[l]),[d,c]=(0,r.useState)(!1),[f,m]=(0,r.useState)(!1),[y,w]=(0,r.useState)(!1),[g,v]=(0,r.useState)(!1),b=(0,r.useMemo)(()=>a.some(e=>(function(e,t){if("static_text"===e.inputType||"payment"===e.inputType||t?.has(e.input.id))return!1;switch(e.inputType){case"email":if(e.input.required&&e.value)return!(0,p.Bj)(e.value);break;case"phone":if(e.input.required&&e.value)return!(0,p.V$)(e.value);break;case"time":if(e.input.required&&e.value)return!(0,p.EC)(e.value);break;case"checkbox":return e.input.required&&0===e.value.filter(Boolean).length}return e.input.required&&!e.value})(e,o)),[a,o]),T=(0,r.useCallback)(async()=>
1{if(n(e=>e.map(e=>({...e,showError:!0}))),b)return;v(!1),w(!0),c(!1),m(!0);let e=!0;try{await t(a)}catch{v(!0),e=!1}w(!1),m(!1),s(),e&&c(!0)},[b,a,s,t]);return(0,r.useEffect)(()=>{s()},[s]),{loading:f,form:a,onChangeFormValue:e=>t=>{n(i=>{let r=Array.from(i);return r[e]={...r[e],value:t,showError:!0,errorMsg:void 0},r})},onError:e=>t=>{n(i=>{let r=Array.from(i);return r[e]={...r[e],errorMsg:t,showError:!0},r})},hasError:b,showPopUp:d,setShowPopUp:c,onSend:()=>{T()},disabled:y,canSubmit:!y,requestError:g,hiddenFields:o}}(A,(0,r.useCallback)(async r=>{if(window.location.pathname.includes("/dashboard/forms")||k)return;let a=r.map(e=>{if("static_text"===e.inputType){let t=e.input;return{inputType:e.inputType,id:t.id,label:(0,u.A)(t.label||""),title:t.title?(0,u.A)(t.title):void 0,body:t.body?(0,u.A)(t.body):void 0}}switch(e.inputType){case"payment":return{inputType:e.inputType,id:e.input.id,label:(0,u.A)(e.input.label||""),value:""};case"checkbox":return{inputType:e.inputType,id:e.input.id,label:(0,u.A)(e.input.label||""),value:e.value.join(", ")};case"select":return{inputType:e.inputType,id:e.input.id,label:(0,u.A)(e.input.label||""),value:(0,u.A)(e.value)};case"date":return{inputType:e.inputType,id:e.input.id,label:(0,u.A)(e.input.label||""),value:(0,d.A)(e.value)};case"file":case"signature":return{inputType:e.inputType,id:e.input.id,label:(0,u.A)(e.input.label||""),filename:e.value?.name};default:return{inputType:e.inputType,id:e.input.id,label:(0,u.A)(e.input.label||""),value:e.value}}});if(e.quoteTemplateId){let t=e=>a.find(t=>String(t.id).includes(e))?.value;if((await fetch(`${globalThis.apiRoot}/commerce-api/public/quotes/from-form`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({orgId:E.id,quoteTemplateId:e.quoteTemplateId,name:t("quote-request-name")||void 0,email:t("quote-request-email")||void 0,phone:t("quote-request-phone")||void 0,message:t("quote-request-message")||void 0})})).status>=400)throw Error("Error submitting quote request");C("form_submit",{form_id:e.quoteTemplateId,form_name:x,success:!0});return}let n=r.filter(e=>"file"===e.inputType).map(e=>({file:e.value,fieldId:e.input.id})).filter(e=>null!=e.file),o=r.filter(e=>"signature"===e.inputType).map(e=>({file:e.value,fieldId:e.input.id})).filter(e=>null!=e.file),l=new FormData;n.forEach(e=>{l.append("attachments",e.file)}),o.forEach(e=>{l.append("images",e.file)});let p=e.inputs.filter(e=>"email"===e.type&&e.shouldCc).map(e=>a.find(t=>t.id===e.id)?.value).filter(Boolean),f=(0,s.GZ)(e.emails,y),m={title:(0,u.A)(e.title),fields:a,sentAt:new Date().toString(),domain:v?"your website editor":window.location.origin,currentYear:String(new Date().getFullYear()),to:f.join(","),emailsToCc:p,orgId:E.id,orgName:E.name,attachmentFieldMap:Object.fromEntries(n.map(e=>[e.file.name,e.fieldId])),imageFieldMap:Object.fromEntries(o.map(e=>[e.file.name,e.fieldId]))};t&&(m.formId=t),i&&(m["g-recaptcha-response"]=i);let h=(0,c.AI)();h&&(m.gclid=h),l.append("data",JSON.stringify(m));let w=await fetch(`${globalThis.apiRoot}/home-api/customer_form`,{method:"POST",body:l});if(w.status>=400)throw Error("Error submitting customer form");if(200===w.status)try{let e=await w.json();e&&e.payment&&F(e.payment)}catch{}C("form_submit",{form_id:t,form_name:x,success:!0})},[E.id,E.name,y,i,t,x,v,k,e,C]),e.conditionals),D=(0,r.useCallback)(e=>{let i=N(e);return e=>{t&&!v&&!k&&!f.has(t)&&(f.add(t),fetch(`${globalThis.apiRoot}/instance-api/forms/${t}/start-count`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"}}).catch(()=>{}));let r=t??x;k||m.has(r)||(m.add(r),C("form_start",{form_id:t,form_name:x})),i(e)}},[N,t,x,v,k,C]),J=R&&(!I||k),V=k?"Form Submitted":S||void 0,Y=k?"Nice work! Once your site is launched on our system customer enquiries will go straight to your inbox.":void 0;return(0,r.useEffect)(()=>{if(R&&I&&!W&&!k){if(!v){let e=setTimeout(()=>{window.location.href=I},2e3);return()=>clearTimeout(e)}if(M(!1),function(e,t){if(window.location.hostname.endsWith("app.bizwise.com")&&window.location.pathname.startsWith("/forms/"))return!1;if(e.startsWith("/"))return!0;try{let i=new URL(e).hostname.replace(/^www\./,""),r=t.replace(/^www\./,"");return i===r}catch{return!1}}(I,T)){let e=I;if(!I.startsWith("/"))try{let t=new URL(I);e=t.pathname+t.search+t.hash}catch{}b({route:e})}else window.open(I,"_blank")}},[R,I,W,v,b,M,T,k]),{paymentBundle:_,clearPaymentBundle:()=>F(null),loading:H,disabled:L,canSubmit:!L&&(k||!(q&&!i)),hasError:P,onError:O,form:j,onChangeFormValue:D,onSend:B,requestError:W,showPopUp:R,setShowPopUp:M,showSuccessPopUp:J,successMessage:S,displaySuccessTitle:V,displaySuccessBody:Y,isDemoFormSubmitMode:k,recaptchaEnabled:q??!1,hiddenFields:$}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.