//
// Utility
//
4511
func comment(comment string) string {
	commentLines := make([]string, 0, 5)
	for _, line := range strings.Split(comment, "\n") {
		trimLine := strings.TrimLeft(line, " \t\n")
		if trimLine != "" {
			commentLines = append(commentLines, trimLine)
		}
	}
	return strings.Join(commentLines, "\n")
}
1252089
function(value, property) {
			property = (property || '').toLowerCase();
			var unitlessProps = prefs.getArray('css.unitlessProperties');
			return value.replace(/^(\-?[0-9\.]+)([a-z]*)$/, function(str, val, unit) {
				if (!unit && (val == '0' || ~unitlessProps.indexOf(property)))
					return val;
				
				if (!unit)
					return val.replace(/\.$/, '') + prefs.get(~val.indexOf('.') ? 'css.floatUnit' : 'css.intUnit');
				
				return val + getUnit(unit);
			});
		}
275256
function cdefer() {
  const maxWait = 20000
  var resolve, reject
  var promise = new Promise((...args) => {
      resolve = args[0]
      reject = args[1]
    })
    .timeout(maxWait)
  return {
    resolve: resolve,
    reject: reject,
    promise: promise
  }
}
519564
function nextup(inst, orig, argv, event, cb) {
    return function nextupCallback(err, data) {
        if (err) return cb(err, null);
        if (_isQuoted(data)) return cb(null, _unquote(data));
        if (_isValue(data)) return cb(null, _entityToValue(data, inst.library));
        // Remove any nulls or undefineds from the list
        var compact = _compactList(data);
        // Allow the programmer to opt out for _minor_ perf gains
        if (inst.options.doIrreducibleListCheck) {
            // If no change, we'll keep looping forever, so just return
            if (IsEqual(orig, compact)) {
                Console.printWarning(inst, 'Detected irreducible list; exiting...');
                return cb(null, compact);
            }
        }
        return exec(inst, compact, argv, event, cb);
    };
}
1125341
function determineIfIncluded(conn, earlier_unit, arrLaterUnits, handleResult){
	if (!earlier_unit)
		throw Error("no earlier_unit");
	if (storage.isGenesisUnit(earlier_unit))
		return handleResult(true);
	storage.readPropsOfUnits(conn, earlier_unit, arrLaterUnits, function(objEarlierUnitProps, arrLaterUnitProps){
		if (objEarlierUnitProps.is_free === 1)
			return handleResult(false);
		
		var max_later_limci = Math.max.apply(
			null, arrLaterUnitProps.map(function(objLaterUnitProps){ return objLaterUnitProps.latest_included_mc_index; }));
		//console.log("max limci "+max_later_limci+", earlier mci "+objEarlierUnitProps.main_chain_index);
		if (objEarlierUnitProps.main_chain_index !== null && max_later_limci >= objEarlierUnitProps.main_chain_index)
			return handleResult(true);
		
		var max_later_level = Math.max.apply(
			null, arrLaterUnitProps.map(function(objLaterUnitProps){ return objLaterUnitProps.level; }));
		if (max_later_level < objEarlierUnitProps.level)
			return handleResult(false);
		
		function goUp(arrStartUnits){
			//console.log('determine', earlier_unit, arrLaterUnits, arrStartUnits);
			conn.query(
				"SELECT unit, level, latest_included_mc_index, main_chain_index, is_on_main_chain \n\
				FROM parenthoods JOIN units ON parent_unit=unit \n\
				WHERE child_unit IN(?)",
				[arrStartUnits],
				function(rows){
					var arrNewStartUnits = [];
					for (var i=0; i<rows.length; i++){
						var objUnitProps = rows[i];
						if (objUnitProps.unit === earlier_unit)
							return handleResult(true);
						if (objUnitProps.is_on_main_chain === 0 && objUnitProps.level > objEarlierUnitProps.level)
							arrNewStartUnits.push(objUnitProps.unit);
					}
					(arrNewStartUnits.length > 0) ? goUp(_.uniq(arrNewStartUnits)) : handleResult(false);
				}
			);
		}
		
		goUp(arrLaterUnits);
	
	});
}
782411
function(identifier, typemap, args, error) {
		var bufArray = [ new Buffer([ module.exports.EnumExecutionCode.ExecFunction ]) ];
		bufArray.push(new Buffer(4)); // [1] = reserverd for total payload size, minus the execution code
		
		var buf = new Buffer(4);
		buf.writeUInt32LE(identifier.length);
		bufArray.push(buf);
		
		var tempBuf = new Buffer(identifier);
		bufArray.push(tempBuf);
		
		var payloadLength = 4 + identifier.length;
		for(var i = 0; i < args.length; i++) {
			var iStr = i.toString();
			var argtype = typemap[iStr];
			
			if(!argtype) {
				if(args[i] === null) {
					argtype = 'null';
				}
				else {
					switch(typeof args[i]) {
						case 'number':
							if(args[i] === (args[i]|0)) {
								argtype = 'int'; // Default to int for normal numbers
							}
							else {
								argtype = 'float'; // float for anything else
							}
							break;
						case 'string':
							argtype = 'string';
							break;
						case 'boolean':
							argtype = 'boolean';
							break;
						case 'undefined':
							argtype = 'undefined';
							break;
					}
				}
				typemap[iStr] = argtype;
			}
			
			var dataType = module.exports.EnumDataType[argtype];
			if(dataType !== undefined) {
				switch(dataType) {
					case module.exports.EnumDataType.byte:
						tempBuf = new Buffer(1);
						tempBuf.writeInt8(args[i], 0);
						break;
					case module.exports.EnumDataType.ubyte:
						tempBuf = new Buffer(1);
						tempBuf.writeUInt8(args[i], 0);
						break;
					case module.exports.EnumDataType.short:
						tempBuf = new Buffer(2);
						tempBuf.writeInt16LE(args[i], 0);
						break;
					case module.exports.EnumDataType.ushort:
						tempBuf = new Buffer(2);
						tempBuf.writeUInt16LE(args[i], 0);
						break;
					case module.exports.EnumDataType.int:
						tempBuf = new Buffer(4);
						tempBuf.writeInt32LE(args[i], 0);
						break;
					case module.exports.EnumDataType.uint:
						tempBuf = new Buffer(4);
						tempBuf.writeUInt32LE(args[i], 0);
						break;
					case module.exports.EnumDataType.float:
						tempBuf = new Buffer(4);
						tempBuf.writeFloatLE(args[i], 0);
						break;
					case module.exports.EnumDataType.double:
						tempBuf = new Buffer(8);
						tempBuf.writeDoubleLE(args[i], 0);
						break;
					case module.exports.EnumDataType.string:
						tempBuf = new Buffer(args[i]);
						break;
					case module.exports.EnumDataType.boolean:
						tempBuf = new Buffer(1);
						tempBuf.writeUInt8(args[i] ? 0x1 : 0x0, 0);
						break;
					case module.exports.EnumDataType.undefined:
					case module.exports.EnumDataType.null:
						tempBuf = new Buffer(0);
						break;
					default:
						error(new Error('Data type ' + dataType + ' has gone unhandled by client'));
						return;
				}
				var argHeader = new Buffer(5);
				argHeader.writeUInt8(dataType, 0);
				argHeader.writeUInt32LE(tempBuf.length, 1);
				bufArray.push(argHeader);
				bufArray.push(tempBuf);
				
				payloadLength += argHeader.length + tempBuf.length;
			}
			else {
				error(new Error('Unsupported data type argument passed to remote function'));
				return;
			}
		}
		
		bufArray[1].writeUInt32LE(payloadLength);
		
		return Buffer.concat(bufArray);
	}
