Create a state normalizer function for a widget.
@param {String} widgetName
@param {Object} beanDef
@return {Function}
19466
function (widgetName, beanDef) {
            var states = beanDef.$properties.states;
            if (states == null) {
                return null;
            }
            var writer = new ariaUtilsFunctionWriter(["state", "stdState", "normal", "stdNormal"]);
            ariaUtilsInheritanceNormalization.writeInheritanceNormalization({
                writer : writer,
                beanDef : states.$properties.normal,
                varToNormalize : "state",
                parentVars : ["stdState", "normal", "stdNormal"],
                excludes : {
                    "frame" : true
                }
            });
            var res = writer.createFunction();
            writer.$dispose();
            return res;
        }
235241
@Override
	@SuppressWarnings({"checkstyle:methodlength", "checkstyle:cyclomaticcomplexity",
			"checkstyle:npathcomplexity", "checkstyle:booleanexpressioncomplexity"})
	protected void transform(final XtendFunction source, final JvmGenericType container, boolean allowDispatch) {
		final GenerationContext context = getContext(container);

		// Compute the operation name
		// Issue #355: null or empty name is possible.
		final String originalFunctionName = source.getName();
		if (!Strings.isNullOrEmpty(originalFunctionName)) {
			final StringBuilder sourceNameBuffer = new StringBuilder(originalFunctionName);
			if (allowDispatch && source.isDispatch()) {
				sourceNameBuffer.insert(0, "_"); //$NON-NLS-1$
			}
			final String sourceName = sourceNameBuffer.toString();

			// Create the main function
			final JvmOperation operation = this.typesFactory.createJvmOperation();
			container.getMembers().add(operation);
			operation.setSimpleName(sourceName);
			setVisibility(operation, source);
			operation.setStrictFloatingPoint(source.isStrictFloatingPoint());
			operation.setStatic(source.isStatic());
			operation.setSynchronized(source.isSynchonized());
			operation.setNative(source.isNative());
			boolean enableFunctionBody;
			if (container.isInterface()) {
				enableFunctionBody = false;
				if (context != null && context.isAtLeastJava8()
						&& !Utils.toLightweightTypeReference(container, this.services).isSubtypeOf(Capacity.class)) {
					if (operation.isStatic()) {
						enableFunctionBody = true;
					} else if (source.getExpression() != null && !operation.isAbstract()) {
						enableFunctionBody = true;
					}
				}
				operation.setDefault(enableFunctionBody && !operation.isStatic());
				operation.setAbstract(!enableFunctionBody);
				operation.setFinal(false);
			} else {
				operation.setDefault(false);
				enableFunctionBody = context != null && !source.isAbstract();
				operation.setAbstract(!enableFunctionBody);
				operation.setFinal(enableFunctionBody && source.isFinal());
			}
			this.associator.associatePrimary(source, operation);

			// Type parameters
			copyAndFixTypeParameters(source.getTypeParameters(), operation);

			// Compute the identifier of the action.
			final QualifiedActionName actionKey = this.sarlSignatureProvider.createQualifiedActionName(
					container, sourceName);

			// Compute the different action prototypes associated to the action to create.
			final boolean isVarArgs = Utils.isVarArg(source.getParameters());
			final InferredPrototype actionSignatures = this.sarlSignatureProvider.createPrototypeFromSarlModel(
					actionKey,
					isVarArgs, source.getParameters());

			// Compute the action prototype of the action without optional parameter
			final ActionPrototype actSigKey = this.sarlSignatureProvider.createActionPrototype(
					sourceName,
					actionSignatures.getFormalParameterTypes());

			// Generate the parameters
			final List<InferredStandardParameter> paramList = actionSignatures.getOriginalParameterTypes();
			translateSarlFormalParameters(
					context,
					operation, container, isVarArgs,
					source.getParameters(),
					container.isInterface(), paramList);

			// Get the super function
			final JvmOperation inheritedOperation;
			if (context != null) {
				JvmOperation tmpInheritedOperation = context.getInheritedFinalOperations().get(actSigKey);
				if (tmpInheritedOperation == null) {
					tmpInheritedOperation = context.getInheritedOverridableOperations().get(actSigKey);
				}
				if (tmpInheritedOperation == null) {
					tmpInheritedOperation = context.getInheritedOperationsToImplement().get(actSigKey);
				}
				inheritedOperation = tmpInheritedOperation;
			} else {
				inheritedOperation = null;
			}

			// Infer the return type
			final JvmTypeReference selectedReturnType = inferFunctionReturnType(source, operation, inheritedOperation);
			operation.setReturnType(selectedReturnType);

			// Exceptions
			for (final JvmTypeReference exception : source.getExceptions()) {
				operation.getExceptions().add(this.typeBuilder.cloneWithProxies(exception));
			}

			// Add the body
			if (enableFunctionBody) {
				setBody(operation, source.getExpression());
			}

			// User Annotations
			translateAnnotationsTo(source.getAnnotations(), operation);

			// Add @Inline annotation
			if (context != null && context.isAtLeastJava8()
					&& context.getGeneratorConfig2().isGenerateInlineAnnotation()
					&& !source.isAbstract() && !container.isInterface()
					&& (source.isStatic() || source.isFinal() || container.isFinal())
					&& context.getParentContext() == null
					&& this.annotationFinder.findAnnotation(operation, Inline.class) == null) {
				context.getPostFinalizationElements().add(
						() -> this.inlineExpressionCompiler.appendInlineAnnotation(operation, source));
			}

			// Add @Override annotation
			if (source.isOverride()
					&& this.annotationFinder.findAnnotation(operation, Override.class) == null
					&& this.typeReferences.findDeclaredType(Override.class, source) != null) {
				addAnnotationSafe(operation, Override.class);
			}

			// Add @Pure annotation
			final boolean addDynamicPureAnnotationGenerator;
			final boolean hasExplicitPureAnnotation = this.annotationFinder.findAnnotation(operation, Pure.class) != null;
			if (context != null && context.getGeneratorConfig2().isGeneratePureAnnotation()
					&& !hasExplicitPureAnnotation && this.typeReferences.findDeclaredType(Pure.class, source) != null) {
				addDynamicPureAnnotationGenerator = inheritedOperation == null;
				if (addDynamicPureAnnotationGenerator) {
					this.operationHelper.attachPureAnnotationAdapter(operation, (op, helper) -> {
						return helper.isPurableOperation(source);
					});
				} else {
					this.operationHelper.attachPureAnnotationAdapter(operation, (op, helper) -> {
						return helper.isPureOperation(inheritedOperation);
					});
				}
			} else {
				addDynamicPureAnnotationGenerator = false;
			}

			// Detecting if the action is an early-exit action.
			// If true, the Java code is annotated to be usable by the SARL validator.
			final List<JvmTypeReference> firedEvents;
			final boolean isEarlyExit;
			if (source instanceof SarlAction) {
				final SarlAction action = (SarlAction) source;
				firedEvents = action.getFiredEvents();
				isEarlyExit = this.earlyExitComputer.isEarlyExitOperation(action);
				if (isEarlyExit) {
					addAnnotationSafe(operation, EarlyExit.class);
				}
			} else {
				firedEvents = Collections.emptyList();
				isEarlyExit = false;
			}

			// Put the fired SARL events as Java annotations for being usable by the SARL validator.
			if (!firedEvents.isEmpty()) {
				operation.getAnnotations().add(annotationClassRef(FiredEvent.class, firedEvents));
			}

			// 1. Ensure that the Java annotations related to the default value are really present.
			//    They may be not present if the generated action is a specific version of an inherited
			//    action with default values for parameters.
			// 2. Update the two collections that describes the implemented and implementable operations.
			if (context != null) {
				final JvmOperation implementedOperation = context.getInheritedOperationsToImplement().remove(actSigKey);
				// Put the annotations that were defined in the implemented operation
				if (implementedOperation != null) {
					if (this.annotationFinder.findAnnotation(implementedOperation, DefaultValueSource.class) != null
							&& this.annotationFinder.findAnnotation(operation, DefaultValueSource.class) == null) {
						addAnnotationSafe(operation, DefaultValueSource.class);
					}
					// Reinject the @DefaultValue annotations
					final List<JvmFormalParameter> oparams = implementedOperation.getParameters();
					final List<JvmFormalParameter> cparams = operation.getParameters();
					assert oparams.size() == cparams.size();
					for (int i = 0; i < oparams.size(); ++i) {
						final JvmFormalParameter op = oparams.get(i);
						final JvmFormalParameter cp = cparams.get(i);
						final String ovalue = this.annotationUtils.findStringValue(op, DefaultValue.class);
						if (ovalue != null
								&& this.annotationFinder.findAnnotation(cp, DefaultValue.class) == null) {
							addAnnotationSafe(cp,
									DefaultValue.class,
									this.sarlSignatureProvider.qualifyDefaultValueID(
											implementedOperation.getDeclaringType().getIdentifier(),
											ovalue));
						}
					}
				}
				// Add the main operation into the list of overridable operations
				context.getInheritedOverridableOperations().put(actSigKey, operation);
			}

			copyAndCleanDocumentationTo(source, operation);

			@SuppressWarnings("checkstyle:anoninnerlength")
			final Runnable differedGeneration = () -> {
				// Generate the Java functions that correspond to the action with the parameter default values applied.
				for (final Entry<ActionParameterTypes, List<InferredStandardParameter>> otherSignature
						: actionSignatures.getInferredParameterTypes().entrySet()) {
					final ActionPrototype ak = SARLJvmModelInferrer.this.sarlSignatureProvider.createActionPrototype(
							sourceName,
							otherSignature.getKey());
					if (ak != null
							&& (context == null
							|| (!context.getInheritedFinalOperations().containsKey(ak)
									&& !context.getInheritedOverridableOperations().containsKey(ak)))) {

						// Generate the additional constructor that is invoke the main constructor previously generated.
						final JvmOperation operation2 = SARLJvmModelInferrer.this.typesFactory.createJvmOperation();
						container.getMembers().add(operation2);
						operation2.setSimpleName(operation.getSimpleName());
						operation2.setVisibility(operation.getVisibility());
						operation2.setVarArgs(operation.isVarArgs());
						operation2.setAbstract(operation.isAbstract());
						operation2.setDeprecated(operation.isDeprecated());
						operation2.setStatic(operation.isStatic());
						operation2.setFinal(!operation.isStatic() && !container.isInterface());
						operation2.setNative(false);
						operation2.setStrictFloatingPoint(false);
						operation2.setSynchronized(false);
						this.associator.associate(source, operation2);

						copyTypeParametersFromJvmOperation(operation, operation2);

						for (final JvmTypeReference exception : operation.getExceptions()) {
							operation2.getExceptions().add(SARLJvmModelInferrer.this.typeBuilder
									.cloneWithProxies(exception));
						}

						if (selectedReturnType instanceof XComputedTypeReference) {
							operation2.setReturnType(this.typeReferences.createDelegateTypeReference(selectedReturnType));
						} else {
							operation2.setReturnType(cloneWithTypeParametersAndProxies(selectedReturnType, operation2));
						}

						final List<String> args = translateSarlFormalParametersForSyntheticOperation(
								operation2, container, isVarArgs, otherSignature.getValue());

						if (context != null && context.isAtLeastJava8()) {
							operation2.setDefault(container.isInterface());
							operation2.setAbstract(false);
							setBody(operation2, it -> {
								final JvmTypeReference type = operation2.getReturnType();
								if (!SARLJvmModelInferrer.this.typeReferences.is(type, void.class)) {
									it.append("return "); //$NON-NLS-1$
								}
								it.append(sourceName);
								it.append("("); //$NON-NLS-1$
								it.append(IterableExtensions.join(args, ", ")); //$NON-NLS-1$
								it.append(");"); //$NON-NLS-1$
							});
						} else {
							operation2.setDefault(false);
							operation2.setAbstract(true);
						}

						// @Override annotation
						if (source.isOverride()
								&& SARLJvmModelInferrer.this.annotationFinder.findAnnotation(operation,
								Override.class) == null
								&& SARLJvmModelInferrer.this.typeReferences.findDeclaredType(
										Override.class, source) != null) {
							addAnnotationSafe(
									operation, Override.class);
						}

						// @DefaultValueUse annotation
						addAnnotationSafe(
								operation2, DefaultValueUse.class,
								actionSignatures.getFormalParameterTypes().toString());
						appendGeneratedAnnotation(operation2, context);

						// @EarlyExit annotation
						// If the main action is an early-exit action, the additional operation
						// is also an early-exit operation.
						if (isEarlyExit) {
							addAnnotationSafe(
									operation2, EarlyExit.class);
						}

						// @FiredEvent annotation
						// Put the fired SARL events as Java annotations for being usable by the SARL validator.
						if (!firedEvents.isEmpty()) {
							operation2.getAnnotations().add(
									annotationClassRef(FiredEvent.class, firedEvents));
						}

						// @Pure annotation
						if (addDynamicPureAnnotationGenerator) {
							this.operationHelper.attachPureAnnotationAdapter(operation2, (op, helper) -> {
								return helper.isPureOperation(operation);
							});
						} else if (hasExplicitPureAnnotation) {
							addAnnotationSafe(
									operation2, Pure.class);
						}

						// Copy the annotations from the original operations, and that are not overridden above
						for (final JvmAnnotationReference annotation : operation.getAnnotations()) {
							final String id = annotation.getAnnotation().getIdentifier();
							if (!DefaultValueSource.class.getName().equals(id)
									&& !DefaultValueUse.class.getName().equals(id)
									&& !Pure.class.getName().equals(id)
									&& !EarlyExit.class.getName().equals(id)
									&& !FiredEvent.class.getName().equals(id)
									&& !Inline.class.getName().equals(id)
									&& !Generated.class.getName().equals(id)) {
								try {
									final JvmAnnotationReference clone = SARLJvmModelInferrer.this._annotationTypesBuilder
											.annotationRef(id);
									for (final JvmAnnotationValue annotationValue : annotation.getExplicitValues()) {
										clone.getExplicitValues().add(EcoreUtil.copy(annotationValue));
									}
									operation2.getAnnotations().add(clone);
								} catch (IllegalArgumentException exception) {
									// ignore
								}
							}
						}

						// Copy and clean the documentation
						copyAndCleanDocumentationTo(operation, operation2);

						// Update the two collections that describes the implemented and implementable operations.
						if (context != null) {
							context.getInheritedOperationsToImplement().remove(ak);
							context.getInheritedOverridableOperations().put(ak, operation2);
						}
					}
				}
			};

			if (context != null) {
				context.getPreFinalizationElements().add(differedGeneration);
				context.setActionIndex(context.getActionIndex() + 1);
				context.incrementSerial(actSigKey.hashCode());
			} else {
				differedGeneration.run();
			}
		}
	}
