/*-------------------------------------------------[ Helpers ]---------------------------------------------------
490882
public static List<Range> union(List<Range> ranges){
        ranges = new ArrayList<Range>(ranges);
        Collections.sort(ranges, new Comparator<Range>(){
            @Override
            public int compare(Range r1, Range r2){
                return r1.min-r2.min;
            }
        });
        List<Range> union = new ArrayList<Range>();
        for(Range r: ranges){
            if(union.isEmpty())
                union.add(r);
            else
                CollectionUtil.addAll(union, union.remove(union.size() - 1).union(r));
        }
        return union;
    }
1077326
function(dfd, opts, parent, pathSegList) {
			var deferredList,
				i,
				key,
				node,
				remainMap,
				tmpParent,
				segList,
				subDfd,
				self = this;

			function __findChild(parent, key) {
				// console.log("__findChild", key, parent);
				var i,
					l,
					cl = parent.children;

				if (cl) {
					for (i = 0, l = cl.length; i < l; i++) {
						if (opts.matchKey(cl[i], key)) {
							return cl[i];
						}
					}
				}
				return null;
			}

			// console.log("_loadKeyPathImpl, parent=", parent, ", pathSegList=", pathSegList);

			// Pass 1:
			// Handle all path segments for nodes that are already loaded.
			// Collect distinct top-most lazy nodes in a map.
			// Note that we can use node.key to de-dupe entries, even if a custom matcher would
			// look for other node attributes.
			// map[node.key] => {node: node, pathList: [list of remaining rest-paths]}
			remainMap = {};

			for (i = 0; i < pathSegList.length; i++) {
				segList = pathSegList[i];
				// target = targetList[i];

				// Traverse and pop path segments (i.e. keys), until we hit a lazy, unloaded node
				tmpParent = parent;
				while (segList.length) {
					key = segList.shift();
					node = __findChild(tmpParent, key);
					if (!node) {
						this.warn(
							"loadKeyPath: key not found: " +
								key +
								" (parent: " +
								tmpParent +
								")"
						);
						opts.callback(this, key, "error");
						break;
					} else if (segList.length === 0) {
						opts.callback(this, node, "ok");
						break;
					} else if (!node.lazy || node.hasChildren() !== undefined) {
						opts.callback(this, node, "loaded");
						tmpParent = node;
					} else {
						opts.callback(this, node, "loaded");
						key = node.key; //target.segList.join(sep);
						if (remainMap[key]) {
							remainMap[key].pathSegList.push(segList);
						} else {
							remainMap[key] = {
								parent: node,
								pathSegList: [segList],
							};
						}
						break;
					}
				}
			}
			// console.log("_loadKeyPathImpl AFTER pass 1, remainMap=", remainMap);

			// Now load all lazy nodes and continue iteration for remaining paths
			deferredList = [];

			// Avoid jshint warning 'Don't make functions within a loop.':
			function __lazyload(dfd, parent, pathSegList) {
				// console.log("__lazyload", parent, "pathSegList=", pathSegList);
				opts.callback(self, parent, "loading");
				parent
					.load()
					.done(function() {
						self._loadKeyPathImpl
							.call(self, dfd, opts, parent, pathSegList)
							.always(_makeResolveFunc(dfd, self));
					})
					.fail(function(errMsg) {
						self.warn("loadKeyPath: error loading lazy " + parent);
						opts.callback(self, node, "error");
						dfd.rejectWith(self);
					});
			}
			// remainMap contains parent nodes, each with a list of relative sub-paths.
			// We start loading all of them now, and pass the the list to each loader.
			for (var nodeKey in remainMap) {
				var remain = remainMap[nodeKey];
				// console.log("for(): remain=", remain, "remainMap=", remainMap);
				// key = remain.segList.shift();
				// node = __findChild(remain.parent, key);
				// if (node == null) {  // #576
				// 	// Issue #576, refactored for v2.27:
				// 	// The root cause was, that sometimes the wrong parent was used here
				// 	// to find the next segment.
				// 	// Falling back to getNodeByKey() was a hack that no longer works if a custom
				// 	// matcher is used, because we cannot assume that a single segment-key is unique
				// 	// throughout the tree.
				// 	self.error("loadKeyPath: error loading child by key '" + key + "' (parent: " + target.parent + ")", target);
				// 	// 	node = self.getNodeByKey(key);
				// 	continue;
				// }
				subDfd = new $.Deferred();
				deferredList.push(subDfd);
				__lazyload(subDfd, remain.parent, remain.pathSegList);
			}
			// Return a promise that is resolved, when ALL paths were loaded
			return $.when.apply($, deferredList).promise();
		}
1243692
function () {
                // Simple things first
                if(this._from.substr(this._at, 4) === 'null') {
                    this._at += 4;
                    return null;
                } else if(this._from.substr(this._at, 9) === 'undefined') {
                    this._at += 9;
                    return undefined;
                } else if(this._from.substr(this._at, 4) === 'true') {
                    this._at += 4;
                    return true;
                } else if(this._from.substr(this._at, 5) === 'false') {
                    this._at += 5;
                    return false;
                } else if(this._from.substr(this._at, 3) === 'NaN') {
                    this._at += 3;
                    return NaN;
                } else if(this._from.substr(this._at, 8) === 'Infinity') {
                    this._at += 8;
                    return Infinity;
                } else if(this._from.substr(this._at, 9) === '-Infinity') {
                    this._at += 9;
                    return -Infinity;
                }
                // JSON escaped string?
                if(this._from.charAt(this._at) === '"') {
                    var end = this._at + 1;
                    while(end < this._from.length) {
                        if(this._from.charAt(end) === '\\') {
                            end += 1;
                        } else if(this._from.charAt(end) === '"') {
                            break;
                        }
                        end += 1;
                    }
                    if(end < this._from.length) {
                        var s = this._from.substr(this._at, end - this._at + 1);
                        this._at = end + 1;
                        return JSON.parse(s);
                    }
                }
                // Reference?
                if(this._from.charAt(this._at) === '<' && this._from.charAt(this._at + 1 + shared.utils.uidStringLength) === '>') {
                    var id = this._from.substr(this._at + 1, shared.utils.uidStringLength);
                    this._at += (2 + shared.utils.uidStringLength);
                    return new Reference(shared.utils.makeUID(id));
                }
                // Maybe a number
                var l = this.numberLength();
                if(l) {
                    var n = parseFloat(this._from.substr(this._at));
                    shared.utils.dassert(!isNaN(n));
                    this._at += l;
                    return n;
                }
                shared.utils.defaultLogger().fatal('Unexpected value encoding: %s', this._from.substr(this._at));
            }
761504
function (node) {
        var parent = node.parentNode;
        while (parent) {
            if (parent === this) {
                return true;
            }
            parent = parent.parentNode;
        }
        return false;
    }
986011
function() {
			var lines = this._options.callbacks.beforeBody.apply(this, arguments);
			return helpers.isArray(lines) ? lines : lines !== undefined ? [lines] : [];
		}
291882
def helper_exist?(helper)
			Object.const_defined?(helper) && 
			Object.const_get(helper).instance_of?(::Module)
		end
512418
function Comment() {
    this.type = 'func'; //func or attr

    this.descs = [];
    this.attr = {
        name: null
    };
    this.func = {
        name: null,
        params: null
    };

    this.clazz = null; //class
    this.zuper = null; //super
    this.tags = {
        /*
        name:[val1,val2]
    */
    };
}
497079
function (aNode, sourceBuffer, owner) {

        // output main if
        var ifDirective = aNode.directives['if']; // eslint-disable-line dot-notation
        sourceBuffer.addRaw('if (' + compileExprSource.expr(ifDirective.value) + ') {');
        sourceBuffer.addRaw(
            aNodeCompiler.compile(
                aNode.ifRinsed,
                sourceBuffer,
                owner
            )
        );
        sourceBuffer.addRaw('}');

        // output elif and else
        each(aNode.elses, function (elseANode) {
            var elifDirective = elseANode.directives.elif;
            if (elifDirective) {
                sourceBuffer.addRaw('else if (' + compileExprSource.expr(elifDirective.value) + ') {');
            }
            else {
                sourceBuffer.addRaw('else {');
            }

            sourceBuffer.addRaw(
                aNodeCompiler.compile(
                    elseANode,
                    sourceBuffer,
                    owner
                )
            );
            sourceBuffer.addRaw('}');
        });
    }
