1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[40374],{374(t,e,s){s.r(e),s.d(e,{default:()=>a});var i=s(4335);class a extends i.A{static #t=this.options={hiddenCls:"d-none",showCls:"d-block",scopeAll:"all",targetDataAttribute:"data-form-field-toggle-target",valueDataAttribute:"data-form-field-toggle-value",wasRequiredCls:"js-field-toggle-was-required",wasDisabledCls:"js-field-toggle-was-disabled",scopeDataAttribute:"data-form-field-toggle-scope",parentSelectorDataAttribute:"data-form-field-toggle-parent-selector",triggerNestedDataAttribute:"data-form-field-toggle-trigger-nested"};init(){this._getTargets(),this._getControlValue(),this._registerEvents(),this._onChange(),this._triggerNested=this.el.getAttribute(this.options.triggerNestedDataAttribute)}_getTargets(){let t=this.el.getAttribute(this.options.targetDataAttribute);if((this.el.getAttribute(this.options.scopeDataAttribute)||this.options.scopeAll)===this.options.scopeAll){this._targets=document.querySelectorAll(t);return}let e=this.el.closest(this.el.getAttribute(this.options.parentSelectorDataAttribute));this._targets=e.querySelectorAll(t)}_getControlValue(){this._value=this.el.getAttribute(this.options.valueDataAttribute)}_registerEvents(){this.el.removeEventListener("change",this._onChange.bind(this)),this.el.addEventListener("change",this._onChange.bind(this))}_onChange(){let t=this._shouldShowTarget();this._targets.forEach(e=>{t?this._showTarget(e):this._hideTarget(e)}),this.$emitter.publish("onChange")}_shouldShowTarget(){let t=this.el.type;return"checkbox"!==t&&"radio"!==t?this.el.value===this._value:this._value?this.el.checked===("true"===this._value):this.el.checked}_hideTarget(t){this._getFields(t).forEach(t=>{t.hasAttribute("required")&&(t.classList.add(this.options.wasRequiredCls),t.removeAttribute("required")),t.setAttribute("disabled","disabled"),t.hasAttribute("disabled")&&t.classList.remove(this.options.wasDisabledCls)}),t.classList.remove(this.options.showCls),t.classList.add(this.options.hiddenCls)}_showTarget(t){let e=this._getFields(t);e.forEach(t=>{t.classList.contains(this.options.wasRequiredCls)&&(t.classList.remove(this.options.wasRequiredCls),t.setAttribute("required","required")),t.hasAttribute("disabled")&&(t.removeAttribute("disabled"),t.classList.add(this.options.wasDisabledCls))}),this._triggerNested&&e.forEach(t=>{if(t.matches('[data-form-field-toggle="true"]')){let e=window.PluginManager.getPluginInstanceFromElement(t,"FormFieldToggle");e&&e._onChange()}}),t.classList.remove(this.options.hiddenCls),t.classList.add(this.options.showCls)}_getFields(t){return t.querySelectorAll("input, select, textarea")}}}}]);
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.