509548
function createStateFor(context, stateName, owner) {
  let defaultState = {};
  const StateFactory = owner.factoryFor(`state:${stateName}`);

  if (!StateFactory) {
    return EmberObject.create();
  }

  const StateFactoryClass = StateFactory.class;

  if (typeof StateFactoryClass.initialState === 'function') {
    defaultState = StateFactoryClass.initialState.call(StateFactoryClass, context);
  }
  else if (StateFactoryClass.initialState) {
    throw new TypeError('initialState property must be a function');
  }

  if (EmberObject.detect(StateFactoryClass)) {
    return StateFactoryClass.create(
      owner.ownerInjection(),
      defaultState
    );
  }

  return EmberObject.create(owner.ownerInjection(), StateFactoryClass);
}
211704
function createNamedIdentFunction(
  func: AnalyzerContext => boolean
): AnalyzerContext => boolean {
  const typeDefinitionRegex = /^T([A-Z0-9]\w*)?$/;
  return function(context: AnalyzerContext): boolean {
    return (
      !typeDefinitionRegex.test(context.tokens[context.index].value) &&
      func(context)
    );
  };
}
651192
function (beanDef) {
                var typeDef = this.__baseTypes[beanDef.$type];
                this.$assert(298, typeDef != null);
                beanDef[this._MD_BUILTIN] = true;
                beanDef[this._MD_BASETYPE] = typeDef;
                var beanName = beanDef[this._MD_TYPENAME] = [this._BASE_TYPES_PACKAGE, typeDef.typeName].join('.');
                this.__processedBeans[beanName] = beanDef;
                return typeDef;
            }
