This module serves the molecuel elements the type definition for database objects
@todo implement the dynamic generation of elements
@constructor
552797
function () {
  var self = this;

  this.collectionRegistry = {};
  // emit molecuel elements pre init event
  molecuel.emit('mlcl::collections::init:pre', self);

  /**
   * Schema directory config
   */
  if (molecuel.config.collections && molecuel.config.collections.collectionDir) {
    this.collectionDir = molecuel.config.collections.collectionDir;
  }

  /**
   * Execute after successful elasticsearch connection
   */
  molecuel.on('mlcl::elements::init:post', function (elements) {
    // add the access to all the db's and searchfunctionality
    self.elements = elements;
    self.elastic = elements.elastic;
    self.database = elements.database;
    self.registerCollections();
    molecuel.emit('mlcl::collections::init:post', self);
  });

  //register block handler
  molecuel.on('mlcl::blocks::init:modules', function(blocks) {
    blocks.registerTypeHandler('collection', self.block);
  });

  return this;
}
96438
function () {
    var draw = this.el.components.draw;
    var selector = this.data.asset;
    var width = draw.data.width;
    var height = draw.data.height;

    if (this.rendering) {
      return;
    }

    this.rendering = true;

    var node = document.querySelector(selector);

    if (!node) {
      console.error('Could not find html element with selector "' + selector + '"');
      return;
    }

    if (!this.observer) {
      this.observer = new MutationObserver(function (mutations) {
        queueRender(node, width, height, function (canvas) {
          renderedCanvas = canvas;
          draw.render();
        });
      });

      var config = { attributes: true, childList: true, characterData: true, subtree: true };
      this.observer.observe(node, config);
    }

    queueRender(node, width, height, function (canvas) {
      renderedCanvas = canvas;
      draw.render();
    });
  }
268049
async function createDocgen() {
  const customPropTypes = await getCustomPropTypes();
  const components = await getDocumentableComponents();
  const propTypesDatabase = getPropTypeLinks(components);
  const docgens = await Promise.all(components.map(c => createComponentsDocgen(c, customPropTypes)));

  const database = docgens.reduce((db, { group, docgens }) => {
    if (NESTED_GROUPS.indexOf(group) !== -1) {
      db[group] = docgens.reduce((entry, docgen) => {
        let name = kebabCase(docgen.component);
        if (!name.endsWith('ss')) {
          name = pluralize(name);
        }

        if (name.match(/selection-control-group/)) {
          entry[name.replace(/-group/, '')].push(docgen);
        } else {
          entry[name.replace(/-(pickers|progress)/, '')] = [docgen];
        }

        return entry;
      }, {});
    } else {
      db[group] = docgens;
    }

    return db;
  }, {});

  await writeFile(DOCGEN_DATABASE, JSON.stringify(database), 'UTF-8');
  console.log(`Wrote docgen database to \`${DOCGEN_DATABASE}\``);

  await writeFile(PROP_TYPE_DATABASE, JSON.stringify(propTypesDatabase), 'UTF-8');
  console.log(`Wrote docgen database to \`${PROP_TYPE_DATABASE}\``);
}
306810
function ()
    {
        var tableData = [
            ['LOOP TYPE', ...config.counts]
        ];

        var bases = [];
        Object.keys(results['while desc']).forEach(function (countType)
        {
            var times = results['while desc'][countType];
            var sum = times.reduce(function (acc, val)
            {
                return acc + val;
            }, 0);
            bases.push(sum);
        });

        Object.keys(results).forEach(function (loopType)
        {
            var currentResult = [loopType];
            Object.keys(results[loopType]).forEach(function (countType, idx)
            {
                var times = results[loopType][countType];
                var sum = times.reduce(function (acc, val)
                {
                    return acc + val;
                }, 0);

                var relative = '-';
                if (bases[idx] > sum) relative = '-' + String((bases[idx] / sum).toFixed(2)) + '%';
                else if (bases[idx] < sum) relative = '+' + String((bases[idx] / sum).toFixed(2)) + '%';

                currentResult.push(relative);
            });
            tableData.push(currentResult);
        });

        console.log('\n\n' + table(tableData) + '\n');
        process.exit();
    }
