/*
Function that returns an event handler that is called when the models change
events are triggered.  It uses the bindings setter to place the value from
the model into the DOM.
433387
function makeSetter(setters, selector, view) {
  setters = parseSetters(setters, view);

  return setters.length < 1 ? undefined : function (model, value, data) {
    if (data && data.internal) return;

    const $el = this.$(selector);

    if ($el.length < 1) return;

    setters.forEach((fnc) => {
      fnc($el, value);
    });
  };
}
830014
function _handleDataSelectorChange () {
    let chartType = getCurrentType();
    let dataType = d3.select(`.${dataSelectorClass}`).property('value');
    let currentData = defaultData[chartType][dataType];

    storage.setDataByKey(savedDataKey, currentData);
    updateAllComponents();
}
1047347
function (input, controller, controller_property) {
	var change_detector = bind_one_way(input, controller, controller_property);

	input.build_setter();

	change_detector.observer = new Observer(controller);
	change_detector.observer.$on(controller_property, function (value) {
		input.set(value);
	});

	return change_detector;
}
1182139
function() {
    var classBindings = get(this, 'classNameBindings'),
        classNames = get(this, 'classNames'),
        elem, newClass, dasherizedClass;

    if (!classBindings) { return; }

    // Loop through all of the configured bindings. These will be either
    // property names ('isUrgent') or property paths relative to the view
    // ('content.isUrgent')
    a_forEach(classBindings, function(binding) {

      // Variable in which the old class value is saved. The observer function
      // closes over this variable, so it knows which string to remove when
      // the property changes.
      var oldClass;

      // Set up an observer on the context. If the property changes, toggle the
      // class name.
      var observer = function() {
        // Get the current value of the property
        newClass = this._classStringForProperty(binding);
        elem = this.$();

        // If we had previously added a class to the element, remove it.
        if (oldClass) {
          elem.removeClass(oldClass);
          // Also remove from classNames so that if the view gets rerendered,
          // the class doesn't get added back to the DOM.
          classNames.removeObject(oldClass);
        }

        // If necessary, add a new class. Make sure we keep track of it so
        // it can be removed in the future.
        if (newClass) {
          elem.addClass(newClass);
          oldClass = newClass;
        } else {
          oldClass = null;
        }
      };

      // Get the class name for the property at its current value
      dasherizedClass = this._classStringForProperty(binding);

      if (dasherizedClass) {
        // Ensure that it gets into the classNames array
        // so it is displayed when we render.
        classNames.push(dasherizedClass);

        // Save a reference to the class name so we can remove it
        // if the observer fires. Remember that this variable has
        // been closed over by the observer.
        oldClass = dasherizedClass;
      }

      // Extract just the property name from bindings like 'foo:bar'
      var parsedPath = Ember.View._parsePropertyPath(binding);
      addObserver(this, parsedPath.path, observer);
    }, this);
  }
676811
function(key, value, options) {
      var attrs, current;

      // Handle both `("key", value)` and `({key: value})` -style calls.
      if (_.isObject(key) || key == null) {
        attrs = key;
        options = value;
      } else {
        attrs = {};
        attrs[key] = value;
      }
      options = options ? _.clone(options) : {};

      // If we're "wait"-ing to set changed attributes, validate early.
      if (options.wait) {
        if (!this._validate(attrs, options)) return false;
        current = _.clone(this.attributes);
      }

      // Regular saves `set` attributes before persisting to the server.
      var silentOptions = _.extend({}, options, {silent: true});
      if (attrs && !this.set(attrs, options.wait ? silentOptions : options)) {
        return false;
      }

      // After a successful server-side save, the client is (optionally)
      // updated with the server-side state.
      var model = this;
      var success = options.success;
      options.success = function(resp, status, xhr) {
        var serverAttrs = model.parse(resp, xhr);
        if (options.wait) {
          delete options.wait;
          serverAttrs = _.extend(attrs || {}, serverAttrs);
        }
        if (!model.set(serverAttrs, options)) return false;
        if (success) {
          success(model, resp);
        } else {
          model.trigger('sync', model, resp, options);
        }
      };

      // Finish configuring and sending the Ajax request.
      options.error = Backbone.wrapError(options.error, model, options);
      var method = this.isNew() ? 'create' : 'update';
      var xhr = (this.sync || Backbone.sync).call(this, method, this, options);
      if (options.wait) this.set(current, silentOptions);
      return xhr;
    }
709602
function changeDelegatedHandler(eventOptions = {}) {
    const { key } = eventOptions;
    const def = defs.get(this);

    if (key && key in def.keys) {
        triggerOne(this, '_asterisk:set', eventOptions);
    }
}
1508
function () {
            var el = this.opts.element, observer, self = this;

            el.on("change.select2", this.bind(function (e) {
                if (this.opts.element.data("select2-change-triggered") !== true) {
                    this.initSelection();
                }
            }));

            this._sync = this.bind(function () {

                // sync enabled state
                var disabled = el.prop("disabled");
                if (disabled === undefined) disabled = false;
                this.enable(!disabled);

                var readonly = el.prop("readonly");
                if (readonly === undefined) readonly = false;
                this.readonly(readonly);

                syncCssClasses(this.container, this.opts.element, this.opts.adaptContainerCssClass);
                this.container.addClass(evaluate(this.opts.containerCssClass, this.opts.element));

                syncCssClasses(this.dropdown, this.opts.element, this.opts.adaptDropdownCssClass);
                this.dropdown.addClass(evaluate(this.opts.dropdownCssClass, this.opts.element));

            });

            // IE8-10 (IE9/10 won't fire propertyChange via attachEventListener)
            if (el.length && el[0].attachEvent) {
                el.each(function() {
                    this.attachEvent("onpropertychange", self._sync);
                });
            }

            // safari, chrome, firefox, IE11
            observer = window.MutationObserver || window.WebKitMutationObserver|| window.MozMutationObserver;
            if (observer !== undefined) {
                if (this.propertyObserver) { delete this.propertyObserver; this.propertyObserver = null; }
                this.propertyObserver = new observer(function (mutations) {
                    $.each(mutations, self._sync);
                });
                this.propertyObserver.observe(el.get(0), { attributes:true, subtree:false });
            }
        }
207710
function refreshModel(o) {
  if (!(o instanceof Model)) {throw new TypeError('Model expected')}
  _.forEach(o.elements(), refreshElement)
}
1013247
function(changedModel, options) {
        options = options || {};

        // Don't persist unless the model is different
        if (_.isEqual(JSON.parse(JSON.stringify(model)), JSON.parse(JSON.stringify(model.syncMonitor.get('model'))))) {
          logger.info('modelListener.noChanges', t.className, model.toJSON());
          return;
        }

        // Disconnect listeners if the ID changes
        if (model.get('id') !== modelId) {
          logger.info('modelListener.alteredId', t.className, model.toJSON());
          return disconnectListeners();
        }

        // Persist changes to the server (unless the changes originated from there)
        if (!options.isSyncChanging) {
          logger.info('modelListener.saving', t.className, model.toJSON());
          model.save();
        }
      }
219251
function(cb) {
        var method = cb ? 'on' : 'off';
        this[method]('change', function(model) {
          var newModel = this._updateModel(model);
          if(_.isFunction(cb)){
            cb.call(this, newModel);
          }
        }, this);
      }
364773
function(){
    this.isRendered = true;
    this.isClosed = false;
    this.resetItemViewContainer();

    this.triggerBeforeRender();
    var html = this.renderModel();
    this.$el.html(html);
    // the ui bindings is done here and not at the end of render since they
    // will not be available until after the model is rendered, but should be
    // available before the collection is rendered.
    this.bindUIElements();
    this.triggerMethod("composite:model:rendered");

    this._renderChildren();

    this.triggerMethod("composite:rendered");
    this.triggerRendered();
    return this;
  }
553489
function(event, model, collection, options) {
      if ((event == 'add' || event == 'remove') && collection != this) return;
      if (event == 'destroy') {
        this.remove(model, options);
      }
      if (model && event === 'change:' + model.idAttribute) {
        delete this._byId[model.previous(model.idAttribute)];
        this._byId[model.id] = model;
      }
      this.trigger.apply(this, arguments);
    }
841782
function(m) {
					
					this.__model__ = new m();
					this.__model__.__controller__ = this.__controller__;
					if (typeof this.__model__.data === 'undefined') {
						this.__model__.data = {};
					}
					
					//
					// Set events manager
					
					var eventsManager = new jsCow.res.core.events.eventsManager();
					eventsManager.cmp(this);
					eventsManager.parent(this.__model__);
					this.__model__.events = eventsManager;

					$.extend(true, this.__model__,  {
						
						reset: function(index) {
							
							if (index) {
								
								if (this.data[index]) {
									if (typeof this.data[index] === 'object') {
										this.data[index] = {};
									}
									if (typeof this.data[index] === 'string') {
										this.data[index] = "";
									}
									if (this.data[index] instanceof Array) {
										this.data[index] = [];
									}
								}
								
							} else {
								
								if (typeof this.data === 'object') {
									this.data = {};
								}
								if (typeof this.data === 'string') {
									this.data = "";
								}
								if (this.data instanceof Array) {
									this.data = [];
								}

							}
							
							return this;
						},
						
						update: function(e) {
							
							this.data = $.extend(true, this.data, e.data);
							this.trigger("update", this.data);
							
							return this;
							
						},
						
						/**
						...
						
						@method id
						@return {Object} ...
						**/
						id: function(id) {
							if (id) {
								this.__id__ = id;
								
								return this;
							} else {
								return this.__id__;
							}
						},
						
						on: function(event, handler, local) {
							this.events.on(event, handler, local);
							
							return this;
						},
						
						trigger: function(event, data, local) {
							this.events.trigger(event, data, local);
							
							return this;
						},
						
						bubbleIn: function(event, data, local) {
							this.events.bubbleIn(event, data, local);
							
							return this;
						},
						
						bubbleOut: function(event, data, local) {
							this.events.bubbleOut(event, data, local);
							
							return this;
						},
						
						bubble: function(event, data, local) {
							this.events.bubble(event, data, local);
							
							return this;
						}
						
					});
					
					this.__model__.id('m' + ((new Date()).getTime() + "" + Math.floor(Math.random() * 1000000)).substr(0, 18));
					
					//
					// The init method will be called the model init method by event 
					
					this.__model__.on( "controller.init",  this.__model__.init);
					this.__model__.on( "model.update",  this.__model__.update);
					
					
					return this;
				}