467766
function (selector) {
        var match = this.match;

        function compileNameFilter(name) {
          if (name) {
            name = name.toLowerCase();

            return function (item) {
              return name === '*' || item.type === name;
            };
          }
        }

        function compileIdFilter(id) {
          if (id) {
            return function (item) {
              return item._name === id;
            };
          }
        }

        function compileClassesFilter(classes) {
          if (classes) {
            classes = classes.split('.');

            return function (item) {
              var i = classes.length;

              while (i--) {
                if (!item.classes.contains(classes[i])) {
                  return false;
                }
              }

              return true;
            };
          }
        }

        function compileAttrFilter(name, cmp, check) {
          if (name) {
            return function (item) {
              var value = item[name] ? item[name]() : '';

              return !cmp ? !!check :
                cmp === "=" ? value === check :
                  cmp === "*=" ? value.indexOf(check) >= 0 :
                    cmp === "~=" ? (" " + value + " ").indexOf(" " + check + " ") >= 0 :
                      cmp === "!=" ? value != check :
                        cmp === "^=" ? value.indexOf(check) === 0 :
                          cmp === "$=" ? value.substr(value.length - check.length) === check :
                            false;
            };
          }
        }

        function compilePsuedoFilter(name) {
          var notSelectors;

          if (name) {
            name = /(?:not\((.+)\))|(.+)/i.exec(name);

            if (!name[1]) {
              name = name[2];

              return function (item, index, length) {
                return name === 'first' ? index === 0 :
                  name === 'last' ? index === length - 1 :
                    name === 'even' ? index % 2 === 0 :
                      name === 'odd' ? index % 2 === 1 :
                        item[name] ? item[name]() :
                          false;
              };
            }

            // Compile not expression
            notSelectors = parseChunks(name[1], []);

            return function (item) {
              return !match(item, notSelectors);
            };
          }
        }

        function compile(selector, filters, direct) {
          var parts;

          function add(filter) {
            if (filter) {
              filters.push(filter);
            }
          }

          // Parse expression into parts
          parts = expression.exec(selector.replace(whiteSpace, ''));

          add(compileNameFilter(parts[1]));
          add(compileIdFilter(parts[2]));
          add(compileClassesFilter(parts[3]));
          add(compileAttrFilter(parts[4], parts[5], parts[6]));
          add(compilePsuedoFilter(parts[7]));

          // Mark the filter with pseudo for performance
          filters.pseudo = !!parts[7];
          filters.direct = direct;

          return filters;
        }

        // Parser logic based on Sizzle by John Resig
        function parseChunks(selector, selectors) {
          var parts = [], extra, matches, i;

          do {
            chunker.exec("");
            matches = chunker.exec(selector);

            if (matches) {
              selector = matches[3];
              parts.push(matches[1]);

              if (matches[2]) {
                extra = matches[3];
                break;
              }
            }
          } while (matches);

          if (extra) {
            parseChunks(extra, selectors);
          }

          selector = [];
          for (i = 0; i < parts.length; i++) {
            if (parts[i] != '>') {
              selector.push(compile(parts[i], [], parts[i - 1] === '>'));
            }
          }

          selectors.push(selector);

          return selectors;
        }

        this._selectors = parseChunks(selector, []);
      }
