/*
Prepares a new virtual component by comparing it with the old version.

It sets the _comp references in the new version where its ancestors
can be mapped to corresponding virtual components in the old version.
181815
function _forEachComponent (state, comp, vc, hook) {
  console.assert(vc._isVirtualComponent, 'this method is intended for VirtualComponents only')
  if (!vc.__components__) {
    let context = vc._context
    console.assert(context, 'there should be a capturing context on the VirtualComponent')
    // refs are those ref'd using $$().ref()
    let newRefs = context.refs
    // foreignRefs are refs of those components which are passed via props
    let newForeignRefs = context.foreignRefs
    // all other components which are not ref'd stored via a derived key based on trace
    if (!context.internalRefs) {
      context.internalRefs = _extractInternalRefs(context, vc)
    }
    let newInternalRefs = context.internalRefs
    let entries = []
    let compData = _getInternalComponentData(comp)
    let oldRefs = compData.refs
    let oldForeignRefs = compData.foreignRefs
    // TODO: make sure that this is always initialized properly
    let oldInternalRefs = compData.internalRefs || new Map()
    let _addEntries = (_newRefs, _oldRefs) => {
      for (let [ref, vc] of _newRefs) {
        let oldVc = _oldRefs.get(ref)
        let comp
        if (oldVc) {
          comp = oldVc._comp
        }
        entries.push({ vc, comp })
      }
    }
    if (newRefs.size > 0) _addEntries(newRefs, oldRefs)
    if (newForeignRefs.size > 0) _addEntries(newForeignRefs, oldForeignRefs)
    if (newInternalRefs.size > 0) _addEntries(newInternalRefs, oldInternalRefs)
    vc.__components__ = entries
  }
  if (vc.__components__.length > 0) {
    for (let entry of vc.__components__) {
      hook(state, entry.comp, entry.vc)
    }
  }
}
314571
def setComponents(self, components):
        
        layout = self.layout()
        for comp in components:
            attrWidget = ComponentAttributerChecker(comp)
            layout.addWidget(attrWidget)
1212483
function updatePrimaryRootContext(wrappingComponent) {
  const adapter = getAdapter(wrappingComponent[OPTIONS]);
  const primaryWrapper = wrappingComponent[PRIMARY_WRAPPER];
  const primaryRenderer = primaryWrapper[RENDERER];
  const primaryNode = primaryRenderer.getNode();
  const {
    legacyContext,
    providerValues,
  } = getContextFromWrappingComponent(wrappingComponent, adapter);
  const prevProviderValues = primaryWrapper[PROVIDER_VALUES];

  primaryWrapper.setContext({
    ...wrappingComponent[PRIMARY_WRAPPER][OPTIONS].context,
    ...legacyContext,
  });
  primaryWrapper[PROVIDER_VALUES] = new Map([...prevProviderValues, ...providerValues]);

  if (typeof adapter.isContextConsumer === 'function' && adapter.isContextConsumer(primaryNode.type)) {
    const Consumer = primaryNode.type;
    // Adapters with an `isContextConsumer` method will definitely have a `getProviderFromConsumer`
    // method.
    const Provider = adapter.getProviderFromConsumer(Consumer);
    const newValue = providerValues.get(Provider);
    const oldValue = prevProviderValues.get(Provider);

    // Use referential comparison like React
    if (newValue !== oldValue) {
      primaryWrapper.rerender();
    }
  }
}
574775
def compat_kwargs(kwargs):
    """"""
    warn_deprecations(kwargs)
    for old, new in RENAMED_VARS.items():
        if old in kwargs:
            kwargs[new] = kwargs[old]
            # update cross references
            for c_old, c_new in RENAMED_VARS.items():
                if c_new == new:
                    kwargs[c_old] = kwargs[new]
332386
function setReference(
    value, root, node, requestedPath, optimizedPath,
    version, expired, lru, comparator, errorSelector, replacedPaths) {

    var reference = node.value;
    optimizedPath.splice(0, optimizedPath.length);
    optimizedPath.push.apply(optimizedPath, reference);

    if (isExpired(node)) {
        optimizedPath.index = reference.length;
        expireNode(node, expired, lru);
        return [undefined, root];
    }

    var container = node;
    var parent = root;

    node = node.$_context;

    if (node != null) {
        parent = node.$_parent || root;
        optimizedPath.index = reference.length;
    } else {

        var index = 0;
        var count = reference.length - 1;

        parent = node = root;

        do {
            var key = reference[index];
            var branch = index < count;
            optimizedPath.index = index;

            var results = setNode(
                root, parent, node, key, value,
                branch, true, requestedPath, optimizedPath,
                version, expired, lru, comparator, errorSelector, replacedPaths
            );
            node = results[0];
            if (isPrimitive(node)) {
                optimizedPath.index = index;
                return results;
            }
            parent = results[1];
        } while (index++ < count);

        optimizedPath.index = index;

        if (container.$_context !== node) {
            createHardlink(container, node);
        }
    }

    return [node, parent];
}
222870
function Component (props) {
  this._parent = null
  this._collector = { refs: [], components: [] }

  /**
   * > Contains all component properties and children. <br>
   * > Do not modify it directly, but recreate a new component using `cloneElement` instead
   * @type {object}
   * @category Properties
   */
  this.props = props || {}

  /**
   * > HTMLElement used as "base" for the component instance. Can also be an array of elements if `template` return an array.
   * @type {(VNode|HTMLElement|array)}
   * @category Properties
   */
  this.base = null

  /**
   * Set to true when component is mounted
   * @type {boolean}
   * @category Properties
   */
  this.mounted = false
}
126860
function initNew (args) {
    // get module
    var module = this.component.module
    // if module has new method run it
    if (module.new) {
        // call new method with original new args
        this.promise = module.new(args.args).then(res => {
            // if new returns undefined do not set
            if (!defined(res)) {
                return
            }
            // require data to be object
            this.assert(typeof res === 'object' && res, 110)
            // if data is set then use it
            if (defined(res.data)) {
                // require data to be object
                this.assert(typeof res.data === 'object' && res.data, 110)
                // set component data to data returned by new method
                this.data = res.data
            }
            // if id set set it data use it
            if (defined(res.id)) {
                this.id = res.id
            }
        })
    }
    // otherwise set resolved promise
    else {
        // use any args for data
        _.merge(this.data, args.args)
        // set init promise as resolved
        this.promise = Promise.resolve()
    }
}
784924
def complist(self):
        
        ans = []
        for comp in (self.component1, self.component2):
            try:
                ans.extend(comp.complist())
            except AttributeError:
                ans.append(comp)
        return ans