1304852
@Override
	public Value evaluate(String line, Context ctxt) throws Exception
	{
		PExp expr = parseExpression(line, getDefaultName());
		Environment env = new ModuleEnvironment(assistantFactory, defaultModule);

		try
		{
			typeCheck(expr, env);
		} catch (VDMErrorsException e)
		{
			// We don't care... we just needed to type check it.
		}

		ctxt.threadState.init();

		try
		{
			return expr.apply(VdmRuntime.getExpressionEvaluator(), ctxt);
		} catch (Exception e)
		{
			throw e;
		}
	}
1139753
function (Type, Arr, Obj, Node, Error, console) {
    var rawSet = function (dom, key, value) {
      /*
       * JQuery coerced everything to a string, and silently did nothing on text node/null/undefined.
       *
       * We fail on those invalid cases, only allowing numbers and booleans.
       */
      if (Type.isString(value) || Type.isBoolean(value) || Type.isNumber(value)) {
        dom.setAttribute(key, value + '');
      } else {
        console.error('Invalid call to Attr.set. Key ', key, ':: Value ', value, ':: Element ', dom);
        throw new Error('Attribute value was not simple');
      }
    };

    var set = function (element, key, value) {
      rawSet(element.dom(), key, value);
    };

    var setAll = function (element, attrs) {
      var dom = element.dom();
      Obj.each(attrs, function (v, k) {
        rawSet(dom, k, v);
      });
    };

    var get = function (element, key) {
      var v = element.dom().getAttribute(key);

      // undefined is the more appropriate value for JS, and this matches JQuery
      return v === null ? undefined : v;
    };

    var has = function (element, key) {
      var dom = element.dom();

      // return false for non-element nodes, no point in throwing an error
      return dom && dom.hasAttribute ? dom.hasAttribute(key) : false;
    };

    var remove = function (element, key) {
      element.dom().removeAttribute(key);
    };

    var hasNone = function (element) {
      var attrs = element.dom().attributes;
      return attrs === undefined || attrs === null || attrs.length === 0;
    };

    var clone = function (element) {
      return Arr.foldl(element.dom().attributes, function (acc, attr) {
        acc[attr.name] = attr.value;
        return acc;
      }, {});
    };

    var transferOne = function (source, destination, attr) {
      // NOTE: We don't want to clobber any existing attributes
      if (has(source, attr) && !has(destination, attr)) set(destination, attr, get(source, attr));        
    };

    // Transfer attributes(attrs) from source to destination, unless they are already present
    var transfer = function (source, destination, attrs) {
      if (!Node.isElement(source) || !Node.isElement(destination)) return;
      Arr.each(attrs, function (attr) {
        transferOne(source, destination, attr);
      });
    };

    return {
      clone: clone,
      set: set,
      setAll: setAll,
      get: get,
      has: has,
      remove: remove,
      hasNone: hasNone,
      transfer: transfer
    };
  }
