/*
Connect a component to any module
TODO: namespacing
541770
function connectStore(modules) {
  var mapStateToProps = function mapStateToProps(state, props) {
    var finalState = {};
    Object.keys(modules).forEach(function (key) {
      var moduleInstance = modules[key];
      var module_name = moduleInstance.module && moduleInstance.module.name || moduleInstance.name;
      var stateObj = state[module_name];
      if (moduleInstance.get) {
        var filter_array = moduleInstance.get.split(",");
        stateObj = (0, _helpers.pluck)(stateObj, filter_array);
      }
      stateObj = attachModuleSelectors(moduleInstance, stateObj, state, props);
      finalState[key] = stateObj;
    });
    return finalState;
  };

  var mapDispatchToProps = function mapDispatchToProps(dispatch) {
    var finalProps = {};
    Object.keys(modules).forEach(function (key) {
      var moduleInstance = modules[key];
      var actions_obj = {};
      var module_actions = moduleInstance.module && moduleInstance.module.actions || moduleInstance.actions;
      if (module_actions) {
        Object.keys(module_actions).forEach(function (action_key) {
          var action = module_actions[action_key];
          actions_obj[action_key] = function () {
            return dispatch(action.apply(undefined, arguments));
          };
        });
        finalProps[key] = actions_obj;
      }
    });
    return finalProps;
  };
  var mergeProps = function mergeProps(state, actions, ownProps) {
    var finalModule = {};
    Object.keys(state).forEach(function (key) {
      var module_state = state[key];
      var module_actions = actions[key];
      finalModule[key] = Object.assign({}, module_state, module_actions);
    });
    return Object.assign({}, finalModule, ownProps);
  };
  return (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps, mergeProps, {
    pure: true,
    areStatePropsEqual: function areStatePropsEqual(a, b) {
      return (0, _helpers.areSame)(a, b);
    }
  });
}
501710
function initCustomComponents() {
    if (typeof projectConfig.crux.components !== 'string') {
      return false;
    }
    var componentPath = path.normalize(global['__rootdir'] + '/' + projectConfig.crux.components + '/'),
      componentList;
    try {
      componentList = util.readDirectoryRelative(componentPath, 'directory', null, true);
    } catch (e) {
      // there are no app components.
      return false;
    }
    var self = this;
    _.forEach(componentList, function(compName) {
      if (self.__components.indexOf('custom:' + compName) === -1) return;
      try {
        var CompClass = require(path.normalize(componentPath + '/' + compName + '/index.js'));
      } catch (e) {
        console.log(e);
        if (e.message.indexOf('Cannot find module') !== -1 && e.message.indexOf('index.js') !== -1) {
          log.warn('Crux.application: Custom component "%s" does not have index.js. Skipping...', compName);
          return;
        }
        e.message = "[Crux.customComponent: " + compName + "] " + e.message;
        throw e;
      }
      if (typeof CompClass !== 'function' || CompClass.prototype.__type !== 'CruxComponent') {
        throw new Error('[Crux.run()] Crux custom component "' + compName + '" does not extend Crux.Component');
      }
      var compConfig = getComponentConfiguration(compName);
      var compObj = new CompClass(compConfig, appConfig);
      if (compObj.name === 'CruxComponent') {
        compObj.name = compName;
      }
      registryObj.register(compObj);
      compObj.registry(registryObj);
    });
  }
36149
private void installModules(final Node node, final NetworkContext context, final Handler<AsyncResult<Void>> doneHandler) {
    List<ModuleContext> modules = new ArrayList<>();
    for (ComponentContext<?> component : context.components()) {
      if (component.isModule()) {
        modules.add(component.asModule());
      }
    }

    final CountingCompletionHandler<Void> counter = new CountingCompletionHandler<Void>(modules.size()).setHandler(doneHandler);
    for (ModuleContext module : modules) {
      installModule(node, module, counter);
    }
  }
224087
def register_module(self, module, namespace=None):
        
        namespace = namespace if namespace is not None else module \
            if isinstance(module, str) else module.__name__
        self.register_namespace(namespace, module)
475870
def _make_connect(module, args, kwargs):
    
    # pylint: disable-msg=W0142
    return functools.partial(module.connect, *args, **kwargs)
267844
function handleConnected(p_ComponentInstance, p_Properties) {
	ensureQuickAccess(p_ComponentInstance);
	if (p_Properties) {
		const originalValues = {};

		Object.keys(p_Properties).forEach((p_PropertyKey) => {
			const property = p_Properties[p_PropertyKey];
			const attributeName = camelCaseToDashes(p_PropertyKey);

			originalValues[p_PropertyKey] = p_ComponentInstance[p_PropertyKey];

			Object.defineProperty(p_ComponentInstance, p_PropertyKey, {
				get() { return p_ComponentInstance._properties[p_PropertyKey]; },
				set(p_Value) {
					const oldValue = p_ComponentInstance._properties[p_PropertyKey];
					let toAttribute = (p_ConvertValue) => p_ConvertValue.toString();
					switch (property.type) {
						case Array: p_ComponentInstance._properties[p_PropertyKey] = (typeof p_Value === 'string') ? JSON.parse(p_Value) : Array.isArray(p_Value) ? p_Value : []; toAttribute = (p_ConvertValue) => JSON.stringify(p_ConvertValue); break;
						case Boolean: p_ComponentInstance._properties[p_PropertyKey] = p_Value && p_Value !== 'false'; toAttribute = () => ''; break;
						case Number: p_ComponentInstance._properties[p_PropertyKey] = ((p_Value === undefined) ? 0 : Number(p_Value)) || 0; break;
						case Object: p_ComponentInstance._properties[p_PropertyKey] = (typeof p_Value === 'string') ? JSON.parse(p_Value) : (typeof p_Value === 'object') ? p_Value : {}; toAttribute = (p_ConvertValue) => JSON.stringify(p_ConvertValue); break;
						case String: p_ComponentInstance._properties[p_PropertyKey] = ((p_Value === undefined || p_Value === null) ? '' : String(p_Value)) || ''; break;
					}
					if (property.observer) {
						if (typeof property.observer === 'function') {
							if (oldValue !== p_ComponentInstance._properties[p_PropertyKey]) {
								property.observer(p_ComponentInstance, p_ComponentInstance._properties[p_PropertyKey], oldValue);
							}
						} else if (p_ComponentInstance[property.observer]) {
							if (oldValue !== p_ComponentInstance._properties[p_PropertyKey]) {
								p_ComponentInstance[property.observer](p_ComponentInstance._properties[p_PropertyKey], oldValue);
							}
						} else {
							console.warn(`The observer with the name: '${property.observer}' was not found inside the class for web component ${p_ComponentInstance.constructor.is}. Make sure that you added a public function with the name '${property.observer}' to the class.`);
						}
					}
					if (property.reflectToAttribute) {
						if (p_ComponentInstance._properties[p_PropertyKey]) {
							p_ComponentInstance.setAttribute(attributeName, toAttribute(p_ComponentInstance._properties[p_PropertyKey]));
						} else {
							p_ComponentInstance.removeAttribute(attributeName);
						}
					}
				},
			});
		});

		Object.keys(p_Properties).forEach((p_PropertyKey) => {
			const property = p_Properties[p_PropertyKey];
			const attributeName = camelCaseToDashes(p_PropertyKey);
			let userInitialized;
			let originalValue = originalValues[p_PropertyKey] || null;

			if (originalValue) {
				switch (property.type) {
					case Array:
						if (Array.isArray(originalValue)) {
							p_ComponentInstance[p_PropertyKey] = originalValue;
						} else {
							originalValue = null;
						}
						break;
					case Boolean:
						if (typeof originalValue === 'boolean') {
							p_ComponentInstance[p_PropertyKey] = originalValue;
						} else {
							originalValue = null;
						}
						break;
					case Number:
						if (typeof originalValue === 'number') {
							p_ComponentInstance[p_PropertyKey] = originalValue;
						} else {
							originalValue = null;
						}
						break;
					case Object:
						if (typeof originalValue === 'object') {
							p_ComponentInstance[p_PropertyKey] = originalValue;
						} else {
							originalValue = null;
						}
						break;
					case String:
						if (typeof originalValue === 'string') {
							p_ComponentInstance[p_PropertyKey] = originalValue;
						} else {
							originalValue = null;
						}
						break;
				}
			}

			/* if (originalValue === null)  { */
			if (p_ComponentInstance.hasAttribute(attributeName)) {
				userInitialized = p_ComponentInstance.getAttribute(attributeName);
			}

			if (property.reflectToAttribute || p_ComponentInstance[p_PropertyKey] === undefined) {
				// use the user specified value if it was specified
				if (userInitialized !== undefined) {
					switch (property.type) {
						case Array:
							p_ComponentInstance[p_PropertyKey] = JSON.parse(userInitialized);
							break;
						case Boolean:
							p_ComponentInstance[p_PropertyKey] = userInitialized !== 'false';
							break;
						case Number:
							p_ComponentInstance[p_PropertyKey] = Number(userInitialized);
							break;
						case Object:
							p_ComponentInstance[p_PropertyKey] = JSON.parse(userInitialized);
							break;
						case String:
							p_ComponentInstance[p_PropertyKey] = String(userInitialized);
							break;
					}
				} else { // use the default value
					switch (property.type) {
						case Array:
							p_ComponentInstance[p_PropertyKey] = property.value || [];
							break;
						case Boolean:
							p_ComponentInstance[p_PropertyKey] = property.value || false;
							break;
						case Number:
							p_ComponentInstance[p_PropertyKey] = property.value || 0;
							break;
						case Object:
							p_ComponentInstance[p_PropertyKey] = property.value || {};
							break;
						case String:
							p_ComponentInstance[p_PropertyKey] = property.value || '';
							break;
					}
				}
			}
			// }
		});
	}
}
888646
function componentMount(tag$$1, dom, expressions, opts) {
      var __ = tag$$1.__;
      var root = __.root;
      root._tag = tag$$1; // keep a reference to the tag just created

      // Read all the attrs on this instance. This give us the info we need for updateOpts
      parseAttributes.apply(__.parent, [root, root.attributes, function (attr, expr) {
        if (!__.isAnonymous && RefExpr.isPrototypeOf(expr)) { expr.tag = tag$$1; }
        attr.expr = expr;
        __.instAttrs.push(attr);
      }]);

      // update the root adding custom attributes coming from the compiler
      walkAttributes(__.impl.attrs, function (k, v) { __.implAttrs.push({name: k, value: v}); });
      parseAttributes.apply(tag$$1, [root, __.implAttrs, function (attr, expr) {
        if (expr) { expressions.push(expr); }
        else { setAttribute(root, attr.name, attr.value); }
      }]);

      // initialiation
      updateOpts.apply(tag$$1, [__.isLoop, __.parent, __.isAnonymous, opts, __.instAttrs]);

      // add global mixins
      var globalMixin = mixin(GLOBAL_MIXIN);

      if (globalMixin && !__.skipAnonymous) {
        for (var i in globalMixin) {
          if (globalMixin.hasOwnProperty(i)) {
            tag$$1.mixin(globalMixin[i]);
          }
        }
      }

      if (__.impl.fn) { __.impl.fn.call(tag$$1, opts); }

      if (!__.skipAnonymous) { tag$$1.trigger('before-mount'); }

      // parse layout after init. fn may calculate args for nested custom tags
      each(parseExpressions.apply(tag$$1, [dom, __.isAnonymous]), function (e) { return expressions.push(e); });

      tag$$1.update(__.item);

      if (!__.isAnonymous && !__.isInline) {
        while (dom.firstChild) { root.appendChild(dom.firstChild); }
      }

      define(tag$$1, 'root', root);

      // if we need to wait that the parent "mount" or "updated" event gets triggered
      if (!__.skipAnonymous && tag$$1.parent) {
        var p = getImmediateCustomParent(tag$$1.parent);
        p.one(!p.isMounted ? 'mount' : 'updated', function () {
          setMountState.call(tag$$1, true);
        });
      } else {
        // otherwise it's not a child tag we can trigger its mount event
        setMountState.call(tag$$1, true);
      }

      tag$$1.__.wasCreated = true;

      return tag$$1
    }