52624
function(root,new$,old,caret) {
	
	// var skipnew = new == null or new === false or new === true
	var newIsNull = new$ == null || new$ === false;
	var oldIsNull = old == null || old === false;
	
	
	if (new$ === old) {
		// remember that the caret must be an actual dom element
		// we should instead move the actual caret? - trust
		if (newIsNull) {
			return caret;
		} else if (new$._slot_) {
			return new$._slot_;
		} else if ((new$ instanceof Array) && new$.taglen != null) {
			return reconcileIndexedArray(root,new$,old,caret);
		} else {
			return caret ? caret.nextSibling : root._dom.firstChild;
		};
	} else if (new$ instanceof Array) {
		if (old instanceof Array) {
			// look for slot instead?
			var typ = new$.static;
			if (typ || old.static) {
				// if the static is not nested - we could get a hint from compiler
				// and just skip it
				if (typ == old.static) { // should also include a reference?
					for (var i = 0, items = iter$(new$), len = items.length; i < len; i++) {
						// this is where we could do the triple equal directly
						caret = reconcileNested(root,items[i],old[i],caret);
					};
					return caret;
				} else {
					removeNested(root,old,caret);
				};
				
				// if they are not the same we continue through to the default
			} else {
				// Could use optimized loop if we know that it only consists of nodes
				return reconcileCollection(root,new$,old,caret);
			};
		} else if (!oldIsNull) {
			if (old._slot_) {
				root.removeChild(old);
			} else {
				// old was a string-like object?
				root.removeChild(caret ? caret.nextSibling : root._dom.firstChild);
			};
		};
		
		return self.insertNestedAfter(root,new$,caret);
		// remove old
	} else if (!newIsNull && new$._slot_) {
		if (!oldIsNull) { removeNested(root,old,caret) };
		return self.insertNestedAfter(root,new$,caret);
	} else if (newIsNull) {
		if (!oldIsNull) { removeNested(root,old,caret) };
		return caret;
	} else {
		// if old did not exist we need to add a new directly
		var nextNode;
		// if old was array or imbatag we need to remove it and then add
		if (old instanceof Array) {
			removeNested(root,old,caret);
		} else if (old && old._slot_) {
			root.removeChild(old);
		} else if (!oldIsNull) {
			// ...
			nextNode = caret ? caret.nextSibling : root._dom.firstChild;
			if ((nextNode instanceof Text) && nextNode.textContent != new$) {
				nextNode.textContent = new$;
				return nextNode;
			};
		};
		
		// now add the textnode
		return self.insertNestedAfter(root,new$,caret);
	};
}
1184539
function updateVirtualComponent (vnode) {
  var vm = this;
  var componentId = vm.$options.componentId;
  if (vm._isMounted) {
    callHook(vm, 'beforeUpdate');
  }
  vm._vnode = vnode;
  if (vm._isMounted && componentId) {
    // TODO: data should be filtered and without bindings
    var data = Object.assign({}, vm._data);
    updateComponentData(componentId, data, function () {
      callHook(vm, 'updated');
    });
  }
}
613294
function makeReplaceVirtual(tag, ref) {
      var frag = createFragment();
      makeVirtual.call(tag, frag);
      ref.parentNode.replaceChild(frag, ref);
    }
