((exports) => { class DynamicFieldsComponent { constructor(options = {}) { this.wrapperSelector = options.wrapperSelector; this.containerSelector = options.containerSelector; this.fieldSelector = options.fieldSelector; this.addFieldButtonSelector = options.addFieldButtonSelector; this.addSeparatorButtonSelector = options.addSeparatorButtonSelector; this.fieldTemplateSelector = options.fieldTemplateSelector; this.separatorTemplateSelector = options.separatorTemplateSelector; this.removeFieldButtonSelector = options.removeFieldButtonSelector; this.moveUpFieldButtonSelector = options.moveUpFieldButtonSelector; this.moveDownFieldButtonSelector = options.moveDownFieldButtonSelector; this.onAddField = options.onAddField; this.onRemoveField = options.onRemoveField; this.onMoveUpField = options.onMoveUpField; this.onMoveDownField = options.onMoveDownField; this.placeholderId = options.placeholderId; this.elementCounter = 0; this._enableInterpolation(); this._activateFields(); this._bindEvents(); } _enableInterpolation() { $.fn.replaceAttribute = function(attribute, placeholder, value) { $(this).find(`[${attribute}*=${placeholder}]`).addBack(`[${attribute}*=${placeholder}]`).each((index, element) => { $(element).attr(attribute, $(element).attr(attribute).replace(placeholder, value)); }); return this; } $.fn.template = function(placeholder, value) { // See the comment below in the `_addField()` method regarding the // `