1027608
function (f) {
    var self = this;

    if (typeof f !== 'function')
      throw new Error("onInvalidate requires a function");

    if (self.invalidated) {
      Deps.nonreactive(function () {
        callWithNoYieldsAllowed(f, self);
      });
    } else {
      self._onInvalidateCallbacks.push(f);
    }
  }
317074
function runtime(helpers, context, templateFunction) {
  return guard(templateFunction(helpers, context, guard, iter, helper)).toString();
}
685592
function (parser, compiler, actions, scope, state) {
	this.state    = state || {};
	this.scope    = scope;
	this.parser   = parser;
	this.actions  = actions;
	this.compiler = compiler;
}
1185067
function () {
                    var elements = [], e, c, argsSemiColon = [], argsComma = [], args, delim, arg, nameLoop, expressions, isSemiColonSeperated, expressionContainsNamed, index = i, s = input.charAt(i), name, value, important = false;

                    if (s !== '.' && s !== '#') { return }
                    
                    save(); // stop us absorbing part of an invalid selector

                    while (e = $(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)) {
                        elements.push(new(tree.Element)(c, e, i));
                        c = $('>');
                    }
                    if ($('(')) {
                        expressions = [];
                        while (arg = $(this.expression)) {
                            nameLoop = null;
                            value = arg;

                            // Variable
                            if (arg.value.length == 1) {
                                var val = arg.value[0];
                                if (val instanceof tree.Variable) {
                                    if ($(':')) {
                                        if (expressions.length > 0) {
                                            if (isSemiColonSeperated) {
                                                error("Cannot mix ; and , as delimiter types");
                                            }
                                            expressionContainsNamed = true;
                                        }
                                        value = expect(this.expression);
                                        nameLoop = (name = val.name);
                                    }
                                }
                            }
                            
                            expressions.push(value);
                            
                            argsComma.push({ name: nameLoop, value: value });
                            
                            if ($(',')) {
                                continue;
                            }
                            
                            if ($(';') || isSemiColonSeperated) {
                            
                                if (expressionContainsNamed) {
                                    error("Cannot mix ; and , as delimiter types");
                                }
                            
                                isSemiColonSeperated = true;
                                                        
                                if (expressions.length > 1) {
                                    value = new(tree.Value)(expressions);
                                }
                                argsSemiColon.push({ name: name, value: value });
                            
                                name = null;
                                expressions = [];
                                expressionContainsNamed = false;
                            }
                        }

                        expect(')');
                    }

                    args = isSemiColonSeperated ? argsSemiColon : argsComma;

                    if ($(this.important)) {
                        important = true;
                    }

                    if (elements.length > 0 && ($(';') || peek('}'))) {
                        return new(tree.mixin.Call)(elements, args, index, env.filename, important);
                    }
                    
                    restore();
                }
1105960
function (collection, element, settings) {
            if (settings.children) {
                $.each(settings.children, function (index, childrenSettings) {
                    if (!childrenSettings.selector) {
                        console.log("jquery.collection.js: given collection " + collection.attr('id') + " has children collections, but children's root selector is undefined.");
                        return true;
                    }
                    if (element !== null) {
                        element.find(childrenSettings.selector).collection(childrenSettings);
                    } else {
                        collection.find(childrenSettings.selector).collection(childrenSettings);
                    }
                });
            }
        }
905207
function Helpers(options) {
  this.config = {};

  for (var key in options || {}) {
    this.config[key] = options[key];
  }

  this.ancestor = [];
}
595089
function (str, options, cb) {
    var tmpl = this.cache(options) || this.cache(options, this.engine.compile(str, options));
    tmpl.eval(options, function(str){
      cb(null, str);
    });
  }
304324
function(i) {
            return {
                left: this.getHelperTargetX() + (this.settings.helperSpacingX * i),
                top: this.getHelperTargetY() + (this.settings.helperSpacingY * i)
            };
        }