916722
function (db, options, cb) {
	this.db = db;
	this.cb = cb;
	this.updateQueryMaker = options.update;
	this.insertQueryMaker = options.insert;
	this.maxUpdateAttemptsCount = options.maxUpdateAttemptsCount || 2;
	this.transform = options.transform;
	this.insertFirst = !!options.insertFirst;
	this.nonQuery = !!options.nonQuery;

	var self = this;
	this.updateAttemptsCount = 0;
	this.updateOrInsertBound = function () {
		self.updateOrInsert();
	};
}
240750
function(newModel) {
      var t = this;
      if (newModel) {
        t.model = newModel;
      }
      t.json = t.isBackbone ? t.model.toJSON() : t.model;

      // If a non-object, just print it
      if (typeof t.json !== 'object') {
        t.$el.html('');
        $(t.template.line({name:'value', value:t.json})).appendTo(t.$el);
        return;
      }

      // Re-render if the object elements differ
      var newKeys = _.keys(t.json);
      if (newKeys.length !== t.keys.length || newKeys.length !== _.intersection(t.keys, newKeys).length) {
        return t.render();
      }
      t.keys = newKeys;

      // Set each element
      for (var elemName in t.json) {
        var elem = t.elems[elemName];
        elem.value = t.getElemValue(elemName);
        t.setElemValue(elem);
      }
      return t;
    }
1275409
function define() {
    var type = this.data.type || this.defaults.type
      , collection = this.collection;

    this.data.use = collection[type].class;
    this.data.text = this.data.text || collection[type].text;
    this.data.href = this.data.href || collection[type].href;

    return this;
  }
318982
function (column, value, fromDatabase) {
            var colSchema, clazz = this._static;
            if (((fromDatabase && clazz.typecastOnLoad) || (!fromDatabase && clazz.typecastOnAssignment)) && !isUndefinedOrNull(this.schema) && !isUndefinedOrNull((colSchema = this.schema[column]))) {
                var type = colSchema.type;
                if (value === "" && clazz.typecastEmptyStringToNull === true && !isUndefinedOrNull(type) && ["string", "blob", "text"].indexOf(type) === -1) {
                    value = null;
                }
                var raiseOnError = clazz.raiseOnTypecastError;
                if (raiseOnError === true && isUndefinedOrNull(value) && colSchema.allowNull === false) {
                    throw new ModelError("null is not allowed for the " + column + " column on model " + clazz.tableName);
                }
                try {
                    value = clazz.db.typecastValue(type, value);
                } catch (e) {
                    if (raiseOnError === true) {
                        throw e;
                    }
                }
            }
            return value;
        }
1280180
function() {
			var object, types;
			edb.Type.prototype.$onconstruct.apply(this, arguments);
			if (arguments.length) {
				object = arguments[0] ? arguments[0].$object || {} : {};
				types = edb.ObjectPopulator.populate(object, this);
				edb.ArrayPopulator.populate(this, arguments);
				edb.ObjectProxy.approximate(object, this, types);
			}
			this.onconstruct([].slice.call(this));
		}
202457
function buildSelect () {
    // list of columns to select
    var columns = this.isSelectOnlyIds ? ['id'] : this.model.columnNames
    // add columns to select list
    _.each(columns, columnName => {
        // validate column name - throw error
        columnName = this.model.columnName(columnName, true)
        // get column spec
        var spec = this.model.columns[columnName]
        // add select column sql
        this.select.push(
            this.selectColumnSql(this.model, columnName, spec, this.table)
        )
    })
}
1231688
function MaterialBasic(element) {
    // Stores the element.
    this.element_ = element;

    console.log('***** ctor', this.element_.classList, 'data-upgraded', this.element_.getAttribute('data-upgraded'));

    // Initialize instance.
    this.init();
  }