1023471
function binaryFindLarger(item, list) {
	var min = 0;
	var max = list.length - 1;
	var guess;

	var bitwise = (max <= 2147483647) ? true : false;
	if (bitwise) {
		while (min <= max) {
			guess = (min + max) >> 1;
			if (list[guess] === item) { return guess; }
			else {
				if (list[guess] < item) { min = guess + 1; }
				else { max = guess - 1; }
			}
		}
	} else {
		while (min <= max) {
			guess = Math.floor((min + max) / 2);
			if (list[guess] === item) { return guess; }
			else {
				if (list[guess] < item) { min = guess + 1; }
				else { max = guess - 1; }
			}
		}
	}

	return (min == list.length) ? null : min;

//	return -1;
}
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();
			}
		}
	}
1007627
function f_tahta_ihale_gizlenen_tumu(_tahta_id) {
        return f_tahta_ihale_gizlenen_idler(_tahta_id)
            .then(function (_ihale_idler) {
                if (_ihale_idler && _ihale_idler.length > 0) {
                    /** @type {OptionsIhale} */
                    var opts = {};
                    opts.bArrKalemleri = true;
                    opts.bYapanKurum = true;
                    opts.bTakip = true;
                    opts.optKalem.bArrTeklifleri = false;
                    opts.optKalem.bOnayDurumu = true;
                    opts.optKalem.bTakiptemi = true;
                    var db_ihale = require("./db_ihale");
                    return db_ihale.f_db_ihale_id(_ihale_idler, _tahta_id, opts);
                } else {
                    return [];
                }
            });
    }
