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AaE,GAExDrI,SAASxD,IACxBgB,KAAKC,YAAYqH,GAAwB8B,YAAYpK,EAAQ,G,CAGhE,CAEQ,yBAAA2K,GACP,MAAMoB,EAAkB/K,KAAKC,YAAYoH,GAAuBkD,UAAU,EAAC,IAC3EQ,EAAgBhJ,UAAY/B,KAAKqD,MAAM0E,mBAAmBE,KAAKC,KAE/DlI,KAAKsI,SAAS,CAAEH,gBAAiB,OACjCnI,KAAK0I,8BAA8B1I,KAAKC,YAAYqH,IAEpDtH,KAAKC,YAAYmH,GAAoBiD,IAAMrK,KAAKqD,MAAM0E,mBAAmBC,MACzEhI,KAAKC,YAAYqH,GAAwB8B,YAAY2B,EACtD,EApJwB,EAAApD,cAA+B,CACtDC,iBAAkBV,EAClB8D,gBAAiB7D,EACjB8D,iBAAkB7D,EAClB8D,oBAAqB7D,EACrB8D,aAAc7D,E","sources":["webpack://@dgtls-pub/wolf-sb-integration/./src/global/js/DomServices.ts","webpack://@dgtls-pub/wolf-sb-integration/./src/global/js/InputsServices.ts","webpack://@dgtls-pub/wolf-sb-integration/./src/global/js/ControllerBase.ts","webpack://@dgtls-pub/wolf-sb-integration/./src/wolf/components/molecules/m-hero-contact-selector/m-hero-contact-selector.controller.ts"],"sourcesContent":["import { IDomServices } from 'global/interfaces/controller.interface';\nimport { Subject } from 'rxjs';\n\nexport class DomServices implements IDomServices {\n\tprotected $element: HTMLElement;\n\tprotected $references: Record;\n\tonDomElementChanged: Subject = new Subject();\n\n\tconstructor(element: HTMLElement, references: Record) {\n\t\tthis.$references = references;\n\t\tthis.$element = element;\n\t}\n\n\tstatic collectReferences(\n\t\telement: HTMLElement,\n\t\tignoredReferences: string[],\n\t\tincludedReferences: string[],\n\t): Partial> {\n\t\tconst refs: Partial> = {};\n\n\t\tArray.from(element.querySelectorAll('[data-ref]')).forEach((el: HTMLElement) => {\n\t\t\tlet referenceName: string = '';\n\t\t\tif (el.dataset.ref) {\n\t\t\t\treferenceName = el.dataset.ref;\n\t\t\t}\n\n\t\t\t// skip ignored references\n\t\t\tif (ignoredReferences.includes(referenceName)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (referenceName) {\n\t\t\t\t// if the included list has items, only include these references, otherwise consider all\n\t\t\t\tif (includedReferences.length > 0) {\n\t\t\t\t\tif (includedReferences.includes(referenceName)) {\n\t\t\t\t\t\trefs[referenceName] = el;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (Object.prototype.hasOwnProperty.call(refs, referenceName)) {\n\t\t\t\t\t\tif (window.location.hostname === 'localhost') {\n\t\t\t\t\t\t\tconsole.warn(`A reference called '${referenceName}' has already been registered in ${this.constructor.name}!\\n Element:`, element);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\trefs[referenceName] = el;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn refs;\n\t}\n\n\tgetRef(ref: string): T | undefined {\n\t\tif (this.$references) {\n\t\t\treturn Object.prototype.hasOwnProperty.call(this.$references, ref) ? (this.$references[ref] as T) : undefined;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tparseStringToHtml = (htmlAsString: string): void | ChildNode => {\n\t\tconst parsedNode = new DOMParser().parseFromString(htmlAsString, 'text/html').body.firstChild;\n\t\tif (parsedNode) return parsedNode;\n\t};\n\n\trenderDomElement = (ref: string, html: string, renderOnParent: boolean = false): void => {\n\t\tconst refExists = this.$references ? Object.prototype.hasOwnProperty.call(this.$references, ref) : undefined;\n\t\tif (renderOnParent) {\n\t\t\tthis.$element.innerHTML = html;\n\t\t\tthis.domElementChanged(ref);\n\t\t} else if (this.$references && refExists) {\n\t\t\t(this.$references as any)[ref].innerHTML = html;\n\t\t\tthis.domElementChanged(ref);\n\t\t} else {\n\t\t\tconsole.warn('DOM ref does not exist!', ref);\n\t\t}\n\t};\n\n\tappendRawHtmlToDomElement = (\n\t\tnode: HTMLElement,\n\t\thtmlAsString: string,\n\t\tposition: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend' = 'afterend',\n\t): void | ChildNode => {\n\t\tconst htmlNode = this.parseStringToHtml(htmlAsString);\n\t\tnode.insertAdjacentElement(position, htmlNode as Element);\n\t\tif (htmlNode) {\n\t\t\treturn htmlNode;\n\t\t}\n\t};\n\n\treplaceLastChildElementWithRawHtml = (ref: string, htmlAsString: string): void | ChildNode => {\n\t\tconst refExists = this.$references ? Object.prototype.hasOwnProperty.call(this.$references, ref) : undefined;\n\t\tif (refExists) {\n\t\t\tconst htmlNode = this.parseStringToHtml(htmlAsString);\n\t\t\tconst lastNode = this.$references[ref].childNodes[this.$references[ref].childNodes.length - 1];\n\t\t\t(this.$references as any)[ref].replaceChild(htmlNode, lastNode);\n\t\t\tthis.domElementChanged(ref);\n\t\t\tif (htmlNode) {\n\t\t\t\treturn htmlNode;\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.warn('DOM ref does not exist!', ref);\n\t\t}\n\t};\n\n\ttoggleElementState(control: HTMLElement, newState: Array<'enable' | 'disable' | 'show' | 'hide' | 'check' | 'uncheck'>): void {\n\t\tif (!control) return;\n\t\tnewState &&\n\t\t\tnewState.forEach((state) => {\n\t\t\t\tswitch (state) {\n\t\t\t\t\tcase 'enable': {\n\t\t\t\t\t\tcontrol.removeAttribute('disabled');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'disable': {\n\t\t\t\t\t\tcontrol.setAttribute('disabled', 'true');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'show': {\n\t\t\t\t\t\tcontrol.removeAttribute('hidden');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'hide': {\n\t\t\t\t\t\tcontrol.setAttribute('hidden', 'true');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'uncheck': {\n\t\t\t\t\t\tcontrol.removeAttribute('checked');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'check': {\n\t\t\t\t\t\tcontrol.setAttribute('checked', 'true');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t});\n\t}\n\n\tdomElementChanged = (reference: string): void => {\n\t\tthis.onDomElementChanged.next(reference);\n\t};\n\n\tparseDOMScriptTag = (elementId: string): TJSON => {\n\t\tconst data = document.getElementById(elementId) as HTMLScriptElement;\n\t\ttry {\n\t\t\tconst out = JSON.parse(data.innerText);\n\t\t\treturn out as TJSON;\n\t\t} catch (error) {\n\t\t\tconsole.warn('Cannot parse component form config', error);\n\t\t}\n\t\treturn {} as TJSON;\n\t};\n\n\trenderDomElementInHTMLElement(element: HTMLElement, html: string): void {\n\t\telement.innerHTML = html;\n\t}\n}\n","import { IInputServicesBase } from 'global/interfaces/controller.interface';\nimport { fromEvent, Subscription } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nexport enum InputClasses {\n\terrorClass = 'uk-form-danger',\n\thiddenClass = 'uk-hidden',\n}\nexport class InputServices implements IInputServicesBase {\n\tprivate observedInputs: Record = {};\n\n\taddFocusToInput({ element, inputName }: { element: HTMLElement; inputName: string }): void {\n\t\tconst input = element?.querySelector(`input[name='${inputName}']`);\n\t\tif (input) (input as HTMLInputElement).focus();\n\t}\n\n\tobserveElementEvents(\n\t\telement: HTMLInputElement | HTMLSelectElement | HTMLButtonElement,\n\t\tinputEvent: 'input' | 'change' | 'click',\n\t\tonChange: (value: string, event: InputEvent) => any,\n\t): void {\n\t\tconst inputToObserve$ = fromEvent(element, inputEvent);\n\n\t\tthis.observedInputs[element.name] = inputToObserve$.pipe(map(this.mapInputEvent)).subscribe(({ value, event }) =>\n\t\t\tthis.subscribeInputWithErrorRemovalOnInputChange({\n\t\t\t\tvalue,\n\t\t\t\tevent,\n\t\t\t\tonChange,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/**\n\t * This method is in charge of adding error classes to the correct element within an input group on a defined element\n\t * @param {HTMLElement | null} element - The element to update\n\t * @param {Record} errors - The errors to manage\n\t */\n\taddErrorsToFieldset({\n\t\telement,\n\t\terrors,\n\t\tonErrorsUpdated,\n\t}: {\n\t\telement: HTMLElement | null;\n\t\terrors: Record;\n\t\tonErrorsUpdated?: () => void;\n\t}): void {\n\t\tif (element) {\n\t\t\tObject.keys(errors).forEach((inputName) => {\n\t\t\t\tconst input = element?.querySelector(`input[name='${inputName}']`) as HTMLElement;\n\n\t\t\t\tif (input) {\n\t\t\t\t\tconst errorMessage = errors[inputName] || '';\n\t\t\t\t\tthis.addOrRemoveFormValidationError('SHOW_VALIDATION_ERROR', input, errorMessage);\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (onErrorsUpdated) onErrorsUpdated();\n\t\t\tif (errors) {\n\t\t\t\tconst inputNameToFocus = Object.keys(errors)[0];\n\t\t\t\tconst firstErrorElement = element?.querySelector(`input[name='${inputNameToFocus}']`);\n\t\t\t\tif (firstErrorElement) firstErrorElement.scrollIntoView();\n\t\t\t\tif (inputNameToFocus) this.addFocusToInput({ element, inputName: inputNameToFocus });\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error(`ADD ERRORS TO FIELDSET: Looks like the element you want to update doesn't exist`);\n\t\t}\n\t}\n\n\taddOrRemoveFormValidationError(showOrHide: 'SHOW_VALIDATION_ERROR' | 'HIDE_VALIDATION_ERROR', input: HTMLElement, errorMessage: string = ''): void {\n\t\tif (!input) return;\n\n\t\tconst label = input.previousElementSibling;\n\t\tconst errorMessageContainer = input.nextElementSibling;\n\n\t\tif (showOrHide === 'SHOW_VALIDATION_ERROR') {\n\t\t\t// add error class to label\n\t\t\tif (label && label.classList) label.classList.add(InputClasses.errorClass);\n\t\t\t// add error class to input\n\t\t\tinput.classList.add(InputClasses.errorClass);\n\t\t\t// if there's an error message, inject it, show the div and add an error class\n\t\t\tif (errorMessageContainer) {\n\t\t\t\terrorMessageContainer.classList.add(InputClasses.errorClass);\n\t\t\t\terrorMessageContainer.classList.remove(InputClasses.hiddenClass);\n\t\t\t\terrorMessageContainer.innerHTML = errorMessage;\n\t\t\t}\n\t\t} else if (showOrHide === 'HIDE_VALIDATION_ERROR') {\n\t\t\t// remove error class from label\n\t\t\tif (label && label.classList) label.classList.remove(InputClasses.errorClass);\n\t\t\t// remove error class from input\n\t\t\tinput.classList.remove(InputClasses.errorClass);\n\t\t\t// remove error message and class\n\t\t\tif (errorMessageContainer) {\n\t\t\t\terrorMessageContainer.classList.remove(InputClasses.errorClass);\n\t\t\t\terrorMessageContainer.classList.add(InputClasses.hiddenClass);\n\t\t\t\terrorMessageContainer.innerHTML = '';\n\t\t\t}\n\t\t}\n\t}\n\n\tsubscribeInputWithErrorRemovalOnInputChange = ({\n\t\tvalue,\n\t\tevent,\n\t\tonChange,\n\t}: {\n\t\tvalue: string;\n\t\tevent: InputEvent;\n\t\tonChange?: (value: string, event: InputEvent) => void;\n\t}): void => {\n\t\tconst castEvent = event.target as HTMLElement;\n\n\t\tconst label = castEvent && castEvent.previousElementSibling;\n\t\tif (label && label.classList.contains(InputClasses.errorClass)) label.classList.remove(InputClasses.errorClass);\n\n\t\tconst input = event.target as HTMLElement;\n\t\tif (input && input.classList.contains(InputClasses.errorClass)) input.classList.remove(InputClasses.errorClass);\n\n\t\tconst errorMessage = castEvent && castEvent.nextElementSibling;\n\t\tif (errorMessage) {\n\t\t\terrorMessage.classList.remove(InputClasses.errorClass);\n\t\t\terrorMessage.classList.add('uk-hidden');\n\t\t}\n\n\t\tif (onChange) onChange(value, event);\n\t};\n\n\tmapInputEvent = (event: InputEvent): { value: string; event: InputEvent } => {\n\t\treturn { value: (event.target as HTMLInputElement | HTMLSelectElement).value, event };\n\t};\n}\n","import { IControllerBase, IDomServices } from 'global/interfaces/controller.interface';\nimport { DomServices } from './DomServices';\nimport { InputServices } from './InputsServices';\nexport default class ControllerBase = Record> implements IControllerBase {\n\treadonly $element: HTMLElement;\n\treadonly $references: Record;\n\treadonly ignoredReferences: string[];\n\treadonly includedReferences: string[];\n\treadonly disableReferenceCollection: boolean;\n\t/** See {@link DomServices} */\n\treadonly domUtils: IDomServices;\n\t/** See {@link InputServices} */\n\treadonly inputUtils: InputServices;\n\n\tconstructor(element: HTMLElement, ignoredReferences?: string[], includedReferences?: string[], disableReferenceCollection?: boolean) {\n\t\tthis.$element = element;\n\t\tthis.ignoredReferences = ignoredReferences || [];\n\t\tthis.includedReferences = includedReferences || [];\n\t\tthis.disableReferenceCollection = disableReferenceCollection || false;\n\n\t\tif (!this.disableReferenceCollection) {\n\t\t\tconst references = DomServices.collectReferences(this.$element, this.ignoredReferences, this.includedReferences);\n\t\t\tif (references && Object.keys(references).length > 0) {\n\t\t\t\tthis.$references = references as Record;\n\t\t\t} else {\n\t\t\t\tthis.$references = {} as Record;\n\t\t\t}\n\t\t}\n\n\t\tthis.domUtils = new DomServices(this.$element, this.$references);\n\t\tthis.inputUtils = new InputServices();\n\t}\n\n\tdispatchCustomEvent(\n\t\tname: string,\n\t\tdetail: T,\n\t\tbubbles: boolean = false,\n\t\tdispatchOnWindow: boolean = false,\n\t\tdispatchOnSpecificElement?: HTMLElement,\n\t): void {\n\t\tconst customEvent = new CustomEvent(name, { detail: detail, bubbles: bubbles });\n\t\tif (true === dispatchOnWindow) {\n\t\t\twindow.dispatchEvent(customEvent);\n\t\t} else if (dispatchOnSpecificElement) {\n\t\t\tdispatchOnSpecificElement.dispatchEvent(customEvent);\n\t\t} else {\n\t\t\tthis.$element.dispatchEvent(customEvent);\n\t\t}\n\t}\n}\n","import ControllerBase from '../../../../global/js/ControllerBase';\nimport { MHeroSelectorAppDataTypes, POCTypes, SelectorPair } from './m-hero.contact-selector.types';\n\nconst PREFIX = 'm-hero-contact-selector';\nconst M_HERO_SELECTOR_DATA_APP = PREFIX + '-app-data';\nconst CATEGORY_SELECTOR = PREFIX + '__category-selector';\nconst DEPARTMENT_SELECTOR = PREFIX + '__department-selector';\nconst POC_IMAGE_SELECTOR = PREFIX + '__poc-image';\nconst POC_MAINLINE_SELECTOR = PREFIX + '__poc-mainline';\nconst POC_CONTAINER_SELECTOR = PREFIX + '__poc-data-container';\nconst POC_DATA_ELEMENT_CLASS = PREFIX + '__poc-description';\n\ntype ComponentRefs = {\n\tcategorySelector: string;\n\tdynamicSelector: string;\n\tpocContainer: string;\n\tpocImageSelector: string;\n\tpocMainLineSelector: string;\n};\n\ntype ComponentState = MHeroSelectorAppDataTypes & { subcategorySelector: SelectorPair[]; personOfContact: POCTypes | null };\n\nexport default class ControllerHeroContactSelector extends ControllerBase {\n\tprivate state: ComponentState = {\n\t\tcategorySelector: [],\n\t\tsubcategorySelector: [],\n\t\tcontactPersons: [],\n\t\tcontactPlaceholder: {\n\t\t\timage: '',\n\t\t\tcopy: {\n\t\t\t\ttext: '',\n\t\t\t},\n\t\t},\n\t\tpersonOfContact: null,\n\t};\n\n\tprivate static readonly componentRefs: ComponentRefs = {\n\t\tcategorySelector: CATEGORY_SELECTOR,\n\t\tdynamicSelector: DEPARTMENT_SELECTOR,\n\t\tpocImageSelector: POC_IMAGE_SELECTOR,\n\t\tpocMainLineSelector: POC_MAINLINE_SELECTOR,\n\t\tpocContainer: POC_CONTAINER_SELECTOR,\n\t};\n\n\tconstructor(element: HTMLElement) {\n\t\tsuper(element, [], Object.values(ControllerHeroContactSelector.componentRefs));\n\t\tthis.initApp();\n\t}\n\n\tprivate initApp(): void {\n\t\tthis.setInitialState();\n\t}\n\n\tprivate setState(payload: Partial): void {\n\t\tthis.state = { ...this.state, ...payload };\n\t}\n\n\tprivate setInitialState = () => {\n\t\tconst data = document.getElementById(M_HERO_SELECTOR_DATA_APP) as HTMLScriptElement;\n\t\tconst initdata = JSON.parse(data.innerText) as MHeroSelectorAppDataTypes;\n\t\tthis.setState(initdata);\n\t\tthis.printOptionsOnSelect(initdata.categorySelector, this.$references[CATEGORY_SELECTOR]);\n\t};\n\n\tprivate cleanAllChildNodesFromElement(element: HTMLElement) {\n\t\twhile (element.firstChild && element.lastChild) {\n\t\t\telement.removeChild(element.lastChild);\n\t\t}\n\t}\n\n\tprivate printOptionsOnSelect(data: MHeroSelectorAppDataTypes['categorySelector'], ref: HTMLSelectElement) {\n\t\tconst isCategorySelector = ref.dataset.ref === CATEGORY_SELECTOR;\n\t\tconst isDepartmentSelector = ref.dataset.ref === DEPARTMENT_SELECTOR;\n\n\t\tdata.forEach(({ value, label, subcategoryOptions }) => {\n\t\t\tconst option = document.createElement('option');\n\n\t\t\tif (value) {\n\t\t\t\toption.value = value;\n\t\t\t} else {\n\t\t\t\toption.disabled = true;\n\t\t\t\toption.selected = true;\n\t\t\t}\n\n\t\t\toption.innerHTML = label;\n\n\t\t\tif (isCategorySelector) option['data-subcategoryOptions'] = subcategoryOptions;\n\n\t\t\tref.appendChild(option);\n\t\t});\n\n\t\tif (isCategorySelector) {\n\t\t\tref.addEventListener('change', this.listenCategorySelectorActivity.bind(this), false);\n\t\t\tthis.printOptionsOnSelect([ref.options[1]['data-subcategoryOptions'][0]], this.$references[DEPARTMENT_SELECTOR]);\n\t\t}\n\n\t\tif (isDepartmentSelector) ref.addEventListener('change', this.updatePOCBasedOnDepartment.bind(this), false);\n\n\t\tif (ref.options[0].value === ref.options[ref.options.selectedIndex].value) {\n\t\t\tref.classList.add('select-placeholder-option');\n\t\t}\n\t}\n\n\tprivate listenCategorySelectorActivity(event: Event) {\n\t\tconst target = event.target as HTMLSelectElement;\n\t\tthis.resetPersonOfContactOnDom();\n\n\t\tif (target) {\n\t\t\tconst departmentSelector = this.$references[DEPARTMENT_SELECTOR];\n\t\t\tconst currentOptionsSubCategory = target[target.options.selectedIndex]['data-subcategoryOptions'] as SelectorPair[];\n\n\t\t\tthis.cleanOptionsOnSelect(departmentSelector);\n\n\t\t\tthis.setState({ subcategorySelector: currentOptionsSubCategory });\n\n\t\t\tthis.printOptionsOnSelect(this.state.subcategorySelector, departmentSelector);\n\t\t\tdepartmentSelector.disabled = false;\n\n\t\t\ttarget.classList.remove('select-placeholder-option');\n\t\t}\n\t}\n\n\tprivate cleanOptionsOnSelect(select: HTMLSelectElement) {\n\t\tif (select) {\n\t\t\tconst selectOptions = select.options;\n\t\t\twhile (selectOptions.length > 0) {\n\t\t\t\tselect.remove(0);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate updatePOCBasedOnDepartment(event: Event) {\n\t\tconst target = event.target as HTMLSelectElement;\n\t\tif (target) {\n\t\t\tconst POCId = target.options[target.options.selectedIndex].value;\n\t\t\tconst personOfContact = this.state.contactPersons.find(({ id }) => id === POCId);\n\t\t\tthis.setState({ personOfContact });\n\t\t\tthis.updatePersonOfContactOnDom();\n\n\t\t\ttarget.classList.remove('select-placeholder-option');\n\t\t}\n\t}\n\n\tprivate updatePersonOfContactOnDom() {\n\t\tif (this.state.personOfContact) {\n\t\t\tthis.$references[POC_IMAGE_SELECTOR].src = this.state.personOfContact.image;\n\n\t\t\tthis.cleanAllChildNodesFromElement(this.$references[POC_CONTAINER_SELECTOR]);\n\n\t\t\tconst mainlineElement = this.$references[POC_MAINLINE_SELECTOR].cloneNode([false]);\n\t\t\tmainlineElement.innerText = `${this.state.personOfContact.firstname} ${this.state.personOfContact.lastname}`;\n\t\t\tmainlineElement.dataset.ref = POC_CONTAINER_SELECTOR;\n\n\t\t\tconst positionElement = document.createElement('span');\n\t\t\tpositionElement.innerText = this.state.personOfContact.position;\n\t\t\tpositionElement.classList.add('a-copy', POC_DATA_ELEMENT_CLASS, PREFIX + '__poc-position');\n\n\t\t\tconst phoneNumber = document.createElement('a');\n\t\t\tphoneNumber.href = `tel:${this.state.personOfContact.email}`;\n\t\t\tphoneNumber.innerText = this.state.personOfContact.phone;\n\t\t\tphoneNumber.classList.add('a-copy', POC_DATA_ELEMENT_CLASS, PREFIX + '__poc-phoneNumber');\n\n\t\t\tconst email = document.createElement('a');\n\t\t\temail.href = `mailto:${this.state.personOfContact.email}`;\n\t\t\temail.innerText = this.state.personOfContact.email;\n\t\t\temail.classList.add('a-copy', POC_DATA_ELEMENT_CLASS, PREFIX + '__poc-email');\n\n\t\t\tconst elementsToPrint = [mainlineElement, positionElement, phoneNumber, email];\n\n\t\t\telementsToPrint.forEach((element) => {\n\t\t\t\tthis.$references[POC_CONTAINER_SELECTOR].appendChild(element);\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate resetPersonOfContactOnDom() {\n\t\tconst mainLineElement = this.$references[POC_MAINLINE_SELECTOR].cloneNode([false]);\n\t\tmainLineElement.innerText = this.state.contactPlaceholder.copy.text;\n\n\t\tthis.setState({ personOfContact: null });\n\t\tthis.cleanAllChildNodesFromElement(this.$references[POC_CONTAINER_SELECTOR]);\n\n\t\tthis.$references[POC_IMAGE_SELECTOR].src = this.state.contactPlaceholder.image;\n\t\tthis.$references[POC_CONTAINER_SELECTOR].appendChild(mainLineElement);\n\t}\n}\n"],"names":["DomServices","constructor","element","references","onDomElementChanged","Subject","parseStringToHtml","htmlAsString","parsedNode","DOMParser","parseFromString","body","firstChild","renderDomElement","ref","html","renderOnParent","refExists","this","$references","Object","prototype","hasOwnProperty","call","undefined","$element","innerHTML","domElementChanged","console","warn","appendRawHtmlToDomElement","node","position","htmlNode","insertAdjacentElement","replaceLastChildElementWithRawHtml","lastNode","childNodes","length","replaceChild","reference","next","parseDOMScriptTag","elementId","data","document","getElementById","JSON","parse","innerText","error","collectReferences","ignoredReferences","includedReferences","refs","Array","from","querySelectorAll","forEach","el","referenceName","dataset","includes","window","location","hostname","name","getRef","toggleElementState","control","newState","state","removeAttribute","setAttribute","renderDomElementInHTMLElement","InputClasses","InputServices","observedInputs","subscribeInputWithErrorRemovalOnInputChange","value","event","onChange","castEvent","target","label","previousElementSibling","classList","contains","errorClass","remove","input","errorMessage","nextElementSibling","add","mapInputEvent","addFocusToInput","inputName","querySelector","focus","observeElementEvents","inputEvent","inputToObserve$","fromEvent","pipe","map","subscribe","addErrorsToFieldset","errors","onErrorsUpdated","Error","keys","addOrRemoveFormValidationError","inputNameToFocus","firstErrorElement","scrollIntoView","showOrHide","errorMessageContainer","hiddenClass","ControllerBase","disableReferenceCollection","domUtils","inputUtils","dispatchCustomEvent","detail","bubbles","dispatchOnWindow","dispatchOnSpecificElement","customEvent","CustomEvent","dispatchEvent","PREFIX","M_HERO_SELECTOR_DATA_APP","CATEGORY_SELECTOR","DEPARTMENT_SELECTOR","POC_IMAGE_SELECTOR","POC_MAINLINE_SELECTOR","POC_CONTAINER_SELECTOR","POC_DATA_ELEMENT_CLASS","ControllerHeroContactSelector","super","values","componentRefs","categorySelector","subcategorySelector","contactPersons","contactPlaceholder","image","copy","text","personOfContact","setInitialState","initdata","setState","printOptionsOnSelect","initApp","payload","cleanAllChildNodesFromElement","lastChild","removeChild","isCategorySelector","isDepartmentSelector","subcategoryOptions","option","createElement","disabled","selected","appendChild","addEventListener","listenCategorySelectorActivity","bind","options","updatePOCBasedOnDepartment","selectedIndex","resetPersonOfContactOnDom","departmentSelector","currentOptionsSubCategory","cleanOptionsOnSelect","select","selectOptions","POCId","find","id","updatePersonOfContactOnDom","src","mainlineElement","cloneNode","firstname","lastname","positionElement","phoneNumber","href","email","phone","mainLineElement","dynamicSelector","pocImageSelector","pocMainLineSelector","pocContainer"],"sourceRoot":""}