158348
function createElement(_) {
  var args = [].slice.call(arguments, 1); // for functional component

  if ((0, _utils.isFunction)(_)) {
    return createElement.bind(_, {
      functional: true,
      createElement: _,
      styles: args[0],
      context: args[1]
    });
  }

  var _$functional = _.functional,
      functional = _$functional === void 0 ? false : _$functional,
      h = _.createElement,
      _$context = _.context,
      context = _$context === void 0 ? {} : _$context,
      _$styles = _.styles,
      styles = _$styles === void 0 ? context.$style || {} : _$styles;

  if ((0, _utils.isString)(styles)) {
    styles = (functional ? (context.injections || {})[styles] : context[styles]) || {};
  }

  if (functional) {
    context = context.props || {};
  }

  var data = args[1];

  if ((0, _utils.isObject)(data)) {
    if (!data.staticClass) {
      data.staticClass = '';
    }

    if (!data.attrs) {
      data.attrs = {};
    }

    var modules = data[_config.INJECT_ATTR] || data.attrs[_config.INJECT_ATTR] || '';

    if (modules.length) {
      var _modules = Array.isArray(modules) ? modules : [modules];

      for (var i in _modules) {
        var module = _modules[i];

        if (module && typeof module === 'string') {
          var classExpressions = module.split(/\s+/g);

          for (var _i in classExpressions) {
            var classExpression = classExpressions[_i];

            var _parseClassExpression = (0, _parseClassExpression2.default)(classExpression),
                className = _parseClassExpression.className,
                binding = _parseClassExpression.binding,
                bindingValue = _parseClassExpression.bindingValue,
                role = _parseClassExpression.role;

            if (bindingValue) {
              className = context[binding];
              binding = undefined;
            }

            if ((binding ? context[binding] : true) && styles[className]) {
              data.staticClass += " " + styles[className];
              data.staticClass = data.staticClass.trim();
            }

            if (role) {
              data.attrs["data-component-" + role] = '';
            }
          }
        }
      }
    } // remove styleName attr


    delete data[_config.INJECT_ATTR];
    delete data.attrs[_config.INJECT_ATTR];
  }

  return h.apply(null, args);
}
1333604
function() {

			var self = this;

			// Populate table html
			var content = ['<table class="' + this.tableClass + '" data-instance="' + this.instanceCount + '"><thead>',
				'<tr>'];

			for (var i in this.source.columns) {

				var sortContent = this.source.columns[i].name,
					colDir = self.source.columns[i].dir;

				if (self.source.colSortIdx == i) {
					sortContent = self.formatSortHeader(this.source.columns[i].name, colDir)
				}
				
				content.push('<th class="col-' + i + '"><a data-col-idx="' + i + '" data-sort="sort" href="#" title="' + this.source.columns[i].name +'">' + sortContent + '</a></th>');
			}

			content.push('</tr></thead><tbody>');

			for (var i = 0, rows = this.source.data.length; i < rows; i++) {
				var datum = this.source.data[i];

				// Add in a reference to the data
				dataLookup[this.instanceCount][i] = datum

				content.push('<tr class="row-' + i + '"">');

				for (var j in this.source.columns) {
					content.push('<td class="col-' + j +'">' + this.source.columns[j].formatter(datum) + '</td>');
				}

				content.push('</tr>');
			}

			content.push('</tbody></table>');

			this.node.setHtml(content.join(''));

			this.node.one('table thead').on('click', function(e) {
				if (e.target.data('sort')) {
					self.sort(e.target);

					self.node.all('th a').item(e.target.data('col-idx'))._node.focus()
					e.stop();
				}
			});
			this.node.fire('render')
		}