1280089
function (mode, code, tokens, flags, scope, parseMode) {
    var index = code.index,
        length = code.length;

    if ( /* <!-- */
        code.codePointAt(index) === 0x003c &&
        code.codePointAt(++index) === 0x0021 &&
        code.codePointAt(++index) === 0x002d &&
        code.codePointAt(++index) === 0x002d
    ) {
        index++;

        for (; index < length; index++) {
            if ( /* --> */
                code.codePointAt(index) === 0x002d &&
                code.codePointAt(index + 1) === 0x002d &&
                code.codePointAt(index + 2) === 0x003e
            ) {
                index += 3;
                code.index = index;

                return true;
            }
        }

        throw code.makeError(
            code.index, code.index + 4,
            'Unclosed Comment: Expected "-->" to fallow "<!--".'
        );
    }

    return null;
}
397773
@Deprecated
    @Override
    protected int writeValueAndFinal(int i, boolean isFinal) {
        if(0<=i && i<=CharsTrie.kMaxOneUnitValue) {
            return write(i|(isFinal ? CharsTrie.kValueIsFinal : 0));
        }
        int length;
        if(i<0 || i>CharsTrie.kMaxTwoUnitValue) {
            intUnits[0]=(char)(CharsTrie.kThreeUnitValueLead);
            intUnits[1]=(char)(i>>16);
            intUnits[2]=(char)i;
            length=3;
        // } else if(i<=CharsTrie.kMaxOneUnitValue) {
        //     intUnits[0]=(char)(i);
        //     length=1;
        } else {
            intUnits[0]=(char)(CharsTrie.kMinTwoUnitValueLead+(i>>16));
            intUnits[1]=(char)i;
            length=2;
        }
        intUnits[0]=(char)(intUnits[0]|(isFinal ? CharsTrie.kValueIsFinal : 0));
        return write(intUnits, length);
    }
