{"version":3,"file":"contact-form.js","sources":["../../../../src/assets/scripts/contact-form.entry.js"],"sourcesContent":["window.arjoContactFormModule =\n window.arjoContactFormModule ||\n (() => {\n const state = {\n isInitialized: false,\n elements: {},\n };\n\n const classNamePrefix = 'arjo-o-contact-form';\n\n const setUp = () => {\n const els = [...document.querySelectorAll(`.${classNamePrefix}`)];\n els.forEach((el) => {\n const countryDropdownId = el.dataset.countryDropdownId;\n const inquiryDropdownId = el.dataset.inquiryDropdownId;\n const referrerUrl = el.dataset.referrerUrl;\n const pageTitle = el.dataset.pageTitle;\n\n const countryDropdown = el.querySelector(`[data-dropdown-id=\"${countryDropdownId}\"]`);\n const inquiryDropdown = el.querySelector(`[data-dropdown-id=\"${inquiryDropdownId}\"]`);\n\n const iframe = el.querySelector('iframe');\n const iframeLoadHandler = () => {\n try {\n iframe.height = iframe.contentWindow.document.documentElement.scrollHeight;\n console.log('iframe loaded');\n } catch {\n console.log('cross-origin iframe => cannot measure iframe inner height => set height at 1200px');\n iframe.height = 1200;\n }\n };\n iframe.addEventListener('load', iframeLoadHandler);\n\n const filterChangeHandler = () => {\n var countryDropdownValue = countryDropdown.querySelector('input:checked')?.value;\n var inquiryDropdownValue = inquiryDropdown.querySelector('input:checked')?.value;\n if (!countryDropdownValue || !inquiryDropdownValue) {\n return;\n }\n\n const iframePlaceHolder = el.querySelector(`.${classNamePrefix}__iframe-placeholder`);\n const iframeContainer = el.querySelector(`.${classNamePrefix}__iframe-container`);\n iframePlaceHolder.style.display = 'none';\n\n let src =\n window.contactIFrames && window.contactIFrames[countryDropdownValue + '@' + inquiryDropdownValue]\n ? window.contactIFrames[countryDropdownValue + '@' + inquiryDropdownValue]\n : null;\n if (!src) {\n iframe.removeAttribute('src');\n iframePlaceHolder.style.removeProperty('display');\n iframeContainer.style.display = 'none';\n return;\n }\n\n if (referrerUrl) {\n src += '&Page_URL=' + encodeURIComponent(referrerUrl);\n }\n\n if (pageTitle) {\n src += '&Page_Title=' + encodeURIComponent(pageTitle);\n }\n\n iframePlaceHolder.style.display = 'none';\n iframeContainer.style.removeProperty('display');\n\n iframe.setAttribute('src', src);\n };\n\n countryDropdown.addEventListener('change', filterChangeHandler);\n inquiryDropdown.addEventListener('change', filterChangeHandler);\n\n filterChangeHandler();\n });\n };\n const init = () => {\n if (state.isInitialized) return;\n setUp();\n state.isInitialized = true;\n };\n\n return { init };\n })();\n\nwindow.addEventListener('load', window.arjoContactFormModule.init);\n"],"names":["state","classNamePrefix","setUp","el","countryDropdownId","inquiryDropdownId","referrerUrl","pageTitle","countryDropdown","inquiryDropdown","iframe","iframeLoadHandler","filterChangeHandler","_a","_b","countryDropdownValue","inquiryDropdownValue","iframePlaceHolder","iframeContainer","src"],"mappings":"AAAA,OAAO,sBACL,OAAO,wBACN,IAAM,CACL,MAAMA,EAAQ,CACZ,cAAe,GACf,SAAU,CAAE,CAClB,EAEUC,EAAkB,sBAElBC,EAAQ,IAAM,CACN,CAAC,GAAG,SAAS,iBAAiB,IAAID,CAAe,EAAE,CAAC,EAC5D,QAASE,GAAO,CAClB,MAAMC,EAAoBD,EAAG,QAAQ,kBAC/BE,EAAoBF,EAAG,QAAQ,kBAC/BG,EAAcH,EAAG,QAAQ,YACzBI,EAAYJ,EAAG,QAAQ,UAEvBK,EAAkBL,EAAG,cAAc,sBAAsBC,CAAiB,IAAI,EAC9EK,EAAkBN,EAAG,cAAc,sBAAsBE,CAAiB,IAAI,EAE9EK,EAASP,EAAG,cAAc,QAAQ,EAClCQ,EAAoB,IAAM,CAC9B,GAAI,CACFD,EAAO,OAASA,EAAO,cAAc,SAAS,gBAAgB,aAC9D,QAAQ,IAAI,eAAe,CACvC,MAAkB,CACN,QAAQ,IAAI,mFAAmF,EAC/FA,EAAO,OAAS,IACjB,CACX,EACQA,EAAO,iBAAiB,OAAQC,CAAiB,EAEjD,MAAMC,EAAsB,IAAM,CAjC1C,IAAAC,EAAAC,EAkCU,IAAIC,GAAuBF,EAAAL,EAAgB,cAAc,eAAe,IAA7C,Y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