text: var MainUserConsentEditManager=function(e){this.init=function(e){this.mess=e.mess;var t=BX("USER_CONSENT_CONTAINER");this.container=t;this.typeNode=t.querySelector("[data-bx-type-input]");this.langNode=t.querySelector("[data-bx-lang-input]");this.typeSelectorNode=t.querySelector("[data-bx-type-selector]");this.typeViewNode=t.querySelector("[data-bx-type-view]");this.dataProviderNode=t.querySelector("[data-bx-data-provider]");this.dataProviderInputNode=t.querySelector("[data-bx-data-provider-input]");this.dataProviderUrlNode=t.querySelector("[data-bx-data-provider-url]");this.fieldListNodes=t.querySelectorAll("[data-bx-fields]");this.fieldListNodes=BX.convert.nodeListToArray(this.fieldListNodes);BX.bind(this.typeViewNode,"click",this.showAgreementText.bind(this));BX.bind(this.typeSelectorNode,"change",this.onTypeChange.bind(this));BX.fireEvent(this.typeSelectorNode,"change");BX.bind(this.dataProviderInputNode,"change",this.onDataProviderChange.bind(this));BX.fireEvent(this.dataProviderInputNode,"change");this.getFields(this.container).forEach(function(e){if(!e.togglerNode||!e.toggledNode||!e.inputNode){return}BX.bind(e.togglerNode,"click",function(){e.toggledNode.style.display=e.togglerNode.checked?"":"none";e.inputNode.disabled=!e.togglerNode.checked})});if(top!=window&&top.BX){BX.bind(BX("MAIN_USER_CONSENT_EDIT_BACK_TO_LIST"),"click",function(e){if(!top||!top.BX){return}top.BX.onCustomEvent(top,"main-user-consent-to-list",[]);e.preventDefault()})}};this.onDataProviderChange=function(){var e=this.dataProviderInputNode.options[this.dataProviderInputNode.selectedIndex];var t=e.getAttribute("data-bx-data");var i=e.getAttribute("data-bx-edit-url");if(t){try{t=JSON.parse(t)}catch(o){t=null}}var a={name:e.innerText};this.dataProviderUrlNode.style.display=i?"":"none";this.dataProviderUrlNode.href=i;this.showFieldsDataProvider(t,a)};this.onTypeChange=function(){var e=this.typeSelectorNode.options[this.typeSelectorNode.selectedIndex];var t=e.getAttribute("data-bx-type");var i=e.getAttribute("data-bx-lang");var o=e.getAttribute("data-bx-supp-provider")=="Y";var a=e.getAttribute("data-bx-agreement-text");this.typeViewNode.style.display=a?"":"none";this.typeViewNode.setAttribute("data-bx-text",a);this.typeNode.value=t;this.langNode.value=i;this.dataProviderNode.style.display=o?"":"none";this.fieldListNodes.forEach(function(e){var o=e.getAttribute("data-bx-type");var a=e.getAttribute("data-bx-lang");var r=t==o&&i==a;e.style.display=r?"":"none"})};this.showAgreementText=function(){var e=this.typeViewNode.getAttribute("data-bx-text");if(!e){return}var t=document.createElement("TEXTAREA");BX.addClass(t,"main-user-consent-edit-popup-textarea");t.disabled=true;this.agreementViewPopupContentNode=t;if(!this.agreementViewPopup){this.agreementViewPopup=BX.PopupWindowManager.create("main-user-consent-edit-view-agreement",null,{titleBar:this.mess.viewTitle,content:this.agreementViewPopupContentNode,autoHide:true,lightShadow:true,closeByEsc:true,overlay:{backgroundColor:"black",opacity:500},buttons:[new BX.PopupWindowButton({text:this.mess.close,events:{click:function(){this.popupWindow.close()}}})]})}this.agreementViewPopupContentNode.textContent=e;this.agreementViewPopup.show()};this.showFieldsDataProvider=function(e,t){var i="data-bx-is-data-prov-hide";var o=function(e,t){t.node.setAttribute(i,e?"N":"Y");t.view.node.style.display=!e?"":"none";t.toggledNode.style.display=e?"":"none";t.inputNode.disabled=!e};var a=this.getFields(this.container);a.filter(function(e){return e.node.getAttribute(i)=="Y"}).forEach(o.bind(this,true));if(!e){return}e.forEach(function(e){a.filter(function(t){return e.CODE==t.code}).forEach(function(i){i.view.nameNode.textContent=t.name.trim()+":";i.view.valueNode.textContent=e.VALUE;o(false,i)})})};this.getFields=function(e){return this.getFieldNodes(e).map(function(e){return{code:e.getAttribute("data-bx-field"),node:e,inputNode:e.querySelector("[data-bx-input]"),view:{node:e.querySelector("[data-bx-view]"),nameNode:e.querySelector("[data-bx-view-name]"),valueNode:e.querySelector("[data-bx-view-value]")},togglerNode:e.querySelector("[data-bx-toggler]"),toggledNode:e.querySelector("[data-bx-toggled]")}})};this.getFieldNodes=function(e){var t=e.querySelectorAll("[data-bx-field]");return BX.convert.nodeListToArray(t)};this.init(e)};
  //# sourceMappingURL=script.map.js