645606
function error () {
  if (mocking) {
    cli.stderr += stripAnsi(concatArguments(arguments) + '\n')
  } else {
    console.error.apply(null, arguments)
  }
}
1192085
function () {
            /*  determine parameters  */
            var params = $cs.params("value", arguments, {
                name:        { pos: 0, req: true,      valid: "string"   },
                value:       { pos: 1, def: undefined, valid: "any"      },
                force:       { pos: 2, def: false,     valid: "boolean"  },
                injected:    {         def: false,     valid: "boolean"  },
                op:          {         def: [],        valid: "(string|[string?]|[string,number,number])" },
                returnowner: {         def: false,     valid: "boolean"  }
            });

            /*  determine operation  */
            if (typeof params.op === "string")
                params.op = [ params.op ];
            if (params.op.length === 0)
                params.op = (_cs.isdefined(params.value) ? [ "set" ] : [ "get" ]);
            else if (!params.op[0].match(/^(?:get|set|splice|delete|push|pop|shift|unshift)$/))
                throw _cs.exception("value", "invalid operation \"" + params.op[0] + "\"");
            if (   params.op[0] === "splice"
                && (   params.op.length !== 3
                    || typeof params.op[1] !== "number"
                    || typeof params.op[2] !== "number"))
                throw _cs.exception("value", "invalid arguments for operation \"splice\"");

            /*  parse the value name into selection path segments  */
            var path = _cs.select_parse(params.name);

            /*  create new canonical name out of the parsed path segments  */
            var pathName = path.join(".");

            /*  determine component owning model with requested value  */
            var owner = null;
            var model = null;
            var comp  = this;
            while (comp !== null) {
                owner = comp.property({ name: "ComponentJS:model", returnowner: true });
                if (!_cs.isdefined(owner))
                    throw _cs.exception("value", "no model found containing value \"" + path[0] + "\"");
                model = owner.property("ComponentJS:model");
                if (_cs.isdefined(model.spec[path[0]]))
                    break;
                comp = owner.parent();
            }
            if (comp === null)
                throw _cs.exception("value", "no model found containing value \"" + path[0] + "\"");

            /*  get new model value  */
            var value_new = params.value;

            /*  translate special-case array operations to splice operation  */
            var obj;
            switch (params.op[0]) {
                case "unshift":
                    params.op = [ "splice", 0, 0 ];
                    break;
                case "shift":
                    params.op = [ "splice", 0, 1 ];
                    value_new = undefined;
                    break;
                case "push":
                    obj = $cs.select(model.data, path);
                    params.op = [ "splice", obj.length, 0 ];
                    break;
                case "pop":
                    obj = $cs.select(model.data, path);
                    params.op = [ "splice", obj.length - 1, 1 ];
                    value_new = undefined;
                    break;
            }

            /*  get old model value  */
            var ev;
            var result;
            var value_old = $cs.select(model.data, path);
            if (params.op[0] === "splice") {
                /*  splice operation is on collection itself,
                    so pick the target collection element!  */
                if (params.op[2] > 0)
                    value_old = $cs.select(value_old, "" + params.op[1]);
                else
                    value_old = undefined;
            }
            else if (params.op[0] === "get") {
                if (owner.property({ name: "ComponentJS:model:subscribers:get", def: 0, bubbling: false }) > 0) {
                    /*  send event to observers for value get and allow observers
                        to reject value get operation and/or change old value to get  */
                    ev = owner.publish({
                        name:      "ComponentJS:model:" + pathName + ":" + params.op[0],
                        args:      [ value_old, value_old, params.op, pathName ],
                        capturing: false,
                        spreading: false,
                        bubbling:  false,
                        async:     false
                    });
                    if (ev.processing()) {
                        /*  allow value to be overridden by event result  */
                        result = ev.result();
                        if (typeof result !== "undefined")
                            value_old = result;
                    }
                }
            }

            /*  optionally set/delete/splice new model value  */
            if (   (   params.op[0] === "set"
                    && (params.force || value_old !== value_new))
                || params.op[0] === "delete"
                || params.op[0] === "splice"                     ) {

                /*  check validity of new value  */
                if (   params.op[0] === "set"
                    || (   params.op[0] === "splice"
                        && value_new !== undefined  )) {
                    var subPath = (
                          params.op[0] === "splice"
                        ? path.slice(1).concat([ "0" ])
                        : path.slice(1)
                    );
                    if (!_cs.validate_at(value_new, model.spec[path[0]].valid, subPath))
                        throw _cs.exception("value", "model field \"" + params.name + "\" receives " +
                            "new value " + _cs.json(value_new) + ", which does not validate " +
                            "against \"" + model.spec[path[0]].valid + "\"" +
                            (subPath.length > 0 ? " at sub-path \"" + subPath.join(".") + "\"" : ""));
                }

                /*  send event to observers for value set/delete/splice operation
                    and allow observers to reject operation and/or change new value to set  */
                var cont = true;
                if (owner.property({ name: "ComponentJS:model:subscribers:" + params.op[0], def: 0, bubbling: false }) > 0) {
                    ev = owner.publish({
                        name:      "ComponentJS:model:" + pathName + ":" + params.op[0],
                        args:      [ value_new, value_old, params.op, pathName ],
                        capturing: false,
                        spreading: false,
                        bubbling:  false,
                        async:     false
                    });
                    if (!ev.processing()) {
                        if (params.injected)
                            throw _cs.exception("value", "model field \"" + params.name + "\" receives (again) " +
                                "value " + _cs.json(value_new) + ", which is rejected by observers, " +
                                "but the value was indicated to be already injected by third-parties " +
                                "(so it technically no longer can be rejected)");
                        cont = false;
                    }
                    else {
                        /*  allow value to be overridden  */
                        result = ev.result();
                        if (typeof result !== "undefined")
                            value_new = result;
                    }
                }
                if (cont && !model.spec[path[0]].autoreset) {
                    /*  perform destructive operation on model  */
                    if (params.op[0] === "set") {
                        /*  set value in model  */
                        $cs.select(model.data, path, value_new);
                    }
                    else if (params.op[0] === "splice") {
                        /*  splice value into model  */
                        obj = $cs.select(model.data, path);
                        if (!(obj instanceof Array))
                            throw new _cs.exception("value", "cannot splice: target object is not of Array type");
                        if (typeof value_new !== "undefined")
                            obj.splice(params.op[1], params.op[2], value_new);
                        else
                            obj.splice(params.op[1], params.op[2]);
                    }
                    else if (params.op[0] === "delete") {
                        /*  delete value from model  */
                        if (path.length < 2)
                            throw new _cs.exception("value", "cannot delete model root or top-level model entry");
                        obj = $cs.select(model.data, path.slice(0, path.length - 1));
                        var pathSegment = path[path.length - 1];
                        if (obj instanceof Array)
                            obj.splice(parseInt(pathSegment, 10), 1);
                        else if (typeof obj === "object")
                            delete obj[pathSegment];
                        else
                            throw new _cs.exception("value", "cannot delete: target object is neither Array nor Object type");
                    }

                    /*  synchronize model with underlying store  */
                    if (model.spec[path[0]].store) {
                        var store = owner.store("model");
                        store[path[0]] = model.data[path[0]];
                        owner.store("model", store);
                    }

                    /*  send event to observers after value finally changed  */
                    if (owner.property({ name: "ComponentJS:model:subscribers:changed", def: 0, bubbling: false }) > 0) {
                        owner.publish({
                            name:      "ComponentJS:model:" + pathName + ":changed",
                            args:      [ value_new, value_old, params.op, pathName ],
                            noresult:  true,
                            capturing: false,
                            spreading: false,
                            bubbling:  false,
                            async:     true
                        });
                    }
                }
            }

            /*  return old model value  */
            return (params.returnowner ? owner : value_old);
        }