264861
function normalizeEngine(fn, options) {
  if (utils.isEngine(options)) {
    return normalizeEngine(options, fn); //<= reverse args
  }

  if (!isObject(fn) && typeof fn !== 'function') {
    throw new TypeError('expected an object or function');
  }

  var engine = {};
  engine.render = fn.render || fn;
  engine.options = extend({}, options);

  if (typeof engine.render !== 'function') {
    throw new Error('expected engine to have a render method');
  }

  var keys = Object.keys(fn);
  var len = keys.length;
  var idx = -1;
  while (++idx < len) {
    var key = keys[idx];
    if (key === 'options') {
      engine.options = extend({}, engine.options, fn[key]);
      continue;
    }
    if (key === '__express' && !fn.hasOwnProperty('renderFile')) {
      engine.renderFile = fn[key];
    }
    engine[key] = fn[key];
  }
  return engine;
}
504364
private static BeanBox doCreateBeanBox(BeanBoxContext ctx, Class<?> clazz) {// NOSONAR
		BeanBox box = new BeanBox();
		box.setBeanClass(clazz);
		box.setSingleton(true);// Annotated class, default is singleton

		if (!ctx.isAllowAnnotation())
			return box;
		boolean allowSpringJsrAnno = ctx.allowSpringJsrAnnotation;

		// ========= singleton or prototype
		if (checkAnnoExist(clazz, PROTOTYPE.class))
			box.setSingleton(false);
		else if (allowSpringJsrAnno) {
			Map<String, Object> m = getAnnoAsMap(clazz, "org.springframework.context.annotation.Scope");
			if (m != null)
				for (Entry<String, Object> entry : m.entrySet())
					if ("value".equals(entry.getKey())) {
						if ("prototype".equalsIgnoreCase(String.valueOf(entry.getValue())))
							box.setSingleton(false);
						else if ("singleton".equalsIgnoreCase(String.valueOf(entry.getValue())))
							box.setSingleton(true);
						else
							BeanBoxException.throwEX("'prototype' or 'singleton' required in @Scope annotation");
					}
		}

		// ======== Class inject, if @INJECT, @PARAM put on class
		Object[] v = getInjectAnnotationAsArray(clazz, allowSpringJsrAnno);
		if (v != null) {
			box.setTarget(v[0]);
			box.setPureValue((Boolean) v[1]);
			box.setRequired((Boolean) v[2]);
		}

		// ======== AOP annotated annotations on class
		Annotation[] annos = clazz.getAnnotations();
		for (Annotation anno : annos) {
			if (anno.annotationType().isAnnotationPresent(AOP.class)) {
				Map<String, Object> annoMap = changeAnnotationValuesToMap(anno);
				Object aop = annoMap.get("value");
				String methodNameRule = (String) annoMap.get("method");// name must be method
				if (methodNameRule != null && methodNameRule.length() > 0 && aop != null)
					box.addBeanAop(aop, methodNameRule);
			}
		}

		// ========== Constructor inject
		Constructor<?>[] constrs = clazz.getConstructors();
		for (Constructor<?> constr : constrs) {
			v = getInjectAnnotationAsArray(constr, allowSpringJsrAnno);
			if (v != null) {
				box.setBeanClass(clazz);// anyway set beanClass first
				if (v[0] != null && EMPTY.class != v[0]) {// 1 parameter only
					BeanBox inject = new BeanBox();
					inject.setTarget(v[0]);
					inject.setPureValue((Boolean) v[1]);
					inject.setRequired((Boolean) v[2]);
					inject.setType(constr.getParameterTypes()[0]);
					box.setConstructor(constr);
					box.setConstructorParams(new BeanBox[] { inject });
				} else { // no or many parameter
					BeanBox[] paramInjects = getParameterInjectAsBeanBoxArray(constr, allowSpringJsrAnno);
					box.setConstructor(constr);
					box.setConstructorParams(paramInjects);
				}
			}
		}

		// =================Field inject=================
		// @INJECT annotations on fields include super class's
		for (Field f : ReflectionUtils.getSelfAndSuperClassFields(clazz)) {
			v = getInjectAnnotationAsArray(f, allowSpringJsrAnno);
			if (v != null) {
				box.checkOrCreateFieldInjects();
				BeanBox inject = new BeanBox();
				inject.setTarget(v[0]);
				inject.setPureValue((Boolean) v[1]);
				inject.setRequired((Boolean) v[2]);
				inject.setType(f.getType());
				ReflectionUtils.makeAccessible(f);
				box.getFieldInjects().put(f, inject);
			}
		}

		// @INJECT annotations on methods include super class's
		Method[] methods = ReflectionUtils.getAllDeclaredMethods(clazz); 
		for (Method m : methods) { 
			// ========== @PostConstruct and @PreDestory
			if (m.getAnnotation(POSTCONSTRUCT.class) != null || m.getAnnotation(PostConstruct.class) != null) {
				if (m.getParameterTypes().length > 0)
					BeanBoxException.throwEX("In jBeanBox, PostConstruct should have no parameter.");
				ReflectionUtils.makeAccessible(m);
				box.setPostConstruct(m);
			}
			if (m.getAnnotation(PREDESTROY.class) != null || m.getAnnotation(PreDestroy.class) != null) {
				if (m.getParameterTypes().length > 0)
					BeanBoxException.throwEX("In jBeanBox, PostConstruct should have no parameter.");
				ReflectionUtils.makeAccessible(m);
				box.setPreDestroy(m);
			}

			// ========== AOP about annotation =========
			Annotation[] mtdAnnos = m.getAnnotations();
			for (Annotation anno : mtdAnnos)
				if (anno.annotationType().isAnnotationPresent(AOP.class)) {
					Map<String, Object> annoMap = changeAnnotationValuesToMap(anno);
					Object aop = annoMap.get("value");
					if (aop != null)
						box.addMethodAop(aop, m);
				}

			// =========== method inject annotation ==============
			v = getInjectAnnotationAsArray(m, allowSpringJsrAnno);
			if (v != null) {
				ReflectionUtils.makeAccessible(m);
				BeanBox oneParam = new BeanBox();
				oneParam.setTarget(v[0]);
				oneParam.setPureValue((Boolean) v[1]);
				oneParam.setRequired((Boolean) v[2]);
				boolean haveOneParameter = v[0] != null && EMPTY.class != v[0];
				if (haveOneParameter)
					oneParam.setType(m.getParameterTypes()[0]); // set parameter type for 1 parameter
				// @INJECT or @Inject or @Autowired normal method inject
				box.checkOrCreateMethodInjects();
				if (haveOneParameter) // 1 parameter only
					box.getMethodInjects().put(m, new BeanBox[] { oneParam });
				else { // no or many parameter
					BeanBox[] paramInjects = getParameterInjectAsBeanBoxArray(m, allowSpringJsrAnno);
					box.getMethodInjects().put(m, paramInjects);
				}
			}
		}
		return box;

	}
