Skip to content

Instantly share code, notes, and snippets.

@shaunlebron
Created Feb 2, 2015
Embed
What would you like to do?
cuttle patched main.js for issue #74
This file has been truncated, but you can view the full file.
if(typeof Math.imul == "undefined" || (Math.imul(0xffffffff,5) == 0)) {
Math.imul = function (a, b) {
var ah = (a >>> 16) & 0xffff;
var al = a & 0xffff;
var bh = (b >>> 16) & 0xffff;
var bl = b & 0xffff;
// the shift by 0 fixes the sign on the high part
// the final |0 converts the unsigned value into a signed value
return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0)|0);
}
}
var CLOSURE_NO_DEPS = true;
var COMPILED = false;
var goog = goog || {};
goog.global = this;
goog.global.CLOSURE_UNCOMPILED_DEFINES;
goog.global.CLOSURE_DEFINES;
goog.isDef = function(val) {
return val !== void 0;
};
goog.exportPath_ = function(name, opt_object, opt_objectToExportTo) {
var parts = name.split(".");
var cur = opt_objectToExportTo || goog.global;
if (!(parts[0] in cur) && cur.execScript) {
cur.execScript("var " + parts[0]);
}
for (var part;parts.length && (part = parts.shift());) {
if (!parts.length && goog.isDef(opt_object)) {
cur[part] = opt_object;
} else {
if (cur[part]) {
cur = cur[part];
} else {
cur = cur[part] = {};
}
}
}
};
goog.define = function(name, defaultValue) {
var value = defaultValue;
if (!COMPILED) {
if (goog.global.CLOSURE_UNCOMPILED_DEFINES && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_UNCOMPILED_DEFINES, name)) {
value = goog.global.CLOSURE_UNCOMPILED_DEFINES[name];
} else {
if (goog.global.CLOSURE_DEFINES && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES, name)) {
value = goog.global.CLOSURE_DEFINES[name];
}
}
}
goog.exportPath_(name, value);
};
goog.DEBUG = true;
goog.define("goog.LOCALE", "en");
goog.define("goog.TRUSTED_SITE", true);
goog.define("goog.STRICT_MODE_COMPATIBLE", false);
goog.provide = function(name) {
if (!COMPILED) {
if (goog.isProvided_(name)) {
throw Error('Namespace "' + name + '" already declared.');
}
delete goog.implicitNamespaces_[name];
var namespace = name;
while (namespace = namespace.substring(0, namespace.lastIndexOf("."))) {
if (goog.getObjectByName(namespace)) {
break;
}
goog.implicitNamespaces_[namespace] = true;
}
}
goog.exportPath_(name);
};
goog.setTestOnly = function(opt_message) {
if (COMPILED && !goog.DEBUG) {
opt_message = opt_message || "";
throw Error("Importing test-only code into non-debug environment" + (opt_message ? ": " + opt_message : "."));
}
};
goog.forwardDeclare = function(name) {
};
if (!COMPILED) {
goog.isProvided_ = function(name) {
return!goog.implicitNamespaces_[name] && goog.isDefAndNotNull(goog.getObjectByName(name));
};
goog.implicitNamespaces_ = {};
}
goog.getObjectByName = function(name, opt_obj) {
var parts = name.split(".");
var cur = opt_obj || goog.global;
for (var part;part = parts.shift();) {
if (goog.isDefAndNotNull(cur[part])) {
cur = cur[part];
} else {
return null;
}
}
return cur;
};
goog.globalize = function(obj, opt_global) {
var global = opt_global || goog.global;
for (var x in obj) {
global[x] = obj[x];
}
};
goog.addDependency = function(relPath, provides, requires) {
if (goog.DEPENDENCIES_ENABLED) {
var provide, require;
var path = relPath.replace(/\\/g, "/");
var deps = goog.dependencies_;
for (var i = 0;provide = provides[i];i++) {
deps.nameToPath[provide] = path;
if (!(path in deps.pathToNames)) {
deps.pathToNames[path] = {};
}
deps.pathToNames[path][provide] = true;
}
for (var j = 0;require = requires[j];j++) {
if (!(path in deps.requires)) {
deps.requires[path] = {};
}
deps.requires[path][require] = true;
}
}
};
goog.define("goog.ENABLE_DEBUG_LOADER", true);
goog.require = function(name) {
if (!COMPILED) {
if (goog.isProvided_(name)) {
return;
}
if (goog.ENABLE_DEBUG_LOADER) {
var path = goog.getPathFromDeps_(name);
if (path) {
goog.included_[path] = true;
goog.writeScripts_();
return;
}
}
var errorMessage = "goog.require could not find: " + name;
if (goog.global.console) {
goog.global.console["error"](errorMessage);
}
throw Error(errorMessage);
}
};
goog.basePath = "";
goog.global.CLOSURE_BASE_PATH;
goog.global.CLOSURE_NO_DEPS;
goog.global.CLOSURE_IMPORT_SCRIPT;
goog.nullFunction = function() {
};
goog.identityFunction = function(opt_returnValue, var_args) {
return opt_returnValue;
};
goog.abstractMethod = function() {
throw Error("unimplemented abstract method");
};
goog.addSingletonGetter = function(ctor) {
ctor.getInstance = function() {
if (ctor.instance_) {
return ctor.instance_;
}
if (goog.DEBUG) {
goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = ctor;
}
return ctor.instance_ = new ctor;
};
};
goog.instantiatedSingletons_ = [];
goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER;
if (goog.DEPENDENCIES_ENABLED) {
goog.included_ = {};
goog.dependencies_ = {pathToNames:{}, nameToPath:{}, requires:{}, visited:{}, written:{}};
goog.inHtmlDocument_ = function() {
var doc = goog.global.document;
return typeof doc != "undefined" && "write" in doc;
};
goog.findBasePath_ = function() {
if (goog.global.CLOSURE_BASE_PATH) {
goog.basePath = goog.global.CLOSURE_BASE_PATH;
return;
} else {
if (!goog.inHtmlDocument_()) {
return;
}
}
var doc = goog.global.document;
var scripts = doc.getElementsByTagName("script");
for (var i = scripts.length - 1;i >= 0;--i) {
var src = scripts[i].src;
var qmark = src.lastIndexOf("?");
var l = qmark == -1 ? src.length : qmark;
if (src.substr(l - 7, 7) == "base.js") {
goog.basePath = src.substr(0, l - 7);
return;
}
}
};
goog.importScript_ = function(src) {
var importScript = goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_;
if (!goog.dependencies_.written[src] && importScript(src)) {
goog.dependencies_.written[src] = true;
}
};
goog.writeScriptTag_ = function(src) {
if (goog.inHtmlDocument_()) {
var doc = goog.global.document;
if (doc.readyState == "complete") {
var isDeps = /\bdeps.js$/.test(src);
if (isDeps) {
return false;
} else {
throw Error('Cannot write "' + src + '" after document load');
}
}
doc.write('\x3cscript type\x3d"text/javascript" src\x3d"' + src + '"\x3e\x3c/' + "script\x3e");
return true;
} else {
return false;
}
};
goog.writeScripts_ = function() {
var scripts = [];
var seenScript = {};
var deps = goog.dependencies_;
function visitNode(path) {
if (path in deps.written) {
return;
}
if (path in deps.visited) {
if (!(path in seenScript)) {
seenScript[path] = true;
scripts.push(path);
}
return;
}
deps.visited[path] = true;
if (path in deps.requires) {
for (var requireName in deps.requires[path]) {
if (!goog.isProvided_(requireName)) {
if (requireName in deps.nameToPath) {
visitNode(deps.nameToPath[requireName]);
} else {
throw Error("Undefined nameToPath for " + requireName);
}
}
}
}
if (!(path in seenScript)) {
seenScript[path] = true;
scripts.push(path);
}
}
for (var path in goog.included_) {
if (!deps.written[path]) {
visitNode(path);
}
}
for (var i = 0;i < scripts.length;i++) {
if (scripts[i]) {
goog.importScript_(goog.basePath + scripts[i]);
} else {
throw Error("Undefined script input");
}
}
};
goog.getPathFromDeps_ = function(rule) {
if (rule in goog.dependencies_.nameToPath) {
return goog.dependencies_.nameToPath[rule];
} else {
return null;
}
};
goog.findBasePath_();
if (!goog.global.CLOSURE_NO_DEPS) {
goog.importScript_(goog.basePath + "deps.js");
}
}
goog.typeOf = function(value) {
var s = typeof value;
if (s == "object") {
if (value) {
if (value instanceof Array) {
return "array";
} else {
if (value instanceof Object) {
return s;
}
}
var className = Object.prototype.toString.call((value));
if (className == "[object Window]") {
return "object";
}
if (className == "[object Array]" || typeof value.length == "number" && typeof value.splice != "undefined" && typeof value.propertyIsEnumerable != "undefined" && !value.propertyIsEnumerable("splice")) {
return "array";
}
if (className == "[object Function]" || typeof value.call != "undefined" && typeof value.propertyIsEnumerable != "undefined" && !value.propertyIsEnumerable("call")) {
return "function";
}
} else {
return "null";
}
} else {
if (s == "function" && typeof value.call == "undefined") {
return "object";
}
}
return s;
};
goog.isNull = function(val) {
return val === null;
};
goog.isDefAndNotNull = function(val) {
return val != null;
};
goog.isArray = function(val) {
return goog.typeOf(val) == "array";
};
goog.isArrayLike = function(val) {
var type = goog.typeOf(val);
return type == "array" || type == "object" && typeof val.length == "number";
};
goog.isDateLike = function(val) {
return goog.isObject(val) && typeof val.getFullYear == "function";
};
goog.isString = function(val) {
return typeof val == "string";
};
goog.isBoolean = function(val) {
return typeof val == "boolean";
};
goog.isNumber = function(val) {
return typeof val == "number";
};
goog.isFunction = function(val) {
return goog.typeOf(val) == "function";
};
goog.isObject = function(val) {
var type = typeof val;
return type == "object" && val != null || type == "function";
};
goog.getUid = function(obj) {
return obj[goog.UID_PROPERTY_] || (obj[goog.UID_PROPERTY_] = ++goog.uidCounter_);
};
goog.hasUid = function(obj) {
return!!obj[goog.UID_PROPERTY_];
};
goog.removeUid = function(obj) {
if ("removeAttribute" in obj) {
obj.removeAttribute(goog.UID_PROPERTY_);
}
try {
delete obj[goog.UID_PROPERTY_];
} catch (ex) {
}
};
goog.UID_PROPERTY_ = "closure_uid_" + (Math.random() * 1E9 >>> 0);
goog.uidCounter_ = 0;
goog.getHashCode = goog.getUid;
goog.removeHashCode = goog.removeUid;
goog.cloneObject = function(obj) {
var type = goog.typeOf(obj);
if (type == "object" || type == "array") {
if (obj.clone) {
return obj.clone();
}
var clone = type == "array" ? [] : {};
for (var key in obj) {
clone[key] = goog.cloneObject(obj[key]);
}
return clone;
}
return obj;
};
goog.bindNative_ = function(fn, selfObj, var_args) {
return(fn.call.apply(fn.bind, arguments));
};
goog.bindJs_ = function(fn, selfObj, var_args) {
if (!fn) {
throw new Error;
}
if (arguments.length > 2) {
var boundArgs = Array.prototype.slice.call(arguments, 2);
return function() {
var newArgs = Array.prototype.slice.call(arguments);
Array.prototype.unshift.apply(newArgs, boundArgs);
return fn.apply(selfObj, newArgs);
};
} else {
return function() {
return fn.apply(selfObj, arguments);
};
}
};
goog.bind = function(fn, selfObj, var_args) {
if (Function.prototype.bind && Function.prototype.bind.toString().indexOf("native code") != -1) {
goog.bind = goog.bindNative_;
} else {
goog.bind = goog.bindJs_;
}
return goog.bind.apply(null, arguments);
};
goog.partial = function(fn, var_args) {
var args = Array.prototype.slice.call(arguments, 1);
return function() {
var newArgs = args.slice();
newArgs.push.apply(newArgs, arguments);
return fn.apply(this, newArgs);
};
};
goog.mixin = function(target, source) {
for (var x in source) {
target[x] = source[x];
}
};
goog.now = goog.TRUSTED_SITE && Date.now || function() {
return+new Date;
};
goog.globalEval = function(script) {
if (goog.global.execScript) {
goog.global.execScript(script, "JavaScript");
} else {
if (goog.global.eval) {
if (goog.evalWorksForGlobals_ == null) {
goog.global.eval("var _et_ \x3d 1;");
if (typeof goog.global["_et_"] != "undefined") {
delete goog.global["_et_"];
goog.evalWorksForGlobals_ = true;
} else {
goog.evalWorksForGlobals_ = false;
}
}
if (goog.evalWorksForGlobals_) {
goog.global.eval(script);
} else {
var doc = goog.global.document;
var scriptElt = doc.createElement("script");
scriptElt.type = "text/javascript";
scriptElt.defer = false;
scriptElt.appendChild(doc.createTextNode(script));
doc.body.appendChild(scriptElt);
doc.body.removeChild(scriptElt);
}
} else {
throw Error("goog.globalEval not available");
}
}
};
goog.evalWorksForGlobals_ = null;
goog.cssNameMapping_;
goog.cssNameMappingStyle_;
goog.getCssName = function(className, opt_modifier) {
var getMapping = function(cssName) {
return goog.cssNameMapping_[cssName] || cssName;
};
var renameByParts = function(cssName) {
var parts = cssName.split("-");
var mapped = [];
for (var i = 0;i < parts.length;i++) {
mapped.push(getMapping(parts[i]));
}
return mapped.join("-");
};
var rename;
if (goog.cssNameMapping_) {
rename = goog.cssNameMappingStyle_ == "BY_WHOLE" ? getMapping : renameByParts;
} else {
rename = function(a) {
return a;
};
}
if (opt_modifier) {
return className + "-" + rename(opt_modifier);
} else {
return rename(className);
}
};
goog.setCssNameMapping = function(mapping, opt_style) {
goog.cssNameMapping_ = mapping;
goog.cssNameMappingStyle_ = opt_style;
};
goog.global.CLOSURE_CSS_NAME_MAPPING;
if (!COMPILED && goog.global.CLOSURE_CSS_NAME_MAPPING) {
goog.cssNameMapping_ = goog.global.CLOSURE_CSS_NAME_MAPPING;
}
goog.getMsg = function(str, opt_values) {
if (opt_values) {
str = str.replace(/\{\$([^}]+)}/g, function(match, key) {
return key in opt_values ? opt_values[key] : match;
});
}
return str;
};
goog.getMsgWithFallback = function(a, b) {
return a;
};
goog.exportSymbol = function(publicPath, object, opt_objectToExportTo) {
goog.exportPath_(publicPath, object, opt_objectToExportTo);
};
goog.exportProperty = function(object, publicName, symbol) {
object[publicName] = symbol;
};
goog.inherits = function(childCtor, parentCtor) {
function tempCtor() {
}
tempCtor.prototype = parentCtor.prototype;
childCtor.superClass_ = parentCtor.prototype;
childCtor.prototype = new tempCtor;
childCtor.prototype.constructor = childCtor;
childCtor.base = function(me, methodName, var_args) {
var args = Array.prototype.slice.call(arguments, 2);
return parentCtor.prototype[methodName].apply(me, args);
};
};
goog.base = function(me, opt_methodName, var_args) {
var caller = arguments.callee.caller;
if (goog.STRICT_MODE_COMPATIBLE || goog.DEBUG && !caller) {
throw Error("arguments.caller not defined. goog.base() cannot be used " + "with strict mode code. See " + "http://www.ecma-international.org/ecma-262/5.1/#sec-C");
}
if (caller.superClass_) {
return caller.superClass_.constructor.apply(me, Array.prototype.slice.call(arguments, 1));
}
var args = Array.prototype.slice.call(arguments, 2);
var foundCaller = false;
for (var ctor = me.constructor;ctor;ctor = ctor.superClass_ && ctor.superClass_.constructor) {
if (ctor.prototype[opt_methodName] === caller) {
foundCaller = true;
} else {
if (foundCaller) {
return ctor.prototype[opt_methodName].apply(me, args);
}
}
}
if (me[opt_methodName] === caller) {
return me.constructor.prototype[opt_methodName].apply(me, args);
} else {
throw Error("goog.base called from a method of one name " + "to a method of a different name");
}
};
goog.scope = function(fn) {
fn.call(goog.global);
};
if (!COMPILED) {
goog.global["COMPILED"] = COMPILED;
}
goog.defineClass = function(superClass, def) {
var constructor = def.constructor;
var statics = def.statics;
if (!constructor || constructor == Object.prototype.constructor) {
constructor = function() {
throw Error("cannot instantiate an interface (no constructor defined).");
};
}
var cls = goog.defineClass.createSealingConstructor_(constructor, superClass);
if (superClass) {
goog.inherits(cls, superClass);
}
delete def.constructor;
delete def.statics;
goog.defineClass.applyProperties_(cls.prototype, def);
if (statics != null) {
if (statics instanceof Function) {
statics(cls);
} else {
goog.defineClass.applyProperties_(cls, statics);
}
}
return cls;
};
goog.defineClass.ClassDescriptor;
goog.define("goog.defineClass.SEAL_CLASS_INSTANCES", goog.DEBUG);
goog.defineClass.createSealingConstructor_ = function(ctr, superClass) {
if (goog.defineClass.SEAL_CLASS_INSTANCES && Object.seal instanceof Function) {
if (superClass && superClass.prototype && superClass.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_]) {
return ctr;
}
var wrappedCtr = function() {
var instance = ctr.apply(this, arguments) || this;
if (this.constructor === wrappedCtr) {
Object.seal(instance);
}
return instance;
};
return wrappedCtr;
}
return ctr;
};
goog.defineClass.OBJECT_PROTOTYPE_FIELDS_ = ["constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf"];
goog.defineClass.applyProperties_ = function(target, source) {
var key;
for (key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
for (var i = 0;i < goog.defineClass.OBJECT_PROTOTYPE_FIELDS_.length;i++) {
key = goog.defineClass.OBJECT_PROTOTYPE_FIELDS_[i];
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
};
goog.tagUnsealableClass = function(ctr) {
if (!COMPILED && goog.defineClass.SEAL_CLASS_INSTANCES) {
ctr.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_] = true;
}
};
goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_ = "goog_defineClass_legacy_unsealable";
goog.provide("goog.string");
goog.provide("goog.string.Unicode");
goog.define("goog.string.DETECT_DOUBLE_ESCAPING", false);
goog.string.Unicode = {NBSP:"\u00a0"};
goog.string.startsWith = function(str, prefix) {
return str.lastIndexOf(prefix, 0) == 0;
};
goog.string.endsWith = function(str, suffix) {
var l = str.length - suffix.length;
return l >= 0 && str.indexOf(suffix, l) == l;
};
goog.string.caseInsensitiveStartsWith = function(str, prefix) {
return goog.string.caseInsensitiveCompare(prefix, str.substr(0, prefix.length)) == 0;
};
goog.string.caseInsensitiveEndsWith = function(str, suffix) {
return goog.string.caseInsensitiveCompare(suffix, str.substr(str.length - suffix.length, suffix.length)) == 0;
};
goog.string.caseInsensitiveEquals = function(str1, str2) {
return str1.toLowerCase() == str2.toLowerCase();
};
goog.string.subs = function(str, var_args) {
var splitParts = str.split("%s");
var returnString = "";
var subsArguments = Array.prototype.slice.call(arguments, 1);
while (subsArguments.length && splitParts.length > 1) {
returnString += splitParts.shift() + subsArguments.shift();
}
return returnString + splitParts.join("%s");
};
goog.string.collapseWhitespace = function(str) {
return str.replace(/[\s\xa0]+/g, " ").replace(/^\s+|\s+$/g, "");
};
goog.string.isEmpty = function(str) {
return/^[\s\xa0]*$/.test(str);
};
goog.string.isEmptySafe = function(str) {
return goog.string.isEmpty(goog.string.makeSafe(str));
};
goog.string.isBreakingWhitespace = function(str) {
return!/[^\t\n\r ]/.test(str);
};
goog.string.isAlpha = function(str) {
return!/[^a-zA-Z]/.test(str);
};
goog.string.isNumeric = function(str) {
return!/[^0-9]/.test(str);
};
goog.string.isAlphaNumeric = function(str) {
return!/[^a-zA-Z0-9]/.test(str);
};
goog.string.isSpace = function(ch) {
return ch == " ";
};
goog.string.isUnicodeChar = function(ch) {
return ch.length == 1 && ch >= " " && ch <= "~" || ch >= "\u0080" && ch <= "\ufffd";
};
goog.string.stripNewlines = function(str) {
return str.replace(/(\r\n|\r|\n)+/g, " ");
};
goog.string.canonicalizeNewlines = function(str) {
return str.replace(/(\r\n|\r|\n)/g, "\n");
};
goog.string.normalizeWhitespace = function(str) {
return str.replace(/\xa0|\s/g, " ");
};
goog.string.normalizeSpaces = function(str) {
return str.replace(/\xa0|[ \t]+/g, " ");
};
goog.string.collapseBreakingSpaces = function(str) {
return str.replace(/[\t\r\n ]+/g, " ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g, "");
};
goog.string.trim = function(str) {
return str.replace(/^[\s\xa0]+|[\s\xa0]+$/g, "");
};
goog.string.trimLeft = function(str) {
return str.replace(/^[\s\xa0]+/, "");
};
goog.string.trimRight = function(str) {
return str.replace(/[\s\xa0]+$/, "");
};
goog.string.caseInsensitiveCompare = function(str1, str2) {
var test1 = String(str1).toLowerCase();
var test2 = String(str2).toLowerCase();
if (test1 < test2) {
return-1;
} else {
if (test1 == test2) {
return 0;
} else {
return 1;
}
}
};
goog.string.numerateCompareRegExp_ = /(\.\d+)|(\d+)|(\D+)/g;
goog.string.numerateCompare = function(str1, str2) {
if (str1 == str2) {
return 0;
}
if (!str1) {
return-1;
}
if (!str2) {
return 1;
}
var tokens1 = str1.toLowerCase().match(goog.string.numerateCompareRegExp_);
var tokens2 = str2.toLowerCase().match(goog.string.numerateCompareRegExp_);
var count = Math.min(tokens1.length, tokens2.length);
for (var i = 0;i < count;i++) {
var a = tokens1[i];
var b = tokens2[i];
if (a != b) {
var num1 = parseInt(a, 10);
if (!isNaN(num1)) {
var num2 = parseInt(b, 10);
if (!isNaN(num2) && num1 - num2) {
return num1 - num2;
}
}
return a < b ? -1 : 1;
}
}
if (tokens1.length != tokens2.length) {
return tokens1.length - tokens2.length;
}
return str1 < str2 ? -1 : 1;
};
goog.string.urlEncode = function(str) {
return encodeURIComponent(String(str));
};
goog.string.urlDecode = function(str) {
return decodeURIComponent(str.replace(/\+/g, " "));
};
goog.string.newLineToBr = function(str, opt_xml) {
return str.replace(/(\r\n|\r|\n)/g, opt_xml ? "\x3cbr /\x3e" : "\x3cbr\x3e");
};
goog.string.htmlEscape = function(str, opt_isLikelyToContainHtmlChars) {
if (opt_isLikelyToContainHtmlChars) {
str = str.replace(goog.string.AMP_RE_, "\x26amp;").replace(goog.string.LT_RE_, "\x26lt;").replace(goog.string.GT_RE_, "\x26gt;").replace(goog.string.QUOT_RE_, "\x26quot;").replace(goog.string.SINGLE_QUOTE_RE_, "\x26#39;").replace(goog.string.NULL_RE_, "\x26#0;");
if (goog.string.DETECT_DOUBLE_ESCAPING) {
str = str.replace(goog.string.E_RE_, "\x26#101;");
}
return str;
} else {
if (!goog.string.ALL_RE_.test(str)) {
return str;
}
if (str.indexOf("\x26") != -1) {
str = str.replace(goog.string.AMP_RE_, "\x26amp;");
}
if (str.indexOf("\x3c") != -1) {
str = str.replace(goog.string.LT_RE_, "\x26lt;");
}
if (str.indexOf("\x3e") != -1) {
str = str.replace(goog.string.GT_RE_, "\x26gt;");
}
if (str.indexOf('"') != -1) {
str = str.replace(goog.string.QUOT_RE_, "\x26quot;");
}
if (str.indexOf("'") != -1) {
str = str.replace(goog.string.SINGLE_QUOTE_RE_, "\x26#39;");
}
if (str.indexOf("\x00") != -1) {
str = str.replace(goog.string.NULL_RE_, "\x26#0;");
}
if (goog.string.DETECT_DOUBLE_ESCAPING && str.indexOf("e") != -1) {
str = str.replace(goog.string.E_RE_, "\x26#101;");
}
return str;
}
};
goog.string.AMP_RE_ = /&/g;
goog.string.LT_RE_ = /</g;
goog.string.GT_RE_ = />/g;
goog.string.QUOT_RE_ = /"/g;
goog.string.SINGLE_QUOTE_RE_ = /'/g;
goog.string.NULL_RE_ = /\x00/g;
goog.string.E_RE_ = /e/g;
goog.string.ALL_RE_ = goog.string.DETECT_DOUBLE_ESCAPING ? /[\x00&<>"'e]/ : /[\x00&<>"']/;
goog.string.unescapeEntities = function(str) {
if (goog.string.contains(str, "\x26")) {
if ("document" in goog.global) {
return goog.string.unescapeEntitiesUsingDom_(str);
} else {
return goog.string.unescapePureXmlEntities_(str);
}
}
return str;
};
goog.string.unescapeEntitiesWithDocument = function(str, document) {
if (goog.string.contains(str, "\x26")) {
return goog.string.unescapeEntitiesUsingDom_(str, document);
}
return str;
};
goog.string.unescapeEntitiesUsingDom_ = function(str, opt_document) {
var seen = {"\x26amp;":"\x26", "\x26lt;":"\x3c", "\x26gt;":"\x3e", "\x26quot;":'"'};
var div;
if (opt_document) {
div = opt_document.createElement("div");
} else {
div = goog.global.document.createElement("div");
}
return str.replace(goog.string.HTML_ENTITY_PATTERN_, function(s, entity) {
var value = seen[s];
if (value) {
return value;
}
if (entity.charAt(0) == "#") {
var n = Number("0" + entity.substr(1));
if (!isNaN(n)) {
value = String.fromCharCode(n);
}
}
if (!value) {
div.innerHTML = s + " ";
value = div.firstChild.nodeValue.slice(0, -1);
}
return seen[s] = value;
});
};
goog.string.unescapePureXmlEntities_ = function(str) {
return str.replace(/&([^;]+);/g, function(s, entity) {
switch(entity) {
case "amp":
return "\x26";
case "lt":
return "\x3c";
case "gt":
return "\x3e";
case "quot":
return'"';
default:
if (entity.charAt(0) == "#") {
var n = Number("0" + entity.substr(1));
if (!isNaN(n)) {
return String.fromCharCode(n);
}
}
return s;
}
});
};
goog.string.HTML_ENTITY_PATTERN_ = /&([^;\s<&]+);?/g;
goog.string.whitespaceEscape = function(str, opt_xml) {
return goog.string.newLineToBr(str.replace(/ /g, " \x26#160;"), opt_xml);
};
goog.string.preserveSpaces = function(str) {
return str.replace(/(^|[\n ]) /g, "$1" + goog.string.Unicode.NBSP);
};
goog.string.stripQuotes = function(str, quoteChars) {
var length = quoteChars.length;
for (var i = 0;i < length;i++) {
var quoteChar = length == 1 ? quoteChars : quoteChars.charAt(i);
if (str.charAt(0) == quoteChar && str.charAt(str.length - 1) == quoteChar) {
return str.substring(1, str.length - 1);
}
}
return str;
};
goog.string.truncate = function(str, chars, opt_protectEscapedCharacters) {
if (opt_protectEscapedCharacters) {
str = goog.string.unescapeEntities(str);
}
if (str.length > chars) {
str = str.substring(0, chars - 3) + "...";
}
if (opt_protectEscapedCharacters) {
str = goog.string.htmlEscape(str);
}
return str;
};
goog.string.truncateMiddle = function(str, chars, opt_protectEscapedCharacters, opt_trailingChars) {
if (opt_protectEscapedCharacters) {
str = goog.string.unescapeEntities(str);
}
if (opt_trailingChars && str.length > chars) {
if (opt_trailingChars > chars) {
opt_trailingChars = chars;
}
var endPoint = str.length - opt_trailingChars;
var startPoint = chars - opt_trailingChars;
str = str.substring(0, startPoint) + "..." + str.substring(endPoint);
} else {
if (str.length > chars) {
var half = Math.floor(chars / 2);
var endPos = str.length - half;
half += chars % 2;
str = str.substring(0, half) + "..." + str.substring(endPos);
}
}
if (opt_protectEscapedCharacters) {
str = goog.string.htmlEscape(str);
}
return str;
};
goog.string.specialEscapeChars_ = {"\x00":"\\0", "\b":"\\b", "\f":"\\f", "\n":"\\n", "\r":"\\r", "\t":"\\t", "\x0B":"\\x0B", '"':'\\"', "\\":"\\\\"};
goog.string.jsEscapeCache_ = {"'":"\\'"};
goog.string.quote = function(s) {
s = String(s);
if (s.quote) {
return s.quote();
} else {
var sb = ['"'];
for (var i = 0;i < s.length;i++) {
var ch = s.charAt(i);
var cc = ch.charCodeAt(0);
sb[i + 1] = goog.string.specialEscapeChars_[ch] || (cc > 31 && cc < 127 ? ch : goog.string.escapeChar(ch));
}
sb.push('"');
return sb.join("");
}
};
goog.string.escapeString = function(str) {
var sb = [];
for (var i = 0;i < str.length;i++) {
sb[i] = goog.string.escapeChar(str.charAt(i));
}
return sb.join("");
};
goog.string.escapeChar = function(c) {
if (c in goog.string.jsEscapeCache_) {
return goog.string.jsEscapeCache_[c];
}
if (c in goog.string.specialEscapeChars_) {
return goog.string.jsEscapeCache_[c] = goog.string.specialEscapeChars_[c];
}
var rv = c;
var cc = c.charCodeAt(0);
if (cc > 31 && cc < 127) {
rv = c;
} else {
if (cc < 256) {
rv = "\\x";
if (cc < 16 || cc > 256) {
rv += "0";
}
} else {
rv = "\\u";
if (cc < 4096) {
rv += "0";
}
}
rv += cc.toString(16).toUpperCase();
}
return goog.string.jsEscapeCache_[c] = rv;
};
goog.string.toMap = function(s) {
var rv = {};
for (var i = 0;i < s.length;i++) {
rv[s.charAt(i)] = true;
}
return rv;
};
goog.string.contains = function(str, subString) {
return str.indexOf(subString) != -1;
};
goog.string.caseInsensitiveContains = function(str, subString) {
return goog.string.contains(str.toLowerCase(), subString.toLowerCase());
};
goog.string.countOf = function(s, ss) {
return s && ss ? s.split(ss).length - 1 : 0;
};
goog.string.removeAt = function(s, index, stringLength) {
var resultStr = s;
if (index >= 0 && index < s.length && stringLength > 0) {
resultStr = s.substr(0, index) + s.substr(index + stringLength, s.length - index - stringLength);
}
return resultStr;
};
goog.string.remove = function(s, ss) {
var re = new RegExp(goog.string.regExpEscape(ss), "");
return s.replace(re, "");
};
goog.string.removeAll = function(s, ss) {
var re = new RegExp(goog.string.regExpEscape(ss), "g");
return s.replace(re, "");
};
goog.string.regExpEscape = function(s) {
return String(s).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, "\\$1").replace(/\x08/g, "\\x08");
};
goog.string.repeat = function(string, length) {
return(new Array(length + 1)).join(string);
};
goog.string.padNumber = function(num, length, opt_precision) {
var s = goog.isDef(opt_precision) ? num.toFixed(opt_precision) : String(num);
var index = s.indexOf(".");
if (index == -1) {
index = s.length;
}
return goog.string.repeat("0", Math.max(0, length - index)) + s;
};
goog.string.makeSafe = function(obj) {
return obj == null ? "" : String(obj);
};
goog.string.buildString = function(var_args) {
return Array.prototype.join.call(arguments, "");
};
goog.string.getRandomString = function() {
var x = 2147483648;
return Math.floor(Math.random() * x).toString(36) + Math.abs(Math.floor(Math.random() * x) ^ goog.now()).toString(36);
};
goog.string.compareVersions = function(version1, version2) {
var order = 0;
var v1Subs = goog.string.trim(String(version1)).split(".");
var v2Subs = goog.string.trim(String(version2)).split(".");
var subCount = Math.max(v1Subs.length, v2Subs.length);
for (var subIdx = 0;order == 0 && subIdx < subCount;subIdx++) {
var v1Sub = v1Subs[subIdx] || "";
var v2Sub = v2Subs[subIdx] || "";
var v1CompParser = new RegExp("(\\d*)(\\D*)", "g");
var v2CompParser = new RegExp("(\\d*)(\\D*)", "g");
do {
var v1Comp = v1CompParser.exec(v1Sub) || ["", "", ""];
var v2Comp = v2CompParser.exec(v2Sub) || ["", "", ""];
if (v1Comp[0].length == 0 && v2Comp[0].length == 0) {
break;
}
var v1CompNum = v1Comp[1].length == 0 ? 0 : parseInt(v1Comp[1], 10);
var v2CompNum = v2Comp[1].length == 0 ? 0 : parseInt(v2Comp[1], 10);
order = goog.string.compareElements_(v1CompNum, v2CompNum) || goog.string.compareElements_(v1Comp[2].length == 0, v2Comp[2].length == 0) || goog.string.compareElements_(v1Comp[2], v2Comp[2]);
} while (order == 0);
}
return order;
};
goog.string.compareElements_ = function(left, right) {
if (left < right) {
return-1;
} else {
if (left > right) {
return 1;
}
}
return 0;
};
goog.string.HASHCODE_MAX_ = 4294967296;
goog.string.hashCode = function(str) {
var result = 0;
for (var i = 0;i < str.length;++i) {
result = 31 * result + str.charCodeAt(i);
result %= goog.string.HASHCODE_MAX_;
}
return result;
};
goog.string.uniqueStringCounter_ = Math.random() * 2147483648 | 0;
goog.string.createUniqueString = function() {
return "goog_" + goog.string.uniqueStringCounter_++;
};
goog.string.toNumber = function(str) {
var num = Number(str);
if (num == 0 && goog.string.isEmpty(str)) {
return NaN;
}
return num;
};
goog.string.isLowerCamelCase = function(str) {
return/^[a-z]+([A-Z][a-z]*)*$/.test(str);
};
goog.string.isUpperCamelCase = function(str) {
return/^([A-Z][a-z]*)+$/.test(str);
};
goog.string.toCamelCase = function(str) {
return String(str).replace(/\-([a-z])/g, function(all, match) {
return match.toUpperCase();
});
};
goog.string.toSelectorCase = function(str) {
return String(str).replace(/([A-Z])/g, "-$1").toLowerCase();
};
goog.string.toTitleCase = function(str, opt_delimiters) {
var delimiters = goog.isString(opt_delimiters) ? goog.string.regExpEscape(opt_delimiters) : "\\s";
delimiters = delimiters ? "|[" + delimiters + "]+" : "";
var regexp = new RegExp("(^" + delimiters + ")([a-z])", "g");
return str.replace(regexp, function(all, p1, p2) {
return p1 + p2.toUpperCase();
});
};
goog.string.parseInt = function(value) {
if (isFinite(value)) {
value = String(value);
}
if (goog.isString(value)) {
return/^\s*-?0x/i.test(value) ? parseInt(value, 16) : parseInt(value, 10);
}
return NaN;
};
goog.string.splitLimit = function(str, separator, limit) {
var parts = str.split(separator);
var returnVal = [];
while (limit > 0 && parts.length) {
returnVal.push(parts.shift());
limit--;
}
if (parts.length) {
returnVal.push(parts.join(separator));
}
return returnVal;
};
goog.provide("goog.object");
goog.object.forEach = function(obj, f, opt_obj) {
for (var key in obj) {
f.call(opt_obj, obj[key], key, obj);
}
};
goog.object.filter = function(obj, f, opt_obj) {
var res = {};
for (var key in obj) {
if (f.call(opt_obj, obj[key], key, obj)) {
res[key] = obj[key];
}
}
return res;
};
goog.object.map = function(obj, f, opt_obj) {
var res = {};
for (var key in obj) {
res[key] = f.call(opt_obj, obj[key], key, obj);
}
return res;
};
goog.object.some = function(obj, f, opt_obj) {
for (var key in obj) {
if (f.call(opt_obj, obj[key], key, obj)) {
return true;
}
}
return false;
};
goog.object.every = function(obj, f, opt_obj) {
for (var key in obj) {
if (!f.call(opt_obj, obj[key], key, obj)) {
return false;
}
}
return true;
};
goog.object.getCount = function(obj) {
var rv = 0;
for (var key in obj) {
rv++;
}
return rv;
};
goog.object.getAnyKey = function(obj) {
for (var key in obj) {
return key;
}
};
goog.object.getAnyValue = function(obj) {
for (var key in obj) {
return obj[key];
}
};
goog.object.contains = function(obj, val) {
return goog.object.containsValue(obj, val);
};
goog.object.getValues = function(obj) {
var res = [];
var i = 0;
for (var key in obj) {
res[i++] = obj[key];
}
return res;
};
goog.object.getKeys = function(obj) {
var res = [];
var i = 0;
for (var key in obj) {
res[i++] = key;
}
return res;
};
goog.object.getValueByKeys = function(obj, var_args) {
var isArrayLike = goog.isArrayLike(var_args);
var keys = isArrayLike ? var_args : arguments;
for (var i = isArrayLike ? 0 : 1;i < keys.length;i++) {
obj = obj[keys[i]];
if (!goog.isDef(obj)) {
break;
}
}
return obj;
};
goog.object.containsKey = function(obj, key) {
return key in obj;
};
goog.object.containsValue = function(obj, val) {
for (var key in obj) {
if (obj[key] == val) {
return true;
}
}
return false;
};
goog.object.findKey = function(obj, f, opt_this) {
for (var key in obj) {
if (f.call(opt_this, obj[key], key, obj)) {
return key;
}
}
return undefined;
};
goog.object.findValue = function(obj, f, opt_this) {
var key = goog.object.findKey(obj, f, opt_this);
return key && obj[key];
};
goog.object.isEmpty = function(obj) {
for (var key in obj) {
return false;
}
return true;
};
goog.object.clear = function(obj) {
for (var i in obj) {
delete obj[i];
}
};
goog.object.remove = function(obj, key) {
var rv;
if (rv = key in obj) {
delete obj[key];
}
return rv;
};
goog.object.add = function(obj, key, val) {
if (key in obj) {
throw Error('The object already contains the key "' + key + '"');
}
goog.object.set(obj, key, val);
};
goog.object.get = function(obj, key, opt_val) {
if (key in obj) {
return obj[key];
}
return opt_val;
};
goog.object.set = function(obj, key, value) {
obj[key] = value;
};
goog.object.setIfUndefined = function(obj, key, value) {
return key in obj ? obj[key] : obj[key] = value;
};
goog.object.clone = function(obj) {
var res = {};
for (var key in obj) {
res[key] = obj[key];
}
return res;
};
goog.object.unsafeClone = function(obj) {
var type = goog.typeOf(obj);
if (type == "object" || type == "array") {
if (obj.clone) {
return obj.clone();
}
var clone = type == "array" ? [] : {};
for (var key in obj) {
clone[key] = goog.object.unsafeClone(obj[key]);
}
return clone;
}
return obj;
};
goog.object.transpose = function(obj) {
var transposed = {};
for (var key in obj) {
transposed[obj[key]] = key;
}
return transposed;
};
goog.object.PROTOTYPE_FIELDS_ = ["constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf"];
goog.object.extend = function(target, var_args) {
var key, source;
for (var i = 1;i < arguments.length;i++) {
source = arguments[i];
for (key in source) {
target[key] = source[key];
}
for (var j = 0;j < goog.object.PROTOTYPE_FIELDS_.length;j++) {
key = goog.object.PROTOTYPE_FIELDS_[j];
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
};
goog.object.create = function(var_args) {
var argLength = arguments.length;
if (argLength == 1 && goog.isArray(arguments[0])) {
return goog.object.create.apply(null, arguments[0]);
}
if (argLength % 2) {
throw Error("Uneven number of arguments");
}
var rv = {};
for (var i = 0;i < argLength;i += 2) {
rv[arguments[i]] = arguments[i + 1];
}
return rv;
};
goog.object.createSet = function(var_args) {
var argLength = arguments.length;
if (argLength == 1 && goog.isArray(arguments[0])) {
return goog.object.createSet.apply(null, arguments[0]);
}
var rv = {};
for (var i = 0;i < argLength;i++) {
rv[arguments[i]] = true;
}
return rv;
};
goog.object.createImmutableView = function(obj) {
var result = obj;
if (Object.isFrozen && !Object.isFrozen(obj)) {
result = Object.create(obj);
Object.freeze(result);
}
return result;
};
goog.object.isImmutableView = function(obj) {
return!!Object.isFrozen && Object.isFrozen(obj);
};
goog.provide("goog.string.StringBuffer");
goog.string.StringBuffer = function(opt_a1, var_args) {
if (opt_a1 != null) {
this.append.apply(this, arguments);
}
};
goog.string.StringBuffer.prototype.buffer_ = "";
goog.string.StringBuffer.prototype.set = function(s) {
this.buffer_ = "" + s;
};
goog.string.StringBuffer.prototype.append = function(a1, opt_a2, var_args) {
this.buffer_ += a1;
if (opt_a2 != null) {
for (var i = 1;i < arguments.length;i++) {
this.buffer_ += arguments[i];
}
}
return this;
};
goog.string.StringBuffer.prototype.clear = function() {
this.buffer_ = "";
};
goog.string.StringBuffer.prototype.getLength = function() {
return this.buffer_.length;
};
goog.string.StringBuffer.prototype.toString = function() {
return this.buffer_;
};
goog.provide("goog.debug.Error");
goog.debug.Error = function(opt_msg) {
if (Error.captureStackTrace) {
Error.captureStackTrace(this, goog.debug.Error);
} else {
var stack = (new Error).stack;
if (stack) {
this.stack = stack;
}
}
if (opt_msg) {
this.message = String(opt_msg);
}
};
goog.inherits(goog.debug.Error, Error);
goog.debug.Error.prototype.name = "CustomError";
goog.provide("goog.dom.NodeType");
goog.dom.NodeType = {ELEMENT:1, ATTRIBUTE:2, TEXT:3, CDATA_SECTION:4, ENTITY_REFERENCE:5, ENTITY:6, PROCESSING_INSTRUCTION:7, COMMENT:8, DOCUMENT:9, DOCUMENT_TYPE:10, DOCUMENT_FRAGMENT:11, NOTATION:12};
goog.provide("goog.asserts");
goog.provide("goog.asserts.AssertionError");
goog.require("goog.debug.Error");
goog.require("goog.dom.NodeType");
goog.require("goog.string");
goog.define("goog.asserts.ENABLE_ASSERTS", goog.DEBUG);
goog.asserts.AssertionError = function(messagePattern, messageArgs) {
messageArgs.unshift(messagePattern);
goog.debug.Error.call(this, goog.string.subs.apply(null, messageArgs));
messageArgs.shift();
this.messagePattern = messagePattern;
};
goog.inherits(goog.asserts.AssertionError, goog.debug.Error);
goog.asserts.AssertionError.prototype.name = "AssertionError";
goog.asserts.DEFAULT_ERROR_HANDLER = function(e) {
throw e;
};
goog.asserts.errorHandler_ = goog.asserts.DEFAULT_ERROR_HANDLER;
goog.asserts.doAssertFailure_ = function(defaultMessage, defaultArgs, givenMessage, givenArgs) {
var message = "Assertion failed";
if (givenMessage) {
message += ": " + givenMessage;
var args = givenArgs;
} else {
if (defaultMessage) {
message += ": " + defaultMessage;
args = defaultArgs;
}
}
var e = new goog.asserts.AssertionError("" + message, args || []);
goog.asserts.errorHandler_(e);
};
goog.asserts.setErrorHandler = function(errorHandler) {
if (goog.asserts.ENABLE_ASSERTS) {
goog.asserts.errorHandler_ = errorHandler;
}
};
goog.asserts.assert = function(condition, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !condition) {
goog.asserts.doAssertFailure_("", null, opt_message, Array.prototype.slice.call(arguments, 2));
}
return condition;
};
goog.asserts.fail = function(opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS) {
goog.asserts.errorHandler_(new goog.asserts.AssertionError("Failure" + (opt_message ? ": " + opt_message : ""), Array.prototype.slice.call(arguments, 1)));
}
};
goog.asserts.assertNumber = function(value, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !goog.isNumber(value)) {
goog.asserts.doAssertFailure_("Expected number but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
}
return(value);
};
goog.asserts.assertString = function(value, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !goog.isString(value)) {
goog.asserts.doAssertFailure_("Expected string but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
}
return(value);
};
goog.asserts.assertFunction = function(value, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !goog.isFunction(value)) {
goog.asserts.doAssertFailure_("Expected function but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
}
return(value);
};
goog.asserts.assertObject = function(value, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !goog.isObject(value)) {
goog.asserts.doAssertFailure_("Expected object but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
}
return(value);
};
goog.asserts.assertArray = function(value, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !goog.isArray(value)) {
goog.asserts.doAssertFailure_("Expected array but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
}
return(value);
};
goog.asserts.assertBoolean = function(value, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !goog.isBoolean(value)) {
goog.asserts.doAssertFailure_("Expected boolean but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
}
return(value);
};
goog.asserts.assertElement = function(value, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && (!goog.isObject(value) || value.nodeType != goog.dom.NodeType.ELEMENT)) {
goog.asserts.doAssertFailure_("Expected Element but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
}
return(value);
};
goog.asserts.assertInstanceof = function(value, type, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !(value instanceof type)) {
goog.asserts.doAssertFailure_("instanceof check failed.", null, opt_message, Array.prototype.slice.call(arguments, 3));
}
return value;
};
goog.asserts.assertObjectPrototypeIsIntact = function() {
for (var key in Object.prototype) {
goog.asserts.fail(key + " should not be enumerable in Object.prototype.");
}
};
goog.provide("goog.array");
goog.provide("goog.array.ArrayLike");
goog.require("goog.asserts");
goog.define("goog.NATIVE_ARRAY_PROTOTYPES", goog.TRUSTED_SITE);
goog.define("goog.array.ASSUME_NATIVE_FUNCTIONS", false);
goog.array.ArrayLike;
goog.array.peek = function(array) {
return array[array.length - 1];
};
goog.array.last = goog.array.peek;
goog.array.ARRAY_PROTOTYPE_ = Array.prototype;
goog.array.indexOf = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.indexOf) ? function(arr, obj, opt_fromIndex) {
goog.asserts.assert(arr.length != null);
return goog.array.ARRAY_PROTOTYPE_.indexOf.call(arr, obj, opt_fromIndex);
} : function(arr, obj, opt_fromIndex) {
var fromIndex = opt_fromIndex == null ? 0 : opt_fromIndex < 0 ? Math.max(0, arr.length + opt_fromIndex) : opt_fromIndex;
if (goog.isString(arr)) {
if (!goog.isString(obj) || obj.length != 1) {
return-1;
}
return arr.indexOf(obj, fromIndex);
}
for (var i = fromIndex;i < arr.length;i++) {
if (i in arr && arr[i] === obj) {
return i;
}
}
return-1;
};
goog.array.lastIndexOf = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.lastIndexOf) ? function(arr, obj, opt_fromIndex) {
goog.asserts.assert(arr.length != null);
var fromIndex = opt_fromIndex == null ? arr.length - 1 : opt_fromIndex;
return goog.array.ARRAY_PROTOTYPE_.lastIndexOf.call(arr, obj, fromIndex);
} : function(arr, obj, opt_fromIndex) {
var fromIndex = opt_fromIndex == null ? arr.length - 1 : opt_fromIndex;
if (fromIndex < 0) {
fromIndex = Math.max(0, arr.length + fromIndex);
}
if (goog.isString(arr)) {
if (!goog.isString(obj) || obj.length != 1) {
return-1;
}
return arr.lastIndexOf(obj, fromIndex);
}
for (var i = fromIndex;i >= 0;i--) {
if (i in arr && arr[i] === obj) {
return i;
}
}
return-1;
};
goog.array.forEach = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.forEach) ? function(arr, f, opt_obj) {
goog.asserts.assert(arr.length != null);
goog.array.ARRAY_PROTOTYPE_.forEach.call(arr, f, opt_obj);
} : function(arr, f, opt_obj) {
var l = arr.length;
var arr2 = goog.isString(arr) ? arr.split("") : arr;
for (var i = 0;i < l;i++) {
if (i in arr2) {
f.call(opt_obj, arr2[i], i, arr);
}
}
};
goog.array.forEachRight = function(arr, f, opt_obj) {
var l = arr.length;
var arr2 = goog.isString(arr) ? arr.split("") : arr;
for (var i = l - 1;i >= 0;--i) {
if (i in arr2) {
f.call(opt_obj, arr2[i], i, arr);
}
}
};
goog.array.filter = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.filter) ? function(arr, f, opt_obj) {
goog.asserts.assert(arr.length != null);
return goog.array.ARRAY_PROTOTYPE_.filter.call(arr, f, opt_obj);
} : function(arr, f, opt_obj) {
var l = arr.length;
var res = [];
var resLength = 0;
var arr2 = goog.isString(arr) ? arr.split("") : arr;
for (var i = 0;i < l;i++) {
if (i in arr2) {
var val = arr2[i];
if (f.call(opt_obj, val, i, arr)) {
res[resLength++] = val;
}
}
}
return res;
};
goog.array.map = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.map) ? function(arr, f, opt_obj) {
goog.asserts.assert(arr.length != null);
return goog.array.ARRAY_PROTOTYPE_.map.call(arr, f, opt_obj);
} : function(arr, f, opt_obj) {
var l = arr.length;
var res = new Array(l);
var arr2 = goog.isString(arr) ? arr.split("") : arr;
for (var i = 0;i < l;i++) {
if (i in arr2) {
res[i] = f.call(opt_obj, arr2[i], i, arr);
}
}
return res;
};
goog.array.reduce = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.reduce) ? function(arr, f, val, opt_obj) {
goog.asserts.assert(arr.length != null);
if (opt_obj) {
f = goog.bind(f, opt_obj);
}
return goog.array.ARRAY_PROTOTYPE_.reduce.call(arr, f, val);
} : function(arr, f, val, opt_obj) {
var rval = val;
goog.array.forEach(arr, function(val, index) {
rval = f.call(opt_obj, rval, val, index, arr);
});
return rval;
};
goog.array.reduceRight = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.reduceRight) ? function(arr, f, val, opt_obj) {
goog.asserts.assert(arr.length != null);
if (opt_obj) {
f = goog.bind(f, opt_obj);
}
return goog.array.ARRAY_PROTOTYPE_.reduceRight.call(arr, f, val);
} : function(arr, f, val, opt_obj) {
var rval = val;
goog.array.forEachRight(arr, function(val, index) {
rval = f.call(opt_obj, rval, val, index, arr);
});
return rval;
};
goog.array.some = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.some) ? function(arr, f, opt_obj) {
goog.asserts.assert(arr.length != null);
return goog.array.ARRAY_PROTOTYPE_.some.call(arr, f, opt_obj);
} : function(arr, f, opt_obj) {
var l = arr.length;
var arr2 = goog.isString(arr) ? arr.split("") : arr;
for (var i = 0;i < l;i++) {
if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) {
return true;
}
}
return false;
};
goog.array.every = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.every) ? function(arr, f, opt_obj) {
goog.asserts.assert(arr.length != null);
return goog.array.ARRAY_PROTOTYPE_.every.call(arr, f, opt_obj);
} : function(arr, f, opt_obj) {
var l = arr.length;
var arr2 = goog.isString(arr) ? arr.split("") : arr;
for (var i = 0;i < l;i++) {
if (i in arr2 && !f.call(opt_obj, arr2[i], i, arr)) {
return false;
}
}
return true;
};
goog.array.count = function(arr, f, opt_obj) {
var count = 0;
goog.array.forEach(arr, function(element, index, arr) {
if (f.call(opt_obj, element, index, arr)) {
++count;
}
}, opt_obj);
return count;
};
goog.array.find = function(arr, f, opt_obj) {
var i = goog.array.findIndex(arr, f, opt_obj);
return i < 0 ? null : goog.isString(arr) ? arr.charAt(i) : arr[i];
};
goog.array.findIndex = function(arr, f, opt_obj) {
var l = arr.length;
var arr2 = goog.isString(arr) ? arr.split("") : arr;
for (var i = 0;i < l;i++) {
if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) {
return i;
}
}
return-1;
};
goog.array.findRight = function(arr, f, opt_obj) {
var i = goog.array.findIndexRight(arr, f, opt_obj);
return i < 0 ? null : goog.isString(arr) ? arr.charAt(i) : arr[i];
};
goog.array.findIndexRight = function(arr, f, opt_obj) {
var l = arr.length;
var arr2 = goog.isString(arr) ? arr.split("") : arr;
for (var i = l - 1;i >= 0;i--) {
if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) {
return i;
}
}
return-1;
};
goog.array.contains = function(arr, obj) {
return goog.array.indexOf(arr, obj) >= 0;
};
goog.array.isEmpty = function(arr) {
return arr.length == 0;
};
goog.array.clear = function(arr) {
if (!goog.isArray(arr)) {
for (var i = arr.length - 1;i >= 0;i--) {
delete arr[i];
}
}
arr.length = 0;
};
goog.array.insert = function(arr, obj) {
if (!goog.array.contains(arr, obj)) {
arr.push(obj);
}
};
goog.array.insertAt = function(arr, obj, opt_i) {
goog.array.splice(arr, opt_i, 0, obj);
};
goog.array.insertArrayAt = function(arr, elementsToAdd, opt_i) {
goog.partial(goog.array.splice, arr, opt_i, 0).apply(null, elementsToAdd);
};
goog.array.insertBefore = function(arr, obj, opt_obj2) {
var i;
if (arguments.length == 2 || (i = goog.array.indexOf(arr, opt_obj2)) < 0) {
arr.push(obj);
} else {
goog.array.insertAt(arr, obj, i);
}
};
goog.array.remove = function(arr, obj) {
var i = goog.array.indexOf(arr, obj);
var rv;
if (rv = i >= 0) {
goog.array.removeAt(arr, i);
}
return rv;
};
goog.array.removeAt = function(arr, i) {
goog.asserts.assert(arr.length != null);
return goog.array.ARRAY_PROTOTYPE_.splice.call(arr, i, 1).length == 1;
};
goog.array.removeIf = function(arr, f, opt_obj) {
var i = goog.array.findIndex(arr, f, opt_obj);
if (i >= 0) {
goog.array.removeAt(arr, i);
return true;
}
return false;
};
goog.array.concat = function(var_args) {
return goog.array.ARRAY_PROTOTYPE_.concat.apply(goog.array.ARRAY_PROTOTYPE_, arguments);
};
goog.array.join = function(var_args) {
return goog.array.ARRAY_PROTOTYPE_.concat.apply(goog.array.ARRAY_PROTOTYPE_, arguments);
};
goog.array.toArray = function(object) {
var length = object.length;
if (length > 0) {
var rv = new Array(length);
for (var i = 0;i < length;i++) {
rv[i] = object[i];
}
return rv;
}
return[];
};
goog.array.clone = goog.array.toArray;
goog.array.extend = function(arr1, var_args) {
for (var i = 1;i < arguments.length;i++) {
var arr2 = arguments[i];
var isArrayLike;
if (goog.isArray(arr2) || (isArrayLike = goog.isArrayLike(arr2)) && Object.prototype.hasOwnProperty.call(arr2, "callee")) {
arr1.push.apply(arr1, arr2);
} else {
if (isArrayLike) {
var len1 = arr1.length;
var len2 = arr2.length;
for (var j = 0;j < len2;j++) {
arr1[len1 + j] = arr2[j];
}
} else {
arr1.push(arr2);
}
}
}
};
goog.array.splice = function(arr, index, howMany, var_args) {
goog.asserts.assert(arr.length != null);
return goog.array.ARRAY_PROTOTYPE_.splice.apply(arr, goog.array.slice(arguments, 1));
};
goog.array.slice = function(arr, start, opt_end) {
goog.asserts.assert(arr.length != null);
if (arguments.length <= 2) {
return goog.array.ARRAY_PROTOTYPE_.slice.call(arr, start);
} else {
return goog.array.ARRAY_PROTOTYPE_.slice.call(arr, start, opt_end);
}
};
goog.array.removeDuplicates = function(arr, opt_rv, opt_hashFn) {
var returnArray = opt_rv || arr;
var defaultHashFn = function(item) {
return goog.isObject(current) ? "o" + goog.getUid(current) : (typeof current).charAt(0) + current;
};
var hashFn = opt_hashFn || defaultHashFn;
var seen = {}, cursorInsert = 0, cursorRead = 0;
while (cursorRead < arr.length) {
var current = arr[cursorRead++];
var key = hashFn(current);
if (!Object.prototype.hasOwnProperty.call(seen, key)) {
seen[key] = true;
returnArray[cursorInsert++] = current;
}
}
returnArray.length = cursorInsert;
};
goog.array.binarySearch = function(arr, target, opt_compareFn) {
return goog.array.binarySearch_(arr, opt_compareFn || goog.array.defaultCompare, false, target);
};
goog.array.binarySelect = function(arr, evaluator, opt_obj) {
return goog.array.binarySearch_(arr, evaluator, true, undefined, opt_obj);
};
goog.array.binarySearch_ = function(arr, compareFn, isEvaluator, opt_target, opt_selfObj) {
var left = 0;
var right = arr.length;
var found;
while (left < right) {
var middle = left + right >> 1;
var compareResult;
if (isEvaluator) {
compareResult = compareFn.call(opt_selfObj, arr[middle], middle, arr);
} else {
compareResult = compareFn(opt_target, arr[middle]);
}
if (compareResult > 0) {
left = middle + 1;
} else {
right = middle;
found = !compareResult;
}
}
return found ? left : ~left;
};
goog.array.sort = function(arr, opt_compareFn) {
arr.sort(opt_compareFn || goog.array.defaultCompare);
};
goog.array.stableSort = function(arr, opt_compareFn) {
for (var i = 0;i < arr.length;i++) {
arr[i] = {index:i, value:arr[i]};
}
var valueCompareFn = opt_compareFn || goog.array.defaultCompare;
function stableCompareFn(obj1, obj2) {
return valueCompareFn(obj1.value, obj2.value) || obj1.index - obj2.index;
}
goog.array.sort(arr, stableCompareFn);
for (var i = 0;i < arr.length;i++) {
arr[i] = arr[i].value;
}
};
goog.array.sortObjectsByKey = function(arr, key, opt_compareFn) {
var compare = opt_compareFn || goog.array.defaultCompare;
goog.array.sort(arr, function(a, b) {
return compare(a[key], b[key]);
});
};
goog.array.isSorted = function(arr, opt_compareFn, opt_strict) {
var compare = opt_compareFn || goog.array.defaultCompare;
for (var i = 1;i < arr.length;i++) {
var compareResult = compare(arr[i - 1], arr[i]);
if (compareResult > 0 || compareResult == 0 && opt_strict) {
return false;
}
}
return true;
};
goog.array.equals = function(arr1, arr2, opt_equalsFn) {
if (!goog.isArrayLike(arr1) || !goog.isArrayLike(arr2) || arr1.length != arr2.length) {
return false;
}
var l = arr1.length;
var equalsFn = opt_equalsFn || goog.array.defaultCompareEquality;
for (var i = 0;i < l;i++) {
if (!equalsFn(arr1[i], arr2[i])) {
return false;
}
}
return true;
};
goog.array.compare3 = function(arr1, arr2, opt_compareFn) {
var compare = opt_compareFn || goog.array.defaultCompare;
var l = Math.min(arr1.length, arr2.length);
for (var i = 0;i < l;i++) {
var result = compare(arr1[i], arr2[i]);
if (result != 0) {
return result;
}
}
return goog.array.defaultCompare(arr1.length, arr2.length);
};
goog.array.defaultCompare = function(a, b) {
return a > b ? 1 : a < b ? -1 : 0;
};
goog.array.defaultCompareEquality = function(a, b) {
return a === b;
};
goog.array.binaryInsert = function(array, value, opt_compareFn) {
var index = goog.array.binarySearch(array, value, opt_compareFn);
if (index < 0) {
goog.array.insertAt(array, value, -(index + 1));
return true;
}
return false;
};
goog.array.binaryRemove = function(array, value, opt_compareFn) {
var index = goog.array.binarySearch(array, value, opt_compareFn);
return index >= 0 ? goog.array.removeAt(array, index) : false;
};
goog.array.bucket = function(array, sorter, opt_obj) {
var buckets = {};
for (var i = 0;i < array.length;i++) {
var value = array[i];
var key = sorter.call(opt_obj, value, i, array);
if (goog.isDef(key)) {
var bucket = buckets[key] || (buckets[key] = []);
bucket.push(value);
}
}
return buckets;
};
goog.array.toObject = function(arr, keyFunc, opt_obj) {
var ret = {};
goog.array.forEach(arr, function(element, index) {
ret[keyFunc.call(opt_obj, element, index, arr)] = element;
});
return ret;
};
goog.array.range = function(startOrEnd, opt_end, opt_step) {
var array = [];
var start = 0;
var end = startOrEnd;
var step = opt_step || 1;
if (opt_end !== undefined) {
start = startOrEnd;
end = opt_end;
}
if (step * (end - start) < 0) {
return[];
}
if (step > 0) {
for (var i = start;i < end;i += step) {
array.push(i);
}
} else {
for (var i = start;i > end;i += step) {
array.push(i);
}
}
return array;
};
goog.array.repeat = function(value, n) {
var array = [];
for (var i = 0;i < n;i++) {
array[i] = value;
}
return array;
};
goog.array.flatten = function(var_args) {
var result = [];
for (var i = 0;i < arguments.length;i++) {
var element = arguments[i];
if (goog.isArray(element)) {
result.push.apply(result, goog.array.flatten.apply(null, element));
} else {
result.push(element);
}
}
return result;
};
goog.array.rotate = function(array, n) {
goog.asserts.assert(array.length != null);
if (array.length) {
n %= array.length;
if (n > 0) {
goog.array.ARRAY_PROTOTYPE_.unshift.apply(array, array.splice(-n, n));
} else {
if (n < 0) {
goog.array.ARRAY_PROTOTYPE_.push.apply(array, array.splice(0, -n));
}
}
}
return array;
};
goog.array.moveItem = function(arr, fromIndex, toIndex) {
goog.asserts.assert(fromIndex >= 0 && fromIndex < arr.length);
goog.asserts.assert(toIndex >= 0 && toIndex < arr.length);
var removedItems = goog.array.ARRAY_PROTOTYPE_.splice.call(arr, fromIndex, 1);
goog.array.ARRAY_PROTOTYPE_.splice.call(arr, toIndex, 0, removedItems[0]);
};
goog.array.zip = function(var_args) {
if (!arguments.length) {
return[];
}
var result = [];
for (var i = 0;true;i++) {
var value = [];
for (var j = 0;j < arguments.length;j++) {
var arr = arguments[j];
if (i >= arr.length) {
return result;
}
value.push(arr[i]);
}
result.push(value);
}
};
goog.array.shuffle = function(arr, opt_randFn) {
var randFn = opt_randFn || Math.random;
for (var i = arr.length - 1;i > 0;i--) {
var j = Math.floor(randFn() * (i + 1));
var tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
};
goog.provide("cljs.core");
goog.require("goog.string.StringBuffer");
goog.require("goog.array");
goog.require("goog.array");
goog.require("goog.object");
goog.require("goog.object");
goog.require("goog.string");
goog.require("goog.string");
cljs.core._STAR_clojurescript_version_STAR_ = "0.0-2371";
cljs.core._STAR_unchecked_if_STAR_ = false;
cljs.core._STAR_print_fn_STAR_ = function _STAR_print_fn_STAR_(_) {
throw new Error("No *print-fn* fn set for evaluation environment");
};
cljs.core.set_print_fn_BANG_ = function set_print_fn_BANG_(f) {
return cljs.core._STAR_print_fn_STAR_ = f;
};
cljs.core._STAR_flush_on_newline_STAR_ = true;
cljs.core._STAR_print_newline_STAR_ = true;
cljs.core._STAR_print_readably_STAR_ = true;
cljs.core._STAR_print_meta_STAR_ = false;
cljs.core._STAR_print_dup_STAR_ = false;