396802
function _new (args) {
    // instantiate new instance
    var instance = new ImmutableCoreComponentInstance({
        args: args,
        component: this,
    })
    // wait for initialize promise to resolve then resolve with instance
    return instance.promise.then(() => instance)
}
79519
function newComponent (call) {
    // get clone of call and reset original
    call = resetCall(call)
    // require ImmutableCoreComponent
    assert.ok(GLOBAL.immutableCoreComponent !== undefined, 'ImmutableAI configuration error: immutableCoreComponent required')
    // get component - throws error if not found
    var component = GLOBAL.immutableCoreComponent.component(call.module)
    // return function wrapper that calls new with session
    return args => {
        // make sure args is object
        if (!defined(args)) {
            args = {}
        }
        // add session to args if not defined
        if (!defined(args.session)) {
            args.session = call.session
        }
        // create new component
        return component.new(args)
    }
}
1351513
function componentFactory(vConfig) {

		// Inherit cacheTokens from owner component if not defined in asyncHints
		if (!vConfig.asyncHints || !vConfig.asyncHints.cacheTokens) {
			var oOwnerComponent = Component.get(ManagedObject._sOwnerId);
			var mCacheTokens = oOwnerComponent && oOwnerComponent._mCacheTokens;
			if (typeof mCacheTokens === "object") {
				vConfig.asyncHints = vConfig.asyncHints || {};
				vConfig.asyncHints.cacheTokens = mCacheTokens;
			}
		}

		function createInstance(oClass) {

			// retrieve the required properties
			var sName = vConfig.name,
				sId = vConfig.id,
				oComponentData = vConfig.componentData,
				sController = sName + '.Component',
				mSettings = vConfig.settings;

			// create an instance
			var oInstance = new oClass(jQuery.extend({}, mSettings, {
				id: sId,
				componentData: oComponentData,
				_cacheTokens: vConfig.asyncHints && vConfig.asyncHints.cacheTokens
			}));
			assert(oInstance instanceof Component, "The specified component \"" + sController + "\" must be an instance of sap.ui.core.Component!");
			Log.info("Component instance Id = " + oInstance.getId());

			/*
			 * register for messaging: register if either handleValidation is set in metadata
			 * or if not set in metadata and set on instance
			 */
			var bHandleValidation = oInstance.getMetadata().handleValidation() !== undefined || vConfig.handleValidation;
			if (bHandleValidation) {
				// calculate handleValidation for registration
				if (oInstance.getMetadata().handleValidation() !== undefined) {
					bHandleValidation = oInstance.getMetadata().handleValidation();
				} else {
					bHandleValidation = vConfig.handleValidation;
				}
				sap.ui.getCore().getMessageManager().registerObject(oInstance, bHandleValidation);
			}

			// Some services may demand immediate startup
			activateServices(oInstance);

			if (typeof Component._fnOnInstanceCreated === "function") {

				// In async mode the hook can provide a promise which will be added to the promise chain
				var oPromise = Component._fnOnInstanceCreated(oInstance, vConfig);
				if (vConfig.async && oPromise instanceof Promise) {
					return oPromise.then(function() {
						// Make sure that the promise returned by the hook can not modify the resolve value
						return oInstance;
					});
				}

			}

			return oInstance;
		}

		// load the component class
		var vClassOrPromise = loadComponent(vConfig, {
			failOnError: true,
			createModels: true,
			waitFor: vConfig.asyncHints && vConfig.asyncHints.waitFor
		});
		if ( vConfig.async ) {
			// async: instantiate component after Promise has been fulfilled with component
			//        constructor and delegate the current owner id for the instance creation
			var sCurrentOwnerId = ManagedObject._sOwnerId;
			return vClassOrPromise.then(function(oClass) {
				return runWithOwner(function() {
					return createInstance(oClass);
				}, sCurrentOwnerId);
			});
		} else {
			// sync: constructor has been returned, instantiate component immediately
			return createInstance(vClassOrPromise);
		}
	}
