(()=>{"use strict";const e="email",t="phone",n="name",a={[e]:["email","e-mail","mail","email address"],[t]:["phone","tel","mobile","cell","telephone","phone number"],[n]:["name","full-name","full name","full_name","fullname","first-name","first name","first_name","firstname","last-name","last name","last_name","lastname","given-name","given name","given_name","givenname","family-name","family name","family_name","familyname","fname","lname","first","last","your-name","your name"]};function l(e){return e&&"string"==typeof e?e.trim().toLowerCase():""}function r(e){const t=l(e),n=t.lastIndexOf("@");if(-1===n)return t;const a=t.slice(n+1);return["gmail.com","googlemail.com"].includes(a)?`${t.slice(0,n).replace(/\./g,"")}@${a}`:t}function i(e){const t=l(e),n=t.replace(/\D/g,"");return t.startsWith("+")?`+${n}`:n}function s(e){const t=e.filter(e=>{let{type:t}=e;return t===n}).map(e=>{let{value:t}=e;return l(t)}).filter(Boolean);if(!t.length)return;const[a,...r]=1===t.length?t[0].split(" "):t;return{first_name:a,...r?.length>0?{last_name:r.join(" ")}:{}}}function u(t){return t.find(t=>{let{type:n}=t;return n===e})?.value}function o(e){return e.find(e=>{let{type:n}=e;return n===t})?.value}globalThis.document.addEventListener("om.Analytics.track",m=>{let{detail:c}=m;if("conversion"===c.Analytics.type){const m=globalThis._googlesitekit?.gtagUserData,f=m&&c.Campaign?.Form?function(m){if(!m||!m.inputs)return;const c=Array.isArray(m.inputs)?m.inputs:Object.values(m.inputs);return c.length?function(e){const t=[["address",s(e)],["email",u(e)],["phone_number",o(e)]].filter(e=>{let[,t]=e;return t});if(0!==t.length)return Object.fromEntries(t)}(c.map(s=>{if("hidden"===s.type)return null;const u=s.id?document.querySelector(`label[for='${s.id}']`)?.textContent:s.placeholder||"";return function(s){let{type:u,name:o,value:m,label:c}=s||{};switch(u=l(u),o=l(o),m=l(m),c=function(e){return e&&"string"==typeof e?e.trim().toLowerCase().replace(/\s*\*+\s*$/,"").replace(/\s*\(required\)\s*$/i,"").replace(/\s*:\s*$/,"").trim():""}(c),u){case"email":return{type:e,value:r(m)};case"tel":return{type:t,value:i(m)}}return function(e){if(!e)return!1;const t=r(e);return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}(m)||a[e].includes(o)||a[e].includes(c)?{type:e,value:r(m)}:a[t].includes(o)||a[t].includes(c)?{type:t,value:i(m)}:a[n].includes(o)||a[n].includes(c)?{type:n,value:l(m)}:function(e){if(!e)return!1;if(!function(e){const t=e.replace(/\D/g,"");return!(t.length<7||t.length<e.length/2)&&/^[\s\-()+.\d]*$/.test(e)}(e))return!1;const t=i(e);if(!/^\+?\d{7,}$/.test(t))return!1;const n=/[\s\-()+.]/.test(e),a=e.trim().startsWith("+");return!(!n&&!a)}(m)?{type:t,value:i(m)}:null}({type:s.type,name:s.name,value:s.value,label:u})}).filter(Boolean)):void 0}(c.Campaign.Form):null,p={campaignID:c.Campaign.id,campaignType:c.Campaign.type};f&&(p.user_data=f),globalThis._googlesitekit?.gtagEvent?.("submit_lead_form",p)}})})();