1270854
function Widget(options) {
  this.__data = {};
  try {
    var e;
    if (typeof options === 'undefined') options = {};
    if (typeof options.innerHTML !== 'undefined' && typeof options.childNodes !== 'undefined') {
      // On passe directement un élément.
      options = {element: options};
    }
    if (typeof options.tag === 'undefined') options.tag = "div";
    if (options.element) {
      this.element(options.element);
    } else if (typeof options.id !== 'undefined') {
      e = window.document.getElementById(options.id);
      if (!e) {
        throw Error("Can't find element with id: \"" + options.id + "\"!");
      }
      this.element(e);
    } else {
      this.element(window.document.createElement(options.tag));
      this.addClass("wdg", "custom");
    }
  }
  catch (ex) {
    console.error("[widget] ", ex);
    console.error("[Widget] ", JSON.stringify(options));
    throw Error(ex);
  }
}
272017
private void beanToBean(Object providerBean, Object destBean) {
		valueProviderToBean(new BeanValueProvider(providerBean, this.copyOptions.ignoreCase, this.copyOptions.ignoreError), destBean);
	}
281043
function normalizeActions(base, input) {
  if (!input) return;
  if (!Array.isArray(input)) input = [ input ];

  return flatten(input).filter(Boolean).map(function (action) {
    return normalizeAction(base, action);
  });
}
809241
function (def) {

                // prepare error stack
                this._errors = [];

                var beans = def.$beans;
                for (var beanName in beans) {
                    if (!beans.hasOwnProperty(beanName) || beanName.indexOf(':') != -1) {
                        continue;
                    }
                    // check that keys for beans are valid
                    if (!Aria.checkJsVarName(beanName)) {
                        this._logError(this.INVALID_NAME, [beanName, this._currentBeanName]);
                    }
                    this._preprocessBean(beans[beanName], def.$package + "." + beanName, def);
                }

                // Generate fast normalization functions at the end:
                var toGenerateFastNorm = this.__toGenerateFastNorm;
                while (toGenerateFastNorm.length > 0) {
                    var beanDef = toGenerateFastNorm.shift();
                    var baseType = beanDef[this._MD_BASETYPE];

                    if (baseType.makeFastNorm) {
                        // generate fast normalizer
                        baseType.makeFastNorm(beanDef);
                    }
                }

                return this._errors;
            }