1159814
function main(args) {
  var inputPaths = [];
  var outputPath;

  for (var i = 0; i < args.length; ++i) {
    if (args[i] == '--output') {
      outputPath = args[i + 1];
      ++i;
    } else {
      inputPaths.push(args[i]);
    }
  }
  console.assert(outputPath,
                 'You must specify output file with --output <EXTERNS>');
  console.assert(inputPaths.length,
                 'You must specify at least one input file.');

  // Generate externs for all input paths.
  var names = new Set();
  var results = inputPaths.map(generateExterns.bind(null, names));

  // Sort them in dependency order.
  var sorted = topologicalSort(results, /* getDeps */ function(object) {
    return object.requires.map(function(id) {
      var dep = results.find(function(x) { return x.provides.includes(id); });
      console.assert(dep, 'Cannot find dependency: ' + id);
      return dep;
    });
  });

  // Generate namespaces for all externs.  For example, if we extern foo.bar.baz,
  // foo and foo.bar will both need to be declared first.
  var namespaces = new Set();
  var namespaceDeclarations = [];
  names.forEach(function(name) {
    // Add the full name "foo.bar.baz" and its prototype ahead of time.  We should
    // never generate these as namespaces.
    namespaces.add(name);
    namespaces.add(name + '.prototype');

    // For name "foo.bar.baz", iterate over partialName "foo" and "foo.bar".
    var pieces = name.split('.');
    for (var i = 1; i < pieces.length; ++i) {
      var partialName = pieces.slice(0, i).join('.');
      if (!namespaces.has(partialName)) {
        var declaration;
        if (i == 1) {
          declaration = '/** @namespace */\n';
          declaration += 'window.';
        } else {
          declaration = '/** @const */\n';
        }
        declaration += partialName + ' = {};\n';
        namespaceDeclarations.push(declaration);
        namespaces.add(partialName);
      }
    }
  });

  // Get externs.
  var externs = sorted.map(function(x) { return x.externs; }).join('');

  // Output generated externs, with an appropriate header.
  fs.writeFileSync(outputPath,
      '/**\n' +
      ' * @fileoverview Generated externs.  DO NOT EDIT!\n' +
      ' * @externs\n' +
      ' * @suppress {duplicate} To prevent compiler errors with the namespace\n' +
      ' *   being declared both here and by goog.provide in the library.\n' +
      ' */\n\n' +
      namespaceDeclarations.join('') + '\n' + externs);
}
87190
function minify( file, options, done ){
		if (_.isFunction(options)){
			done = options;
			options = {};
		}
		if (!_.isObject(options))
			options = {};
		if (!_.isFunction(done))
			done = function(){};

		const canOptimize = options.optimize;
		delete options.optimize;

		console.log("  minify file %s...".grey, file);
		try {
			var code   = fs.readFileSync( file, {encoding: 'utf8'} );
			var minify = UglifyJS.minify( code, options );
		} catch (e) {
			return done(  new Error(`Error on parse file ${e.filename}`) );
		}

		if ( !minify || minify.error ) {
			if ( minify && minify.error )
				return done( new Error(minify.error.message) );
			return done(new Error('Minify error bundle.js') );
		}

		try{
			if ( canOptimize ){
				console.log("  optimize file %s...".grey, file );
				code = optimizeJs(minify.code);
			}else{
				code = minify.code;
			}
		}catch(e){
			console.error("Error on parse file %s", e.filename);
			return next(e);
		}

		fs.writeFile(
			file,
			code,
			function (err) {
				if ( err )
					return done(err);


				return done();
			}
		);
	}