1119691
function() {
      inputEx.KeyValueField.superclass.initEvents.call(this);

      this.inputs[0].updatedEvt.subscribe(this.onSelectFieldChange, this, true); 
   }
254846
function() {
      var self = this,
          val = $.map(self.items(), function(item) {
            return self.options.itemValue(item).toString();
          });

      self.$element.val(val, true);

      if (self.options.triggerChange)
        self.$element.trigger('change');
    }
15756
function processAfterStateChange(el) {
    const optionValue = el.dataset.optionValue;
    const optionIndex = Array.prototype.slice.call(el.parentNode.children).indexOf(el);
    this.setSelectedOption(optionValue);
    elementScroll.scroll(el);
    emitAndFire(this, 'listbox-change', {
        index: optionIndex,
        selected: [optionValue],
        el
    });
}
1155386
function (model, options, eventName) {
        var newModels = slice.call(this.models);
        var comparator = this.comparator || this.collection.comparator;
        //Whether or not we are to expect a sort event from our collection later
        var sortable = eventName === 'add' && this.collection.comparator && (options.at == null) && options.sort !== false;
        if (!sortable) {
            var index = sortedIndexBy(newModels, model, comparator);
            newModels.splice(index, 0, model);
        } else {
            newModels.push(model);
            if (options.at) newModels = this._sortModels(newModels);
        }

        this.models = newModels;
        this._addIndex(this._indexes, model);
        if (this.comparator && !sortable) {
            this.trigger('sort', this);
        }
    }