910837
function normalizeEntity(base, input) {
  if (!input) return {};

  var result = Object.assign(clone(input), {
    class: normalizeClass(input.class),
    properties: normalizeProperties(input.properties),
    entities: normalizeEntities(base, input.entities),
    links: normalizeLinks(base, input.links),
    actions: normalizeActions(base, input.actions),
    title: input.title
  });

  // strip undefined values from the result
  return filter(result, function (v) {
    return typeof v !== 'undefined';
  });
}
642584
function (args) {
        var v = args.value;
        var beanDef = args.beanDef;
        if (typeof(v) != 'number') {
            return __badTypeError(this, args);
        }
        if (typeof(beanDef.$minValue) != "undefined" && v < beanDef.$minValue) {
            return jv._logError(jv.NUMBER_RANGE, [args.value, args.path, "$minValue", beanDef.$minValue]);
        }
        if (typeof(beanDef.$maxValue) != "undefined" && v > beanDef.$maxValue) {
            return jv._logError(jv.NUMBER_RANGE, [args.value, args.path, "$maxValue", beanDef.$maxValue]);
        }
    }
416172
function normalizeProperties (properties, name) {
  // HACK
  if (!model) {
    model = require('./model')
  }

  // Allow for shorthand type declaration:
  // Check to see if the user passed in a raw type of a properties hash.
  if (properties) {
    // Raw type passed.
    // index: Type is translated to index: {type: Type}
    // Properties hash created.
    if (properties.type === undefined) {
      properties = {
        type: properties
      }

      // Properties hash passed.
      // Copy properties hash before modifying.
      // Users can pass in their own custom types to the schema and we don't want to write to that object.
      // Especially since properties.name contains the index of our field and copying that will break functionality.
    } else {
      properties = clone(properties)
    }
  }

  // Type may be an object with properties.
  // If "type.type" exists, we'll assume it's meant to be properties.
  // This means that shorthand objects can't use the "type" index.
  // If "type" is necessary, they must be wrapped in a Model.
  if (_.isObject(properties.type) && properties.type.type !== undefined) {
    _.each(properties.type, (value, key) => {
      if (properties[key] === undefined) {
        properties[key] = value
      }
    })
    properties.type = properties.type.type
  }

  // Null or undefined should be flexible and allow any value.
  if (properties.type === null || properties.type === undefined) {
    properties.type = 'any'

    // Convert object representation of type to lowercase string.
    // String is converted to 'string', Number to 'number', etc.
    // Do not convert the initialized ModelInstance to a string!
    // Check for a shorthand declaration of schema by key length.
  } else if (_.isString(properties.type.name) && properties.type.name !== 'ModelInstance' && Object.keys(properties.type).length === 0) {
    properties.type = properties.type.name
  }
  if (_.isString(properties.type)) {
    properties.type = properties.type.toLowerCase()
  }

  // index: [Type] or index: [] is translated to index: {type: Array, arrayType: Type}
  if (_.isArray(properties.type)) {
    if (_.size(properties.type)) {
      // Properties will be normalized when array is initialized.
      properties.arrayType = properties.type[0]
    }
    properties.type = 'array'
  }

  // index: {} or index: Model is translated to index: {type: Object, objectType: Type}
  if (!_.isString(properties.type)) {
    if (_.isFunction(properties.type)) {
      properties.objectType = properties.type
      properties.type = 'object'

      // if it's a function we have a ctor. if we have model name defined than it's one of ours.
      // set it as ref so we can typecase appropriately
      if (properties.objectType.modelName) {
        properties.ref = true
      }
    } else if (_.isObject(properties.type)) {
      // When {} is passed, no schema is enforced.
      if (_.size(properties.type)) {
        // Options should be inherited by sub-models.
        properties.objectType = model.compile(properties.type, this.options || {}, undefined, this.lounge)
      }
      properties.type = 'object'
    }
  }

  // Set name if passed on properties.
  // It's used to show what field an error what generated on.
  if (name) {
    properties.name = name
  }

  return properties
}
85892
function createElement (
  context,
  tag,
  data,
  children,
  normalizationType,
  alwaysNormalize
) {
  if (Array.isArray(data) || isPrimitive(data)) {
    normalizationType = children;
    children = data;
    data = undefined;
  }
  if (alwaysNormalize) { normalizationType = ALWAYS_NORMALIZE; }
  return _createElement(context, tag, data, children, normalizationType)
}
840871
function onDecoratorFactory(decoratorName, propertyName) {
    return function(eventName) {
         return function(target, name, descriptor) {
             if (!eventName) {
                 throw new Error(`The ${decoratorName} decorator requires an eventName argument`);
             }
             if (_.isFunction(target[propertyName])) {
                 throw new Error(`The ${decoratorName} decorator is not compatible with ${propertyName} as method form`);
                 return;
             }
             if (target[propertyName] && !_.has(target, propertyName)) {
                 target[propertyName] = _.clone(target[propertyName]);
             }
             if (!target[propertyName]) {
                 target[propertyName] = {};
             }
             target[propertyName][eventName] = name;
             return descriptor;
         };
     };
}
1285518
function normalizeField(input) {
  assert(input.name, 'fields must have a name');

  var ret = clone(input);

  var cls = normalizeClass(input.class);
  if (cls) ret.class = cls;

  return ret;
}