1273416
function(name, module) {
			var Module;
			if (gui.Type.isString(name) && name.length) {
				Module = gui.Module.extend(name, module || {});
				module = gui.Module.$register(new Module(name));
				return module;
			} else {
				throw new Error("Module needs an identity token");
			}
		}
587254
function Model(namespace) {
    var self = this;
    this.i = 0;
    var local = {
        modelPath: null,
        entitiesPath: null,
        connection: null,
        files: {},
        toReload: [],
        trying: 0
    };

    var _configuration = null;
    var _connector = null;

    var cacheless = (process.env.IS_CACHELESS == 'false') ? false : true;
    var standalone = config.Host.isStandalone();


    var setup = function(namespace) {
        if ( typeof(namespace) == 'undefined' || namespace == '') {
            console.error('gina', 'MODEL:ERR:1', 'EEMPTY: Model namespace', __stack);
        }

        var model, namespace = namespace.split(/\//g);
        _connector = namespace[1];//Has to be writtien the same for the connetors.json decalration or for the model folder
        var bundle = namespace[0];
        namespace.shift();
        //Capitalize - Normalize
        if (namespace.length > 1) {
            //            for (var i; i<namespace.length; ++i) {
            //                namespace[i] = namespace[i].substring(0, 1).toUpperCase() + namespace[i].substring(1);
            //            }

            model = namespace.join(".");
        } else {
            //Dir name.
            model = namespace[0];
        }


        console.debug("\nBundle: ", bundle);
        console.debug("Model: ", model);
        self.name       = _connector;
        self.bundle     = bundle;
        self.model      = model;
        self.modelDirName = model;
        var modelConnectors = getContext('modelConnectors');
        if (modelConnectors) {
            self.connectors = getContext('modelConnectors')[self.name];
            self.database = self.connectors.database;
        } else {
            self.connectors = {};
        }

    }

    /**
     * Init
     *
     * @param {string} namesapce
     *
     * @private
     * */
    var init = function(reload) {

        var bundle          = self.bundle;
        var model           = self.model;
        var modelDirName    = self.modelDirName;

        // this is supposed to happen on load or for dev env; on reload, with a checksum
        var conf        = getConfigSync(bundle);
        local.locals    = conf.locals;

        if (conf) {
            _configuration = conf.connectors;

            console.debug("CONF READY ", model, conf.path);
            //TODO - More controls...

            //For now, I just need the F..ing entity name.
            var modelPath       = local.modelPath = _(conf.path + '/' + modelDirName);
            var entitiesPath    = local.entitiesPath = _(modelPath + '/entities');
            console.debug('models scaning... ', entitiesPath, fs.existsSync(entitiesPath));
            if (!fs.existsSync(entitiesPath)) {
                fs.mkdirSync(entitiesPath) // creating empty path
            }

            var connectorPath   = _(modelPath + '/lib/connector.js');
            //Getting Entities Manager.
            var exists = fs.existsSync(connectorPath);
            if (exists) {
                if (cacheless)
                    delete require.cache[_(connectorPath, true)];

                var Connector = require(_(connectorPath, true));

                self.connect(
                    Connector,
                    function onConnect(err, conn) {
                        if (err) {
                            console.error(err.stack);
                            self.emit('model#ready', err, self.bundle, self.name, null)

                        } else {
                            local.connection = conn;
                            self.emit('model#ready', false, self.bundle, self.name, conn)
                        }
                    }
                )
            } else {//Means that no connector was found in models.

                //finished.
                self.emit('model#ready', new Error('[ '+self.name+' ] No connector found'), self.bundle, self.name, conn)
            }

        } else {
            console.debug("no configuration found...");
            self.emit('model#ready', new Error('no configuration found for your model: ' + model), self.bundle, self.name, null)
        }

        return self
    }


    this.connect = function(Connector, callback) {
        if ( typeof(self.connectors[_connector]) == 'undefined' ) {
            self.connectors[_connector] = {};
            var connector = new Connector( self.getConfig(_connector) );

            connector.onReady( function(err, conn){
                self.connectors[_connector].err = err;
                self.connectors[_connector].conn = conn;

                callback(err, conn);
            });

        } else {
            callback(self.connectors[_connector].err, self.connectors[_connector].conn);
        }
    }

    this.reload = function(conf, cb) {
        setup(namespace);
        init(cb)
    }

    /**
     * Get Model configuration
     *
     * @param {string} bundle
     *
     * @callback callback
     * @param {boolean|string} err - Error Status response
     * @param {object} conf - Configuration response
     *
     * @private
     * */
    var getConfigSync = function(bundle, i) {
        var i = i || 0;
        var configuration = config.getInstance(bundle);

        try {

            var locals = _locals = utilsConfig.getSync('gina', 'locals.json')
        } catch (err) {
            console.emerg('Error while calling `Model::getConfigSync()` '+ err.stack||err.message);
            if ( i < 10) {
                console.debug('about to retry to load locals.json');
                setTimeout(function(){

                    i = i+1;
                    console.debug('retry ('+i+') ...');
                    return getConfigSync(bundle, i)
                }, 300)

            } else {
                throw new Error('Config could not be loaded');
                process.exit(1)
            }
            return false
        }

        if ( typeof(configuration) != 'undefined' && locals) {

            var env = configuration.Env.current;
            var conf = configuration.Env.getConf(bundle, env);

            // configuration object.
            var confObj = {
                connectors  : conf.content.connectors,
                path        : conf.modelsPath,
                locals      : locals
            };

            return confObj
        } else {
            throw new Error('Config not instantiated');
            return undefined
        }
    }

    /**
     * Get Model Configuration
     *
     * @return {object|undefined} configuration
     * */
    this.getConfig = function(connector){
        var connector = ( typeof(connector) == 'undefined' ) ?  _connector : connector;

        if (_configuration) {
            return ( typeof(connector) != 'undefined' ) ? _configuration[connector] : undefined
        } else {
            return undefined
        }
    }


    this.onReady = function(callback) {
        self.once('model#ready', function(err, bundle, model, conn) {
            // entities == null when the database server has not started.
            if ( err ) {
                console.error(err.stack||err.message)
                //console.log('No entities found for [ '+ self.name +':'+ entityName +'].\n 1) Check if the database is started.\n2) Check if exists: /models/entities/'+ entityName);
            }
            callback(err, bundle, model, conn)
        });
        setup(namespace);
        return init()
    };

    return this
}
120097
function moduleDefine(exports, name, members) {
            var target = [exports];
            var publicNS = null;
            if (name) {
                publicNS = createNamespace(_Global, name);
                target.push(publicNS);
            }
            initializeProperties(target, members, name || "<ANONYMOUS>");
            return publicNS;
        }
1137260
function(module) {
	try {
		var div = WireIt.cn('div', {className: "WiringEditor-module"});
		
		if(module.description) {
			div.title = module.description;
		}
		
      if(module.container.icon) {
         div.appendChild( WireIt.cn('img',{src: module.container.icon}) );
      }
      div.appendChild( WireIt.cn('span', null, null, module.name) );

      var ddProxy = new WireIt.ModuleProxy(div, this);
      ddProxy._module = module;

		// Get the category element in the accordion or create a new one
		var category = module.category || "main";
		var el = Dom.get("module-category-"+category);
		if( !el ) {
			this.modulesAccordionView.addPanel({
				label: category,
				content: "<div id='module-category-"+category+"'></div>"
			});
			this.modulesAccordionView.openPanel(this.modulesAccordionView._panels.length-1);
			el = Dom.get("module-category-"+category);
		}
		
		el.appendChild(div);
	}catch(ex){ console.log(ex);}
 	}
1177174
public XComponentContext connect(String host, int port) throws BootstrapException {
        String unoConnectString = "uno:socket,host=" + host + ",port=" + port + ";urp;StarOffice.ComponentContext";
        return connect(unoConnectString);
    }
824791
function genComponentContextCode(component, componentIdInContext) {
    var code = ['var componentCtx = {'];

    // proto
    code.push('proto: ' + componentIdInContext + 'Proto,');

    // sourceSlots
    code.push('sourceSlots: sourceSlots,');

    // data
    var defaultData = component.data.get();
    code.push('data: data || ' + stringifier.any(defaultData) + ',');

    // parentCtx
    code.push('owner: parentCtx,');

    // slotRenderers
    code.push('slotRenderers: {}');

    code.push('};');

    return code.join('\n');
}
843008
function getModuleByNamespace (store, helper, namespace) {
  const module = store._modulesNamespaceMap[namespace]
  if (process.env.NODE_ENV !== 'production' && !module) {
    console.error(`[vuex] module namespace not found in ${helper}(): ${namespace}`)
  }
  return module
}
559926
function addComponent(Component, options) {
                var name = options.name,
                    container = options.container;

                if (name === undefined) {
                    throw 'you have to define data.name for component.';
                } else if (container === undefined) {
                    throw 'You have to define container for component.';
                } else if (this.children[name] !== undefined) {
                    throw 'Component using name:' + name + '! already defined.';
                }
                var component = this.setComponent(Component, options),
                    instance = component.run(options.container);
                instance.setContext(this.context);
                this.children[name] = instance;
                return instance;
            }
463589
function transformNamespaceImports(j, root, importPath, targetPath) {
  // find namespace imports
  root.find(j.ImportDeclaration, { source: { value: importPath } }).forEach(importDeclaration => {
    const namespaceImportSpecifier = importDeclaration.node.specifiers.find(
      specifier => specifier.type === 'ImportNamespaceSpecifier',
    );
    if (namespaceImportSpecifier) {
      j(importDeclaration).replaceWith(
        j.importDeclaration(
          [j.importNamespaceSpecifier(j.identifier(namespaceImportSpecifier.local.name))],
          j.literal(targetPath),
        ),
      );
      transformMemberExpressions(namespaceImportSpecifier.local.name, j, root);
    }
  });
}
215276
function connect(Composed) {
  return (function (superclass) {
    function Connect(props) {
      superclass.call(this, props);
      this.state = getState();
      this.onChange = this.onChange.bind(this);
    }

    if ( superclass ) Connect.__proto__ = superclass;
    Connect.prototype = Object.create( superclass && superclass.prototype );
    Connect.prototype.constructor = Connect;

    Connect.prototype.componentDidMount = function componentDidMount () {
      this.token = subscribe(this.onChange);
    };

    Connect.prototype.componentWillUnmount = function componentWillUnmount () {
      if (typeof this.token === "function") {
        this.token();
      }
    };

    Connect.prototype.onChange = function onChange (state) {
      this.setState(state);
    };

    Connect.prototype.render = function render () {
      return React.createElement(Composed, Object.assign({}, this.state, this.props));
    };

    return Connect;
  }(React__default.PureComponent));
}