1319023
function ProcessBase(model) {
    if (!model)
      throw new Error('Must provide a model');
    tr.model.EventContainer.call(this);
    this.model = model;
    this.threads = {};
    this.counters = {};
    this.objects = new tr.model.ObjectCollection(this);
    this.sortIndex = 0;
  }
438879
function createTableColumn (model, name, spec) {
    // require spec to be object
    assert.ok(typeof spec === 'object', `${name} spec must be object`)
    // require valid type
    assert.ok(columnTypes[spec.type], `invalid type ${spec.type} for ${name}`)
    // build sql string
    var columnType = spec.type === 'id'
        ? (model.binaryIds ? 'BINARY(16)' : 'CHAR(32)')
        : columnTypes[spec.type]
    var sql = `${quoteName(name)} ${columnType}`
    // add unsigned flag if set
    if (spec.unsigned && (spec.type === 'int' || spec.type === 'smallint')) {
        sql += ' UNSIGNED'
    }
    // add not null if null specifically set to false
    if (spec.null === false) {
        sql += ' NOT NULL'
    }
    // add auto increment
    if (spec.auto) {
        sql += ' AUTO_INCREMENT PRIMARY KEY'
    }
    // add default value if set
    if (spec.default !== undefined) {
        // use 0/1 for boolean
        if (spec.type === 'boolean') {
            sql += ` DEFAULT ${spec.default ? 1 : 0}`
        }
        // otherwise use quoteNamed value
        else {
            sql += ` DEFAULT '${spec.default}'`
        }
    }
    // return sql string
    return sql
}
576131
function constructor(attributes, options) {
      var hooks = []
        , local = {};

      options = options || {};

      //
      // Set the database name and/or urlRoot if provided in the options.
      //
      if (options.database) this.database = options.database;
      if (options.urlRoot) this.urlRoot = options.urlRoot;

      //
      // Copy attributes to a new object and provide a MongoDB OfbjectID.
      //
      attributes = attributes || {};
      for (var key in attributes) local[key] = attributes[key];

      //
      // If the provided `_id` is an ObjectID assume the model is stored.
      // If it is not an ObjectID, remove it from the provided data.
      // MongoDB will provide an ObjectID by default.
      //
      if ('_id' in local) try {
        local._id = new ObjectID(local._id);
      } catch (error) { delete local._id; }

      //
      // Define restricted non-enumerated properties.
      //
      predefine(this, fossa);

      //
      // Check for presence of before/after hooks and setup.
      //
      if (this.before) hooks.push('before');
      if (this.after) hooks.push('after');
      this.setup(hooks);

      //
      // Call original Backbone Model constructor.
      //
      backbone.Model.call(this, local, options);
    }
779903
function(element) {
			var moduleName = getModuleName(element),
				moduleData = modules[moduleName],
				instanceData,
				context,
				module;

			if (!moduleData) {
				error(new Error('Module type "' + moduleName + '" is not defined.'));
				return;
			}

			if (!this.isStarted(element)) {
				// Auto-assign module id to element
				if (!element.id) {
					element.id = 'mod-' + moduleName + '-' + moduleData.counter;
				}

				moduleData.counter++;

				context = new Box.Context(this, element);

				module = moduleData.creator(context);

				// Prevent errors from showing the browser, fire event instead
				if (!globalConfig.debug) {
					captureObjectErrors(module, moduleName);
				}

				instanceData = {
					moduleName: moduleName,
					instance: module,
					context: context,
					element: element,
					eventHandlers: {}
				};

				bindEventListeners(instanceData);

				instances[element.id] = instanceData;

				callModuleMethod(instanceData.instance, 'init');

				var moduleBehaviors = getBehaviors(instanceData),
					behaviorInstance;

				for (var i = 0, len = moduleBehaviors.length; i < len; i++) {
					behaviorInstance = moduleBehaviors[i];
					callModuleMethod(behaviorInstance, 'init');
				}

			}
		}