795708
function(publicInstance, partialProps) {
    var internalInstance = getInternalInstanceReadyForUpdate(
      publicInstance,
      'setProps'
    );

    if (!internalInstance) {
      return;
    }

    ("production" !== process.env.NODE_ENV ? invariant(
      internalInstance._isTopLevel,
      'setProps(...): You called `setProps` on a ' +
      'component with a parent. This is an anti-pattern since props will ' +
      'get reactively updated when rendered. Instead, change the owner\'s ' +
      '`render` method to pass the correct value as props to the component ' +
      'where it is created.'
    ) : invariant(internalInstance._isTopLevel));

    // Merge with the pending element if it exists, otherwise with existing
    // element props.
    var element = internalInstance._pendingElement ||
                  internalInstance._currentElement;
    var props = assign({}, element.props, partialProps);
    internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
      element,
      props
    );

    enqueueUpdate(internalInstance);
  }
707489
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);

		if (!isInitialised()) {
			// Check project versions for Wcomponents-examples and WComponents match
			String egVersion = Config.getInstance().getString("wcomponents-examples.version");
			String wcVersion = WebUtilities.getProjectVersion();

			if (egVersion != null && !egVersion.equals(wcVersion)) {
				String msg = "WComponents-Examples version (" + egVersion + ") does not match WComponents version ("
						+ wcVersion + ").";

				LOG.error(msg);

				messages.addMessage(new Message(Message.ERROR_MESSAGE, msg));
			}
			setInitialised(true);
		}

	}
1181919
public void setReferences(IReferences references) throws ReferenceException {
		_dependencyResolver.setReferences(references);
        _logger.setReferences(references);
        _counters.setReferences(references);	
	}