(function(){
"use strict";
var ρσ_iterator_symbol = (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") ? Symbol.iterator : "iterator-Symbol-5d0927e5554349048cf0e3762a228256";
var ρσ_kwargs_symbol = (typeof Symbol === "function") ? Symbol("kwargs-object") : "kwargs-object-Symbol-5d0927e5554349048cf0e3762a228256";
var ρσ_cond_temp, ρσ_expr_temp, ρσ_last_exception;
var ρσ_object_counter = 0;
if( typeof HTMLCollection !== "undefined" && typeof Symbol === "function") NodeList.prototype[Symbol.iterator] = HTMLCollection.prototype[Symbol.iterator] = NamedNodeMap.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];
var ρσ_len;
function ρσ_bool(val) {
return !!val;
};
if (!ρσ_bool.__argnames__) Object.defineProperties(ρσ_bool, {
__argnames__ : {value: ["val"]},
__module__ : {value: "__main__"}
});
function ρσ_print() {
var parts;
if (typeof console === "object") {
parts = [];
for (var i = 0; i < arguments.length; i++) {
parts.push(ρσ_str(arguments[i]));
}
console.log(parts.join(" "));
}
};
if (!ρσ_print.__module__) Object.defineProperties(ρσ_print, {
__module__ : {value: "__main__"}
});
function ρσ_int(val, base) {
var ans;
if (typeof val === "number") {
ans = val | 0;
} else {
ans = parseInt(val, base || 10);
}
if (isNaN(ans)) {
throw new ValueError("Invalid literal for int with base " + (base || 10) + ": " + val);
}
return ans;
};
if (!ρσ_int.__argnames__) Object.defineProperties(ρσ_int, {
__argnames__ : {value: ["val", "base"]},
__module__ : {value: "__main__"}
});
function ρσ_float(val) {
var ans;
if (typeof val === "number") {
ans = val;
} else {
ans = parseFloat(val);
}
if (isNaN(ans)) {
throw new ValueError("Could not convert string to float: " + arguments[0]);
}
return ans;
};
if (!ρσ_float.__argnames__) Object.defineProperties(ρσ_float, {
__argnames__ : {value: ["val"]},
__module__ : {value: "__main__"}
});
function ρσ_arraylike_creator() {
var names;
names = ("Int8Array Uint8Array Uint8ClampedArray Int16Array" + " Uint16Array Int32Array Uint32Array Float32Array" + " Float64Array").split(" ");
if (typeof HTMLCollection === "function") {
names = names.concat("HTMLCollection NodeList NamedNodeMap TouchList".split(" "));
}
return (function() {
var ρσ_anonfunc = function (x) {
if (Array.isArray(x) || typeof x === "string" || names.indexOf(Object.prototype.toString.call(x).slice(8, -1)) > -1) {
return true;
}
return false;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
};
if (!ρσ_arraylike_creator.__module__) Object.defineProperties(ρσ_arraylike_creator, {
__module__ : {value: "__main__"}
});
function options_object(f) {
return (function() {
var ρσ_anonfunc = function () {
if (typeof arguments[arguments.length - 1] === "object") {
arguments[ρσ_bound_index(arguments.length - 1, arguments)][ρσ_kwargs_symbol] = true;
}
return f.apply(this, arguments);
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
};
if (!options_object.__argnames__) Object.defineProperties(options_object, {
__argnames__ : {value: ["f"]},
__module__ : {value: "__main__"}
});
function ρσ_id(x) {
return x.ρσ_object_id;
};
if (!ρσ_id.__argnames__) Object.defineProperties(ρσ_id, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
function ρσ_dir(item) {
var arr;
arr = [];
for (var i in item) {
arr.push(i);
}
return arr;
};
if (!ρσ_dir.__argnames__) Object.defineProperties(ρσ_dir, {
__argnames__ : {value: ["item"]},
__module__ : {value: "__main__"}
});
function ρσ_ord(x) {
var ans, second;
ans = x.charCodeAt(0);
if (55296 <= ans && ans <= 56319) {
second = x.charCodeAt(1);
if (56320 <= second && second <= 57343) {
return (ans - 55296) * 1024 + second - 56320 + 65536;
}
throw new TypeError("string is missing the low surrogate char");
}
return ans;
};
if (!ρσ_ord.__argnames__) Object.defineProperties(ρσ_ord, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
function ρσ_chr(code) {
if (code <= 65535) {
return String.fromCharCode(code);
}
code -= 65536;
return String.fromCharCode(55296 + (code >> 10), 56320 + (code & 1023));
};
if (!ρσ_chr.__argnames__) Object.defineProperties(ρσ_chr, {
__argnames__ : {value: ["code"]},
__module__ : {value: "__main__"}
});
function ρσ_callable(x) {
return typeof x === "function";
};
if (!ρσ_callable.__argnames__) Object.defineProperties(ρσ_callable, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
function ρσ_bin(x) {
var ans;
if (typeof x !== "number" || x % 1 !== 0) {
throw new TypeError("integer required");
}
ans = x.toString(2);
if (ans[0] === "-") {
ans = "-" + "0b" + ans.slice(1);
} else {
ans = "0b" + ans;
}
return ans;
};
if (!ρσ_bin.__argnames__) Object.defineProperties(ρσ_bin, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
function ρσ_hex(x) {
var ans;
if (typeof x !== "number" || x % 1 !== 0) {
throw new TypeError("integer required");
}
ans = x.toString(16);
if (ans[0] === "-") {
ans = "-" + "0x" + ans.slice(1);
} else {
ans = "0x" + ans;
}
return ans;
};
if (!ρσ_hex.__argnames__) Object.defineProperties(ρσ_hex, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
function ρσ_enumerate(iterable) {
var ans, iterator;
ans = {"_i":-1};
ans[ρσ_iterator_symbol] = (function() {
var ρσ_anonfunc = function () {
return this;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
if (ρσ_arraylike(iterable)) {
ans["next"] = (function() {
var ρσ_anonfunc = function () {
this._i += 1;
if (this._i < iterable.length) {
return {'done':false, 'value':[this._i, iterable[this._i]]};
}
return {'done':true};
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ans;
}
if (typeof iterable[ρσ_iterator_symbol] === "function") {
iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
ans["_iterator"] = iterator;
ans["next"] = (function() {
var ρσ_anonfunc = function () {
var r;
r = this._iterator.next();
if (r.done) {
return {'done':true};
}
this._i += 1;
return {'done':false, 'value':[this._i, r.value]};
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ans;
}
return ρσ_enumerate(Object.keys(iterable));
};
if (!ρσ_enumerate.__argnames__) Object.defineProperties(ρσ_enumerate, {
__argnames__ : {value: ["iterable"]},
__module__ : {value: "__main__"}
});
function ρσ_reversed(iterable) {
var ans;
if (ρσ_arraylike(iterable)) {
ans = {"_i": iterable.length};
ans["next"] = (function() {
var ρσ_anonfunc = function () {
this._i -= 1;
if (this._i > -1) {
return {'done':false, 'value':iterable[this._i]};
}
return {'done':true};
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ans[ρσ_iterator_symbol] = (function() {
var ρσ_anonfunc = function () {
return this;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ans;
}
throw new TypeError("reversed() can only be called on arrays or strings");
};
if (!ρσ_reversed.__argnames__) Object.defineProperties(ρσ_reversed, {
__argnames__ : {value: ["iterable"]},
__module__ : {value: "__main__"}
});
function ρσ_iter(iterable) {
var ans;
if (typeof iterable[ρσ_iterator_symbol] === "function") {
return (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
}
if (ρσ_arraylike(iterable)) {
ans = {"_i":-1};
ans[ρσ_iterator_symbol] = (function() {
var ρσ_anonfunc = function () {
return this;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ans["next"] = (function() {
var ρσ_anonfunc = function () {
this._i += 1;
if (this._i < iterable.length) {
return {'done':false, 'value':iterable[this._i]};
}
return {'done':true};
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ans;
}
return ρσ_iter(Object.keys(iterable));
};
if (!ρσ_iter.__argnames__) Object.defineProperties(ρσ_iter, {
__argnames__ : {value: ["iterable"]},
__module__ : {value: "__main__"}
});
function ρσ_range_next(step, length) {
var ρσ_unpack;
this._i += step;
this._idx += 1;
if (this._idx >= length) {
ρσ_unpack = [this.__i, -1];
this._i = ρσ_unpack[0];
this._idx = ρσ_unpack[1];
return {'done':true};
}
return {'done':false, 'value':this._i};
};
if (!ρσ_range_next.__argnames__) Object.defineProperties(ρσ_range_next, {
__argnames__ : {value: ["step", "length"]},
__module__ : {value: "__main__"}
});
function ρσ_range(start, stop, step) {
var length, ans;
if (arguments.length <= 1) {
stop = start || 0;
start = 0;
}
step = arguments[2] || 1;
length = Math.max(Math.ceil((stop - start) / step), 0);
ans = {start:start, step:step, stop:stop};
ans[ρσ_iterator_symbol] = (function() {
var ρσ_anonfunc = function () {
var it;
it = {"_i": start - step, "_idx": -1};
it.next = ρσ_range_next.bind(it, step, length);
it[ρσ_iterator_symbol] = (function() {
var ρσ_anonfunc = function () {
return this;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return it;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ans.count = (function() {
var ρσ_anonfunc = function (val) {
if (!this._cached) {
this._cached = list(this);
}
return this._cached.count(val);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["val"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ans.index = (function() {
var ρσ_anonfunc = function (val) {
if (!this._cached) {
this._cached = list(this);
}
return this._cached.index(val);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["val"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ans.__len__ = (function() {
var ρσ_anonfunc = function () {
return length;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ans.__repr__ = (function() {
var ρσ_anonfunc = function () {
return "range(" + ρσ_str.format("{}", start) + ", " + ρσ_str.format("{}", stop) + ", " + ρσ_str.format("{}", step) + ")";
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ans.__str__ = ans.toString = ans.__repr__;
if (typeof Proxy === "function") {
ans = new Proxy(ans, (function(){
var ρσ_d = {};
ρσ_d["get"] = (function() {
var ρσ_anonfunc = function (obj, prop) {
var iprop;
if (typeof prop === "string") {
iprop = parseInt(prop);
if (!isNaN(iprop)) {
prop = iprop;
}
}
if (typeof prop === "number") {
if (!obj._cached) {
obj._cached = list(obj);
}
return (ρσ_expr_temp = obj._cached)[(typeof prop === "number" && prop < 0) ? ρσ_expr_temp.length + prop : prop];
}
return obj[(typeof prop === "number" && prop < 0) ? obj.length + prop : prop];
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["obj", "prop"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this));
}
return ans;
};
if (!ρσ_range.__argnames__) Object.defineProperties(ρσ_range, {
__argnames__ : {value: ["start", "stop", "step"]},
__module__ : {value: "__main__"}
});
function ρσ_getattr(obj, name, defval) {
var ret;
try {
ret = obj[(typeof name === "number" && name < 0) ? obj.length + name : name];
} catch (ρσ_Exception) {
ρσ_last_exception = ρσ_Exception;
if (ρσ_Exception instanceof TypeError) {
if (defval === undefined) {
throw new AttributeError("The attribute " + name + " is not present");
}
return defval;
} else {
throw ρσ_Exception;
}
}
if (ret === undefined && !(name in obj)) {
if (defval === undefined) {
throw new AttributeError("The attribute " + name + " is not present");
}
ret = defval;
}
return ret;
};
if (!ρσ_getattr.__argnames__) Object.defineProperties(ρσ_getattr, {
__argnames__ : {value: ["obj", "name", "defval"]},
__module__ : {value: "__main__"}
});
function ρσ_setattr(obj, name, value) {
obj[(typeof name === "number" && name < 0) ? obj.length + name : name] = value;
};
if (!ρσ_setattr.__argnames__) Object.defineProperties(ρσ_setattr, {
__argnames__ : {value: ["obj", "name", "value"]},
__module__ : {value: "__main__"}
});
function ρσ_hasattr(obj, name) {
return name in obj;
};
if (!ρσ_hasattr.__argnames__) Object.defineProperties(ρσ_hasattr, {
__argnames__ : {value: ["obj", "name"]},
__module__ : {value: "__main__"}
});
ρσ_len = (function() {
var ρσ_anonfunc = function () {
function len(obj) {
if (ρσ_arraylike(obj)) {
return obj.length;
}
if (typeof obj.__len__ === "function") {
return obj.__len__();
}
if (obj instanceof Set || obj instanceof Map) {
return obj.size;
}
return Object.keys(obj).length;
};
if (!len.__argnames__) Object.defineProperties(len, {
__argnames__ : {value: ["obj"]},
__module__ : {value: "__main__"}
});
function len5(obj) {
if (ρσ_arraylike(obj)) {
return obj.length;
}
if (typeof obj.__len__ === "function") {
return obj.__len__();
}
return Object.keys(obj).length;
};
if (!len5.__argnames__) Object.defineProperties(len5, {
__argnames__ : {value: ["obj"]},
__module__ : {value: "__main__"}
});
return (typeof Set === "function" && typeof Map === "function") ? len : len5;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})()();
function ρσ_get_module(name) {
return ρσ_modules[(typeof name === "number" && name < 0) ? ρσ_modules.length + name : name];
};
if (!ρσ_get_module.__argnames__) Object.defineProperties(ρσ_get_module, {
__argnames__ : {value: ["name"]},
__module__ : {value: "__main__"}
});
function ρσ_pow(x, y, z) {
var ans;
ans = Math.pow(x, y);
if (z !== undefined) {
ans %= z;
}
return ans;
};
if (!ρσ_pow.__argnames__) Object.defineProperties(ρσ_pow, {
__argnames__ : {value: ["x", "y", "z"]},
__module__ : {value: "__main__"}
});
function ρσ_type(x) {
return x.constructor;
};
if (!ρσ_type.__argnames__) Object.defineProperties(ρσ_type, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
function ρσ_divmod(x, y) {
var d;
if (y === 0) {
throw new ZeroDivisionError("integer division or modulo by zero");
}
d = Math.floor(x / y);
return [d, x - d * y];
};
if (!ρσ_divmod.__argnames__) Object.defineProperties(ρσ_divmod, {
__argnames__ : {value: ["x", "y"]},
__module__ : {value: "__main__"}
});
function ρσ_max() {
var kwargs = arguments[arguments.length-1];
if (kwargs === null || typeof kwargs !== "object" || kwargs [ρσ_kwargs_symbol] !== true) kwargs = {};
var args = Array.prototype.slice.call(arguments, 0);
if (kwargs !== null && typeof kwargs === "object" && kwargs [ρσ_kwargs_symbol] === true) args.pop();
var args, x;
if (args.length === 0) {
if (kwargs.defval !== undefined) {
return kwargs.defval;
}
throw new TypeError("expected at least one argument");
}
if (args.length === 1) {
args = args[0];
}
if (kwargs.key) {
args = (function() {
var ρσ_Iter = args, ρσ_Result = [], x;
ρσ_Iter = ((typeof ρσ_Iter[Symbol.iterator] === "function") ? (ρσ_Iter instanceof Map ? ρσ_Iter.keys() : ρσ_Iter) : Object.keys(ρσ_Iter));
for (var ρσ_Index of ρσ_Iter) {
x = ρσ_Index;
ρσ_Result.push(kwargs.key(x));
}
ρσ_Result = ρσ_list_constructor(ρσ_Result);
return ρσ_Result;
})();
}
if (!Array.isArray(args)) {
args = list(args);
}
if (args.length) {
return this.apply(null, args);
}
if (kwargs.defval !== undefined) {
return kwargs.defval;
}
throw new TypeError("expected at least one argument");
};
if (!ρσ_max.__handles_kwarg_interpolation__) Object.defineProperties(ρσ_max, {
__handles_kwarg_interpolation__ : {value: true},
__module__ : {value: "__main__"}
});
var abs = Math.abs, max = ρσ_max.bind(Math.max);
var min = ρσ_max.bind(Math.min), bool = ρσ_bool, type = ρσ_type;
var float = ρσ_float, int = ρσ_int, arraylike = ρσ_arraylike_creator();
var ρσ_arraylike = arraylike;
var print = ρσ_print, id = ρσ_id, get_module = ρσ_get_module;
var pow = ρσ_pow, divmod = ρσ_divmod;
var dir = ρσ_dir, ord = ρσ_ord, chr = ρσ_chr, bin = ρσ_bin;
var hex = ρσ_hex, callable = ρσ_callable;
var enumerate = ρσ_enumerate, iter = ρσ_iter, reversed = ρσ_reversed;
var len = ρσ_len;
var range = ρσ_range, getattr = ρσ_getattr, setattr = ρσ_setattr;
var hasattr = ρσ_hasattr;function ρσ_equals(a, b) {
var ρσ_unpack, akeys, bkeys, key;
if (a === b) {
return true;
}
if (a && typeof a.__eq__ === "function") {
return a.__eq__(b);
}
if (b && typeof b.__eq__ === "function") {
return b.__eq__(a);
}
if (ρσ_arraylike(a) && ρσ_arraylike(b)) {
if ((a.length !== b.length && (typeof a.length !== "object" || ρσ_not_equals(a.length, b.length)))) {
return false;
}
for (var i=0; i < a.length; i++) {
if (!(((a[(typeof i === "number" && i < 0) ? a.length + i : i] === b[(typeof i === "number" && i < 0) ? b.length + i : i] || typeof a[(typeof i === "number" && i < 0) ? a.length + i : i] === "object" && ρσ_equals(a[(typeof i === "number" && i < 0) ? a.length + i : i], b[(typeof i === "number" && i < 0) ? b.length + i : i]))))) {
return false;
}
}
return true;
}
if (typeof a === "object" && typeof b === "object" && a !== null && b !== null && (a.constructor === Object && b.constructor === Object || Object.getPrototypeOf(a) === null && Object.getPrototypeOf(b) === null)) {
ρσ_unpack = [Object.keys(a), Object.keys(b)];
akeys = ρσ_unpack[0];
bkeys = ρσ_unpack[1];
if (akeys.length !== bkeys.length) {
return false;
}
for (var j=0; j < akeys.length; j++) {
key = akeys[(typeof j === "number" && j < 0) ? akeys.length + j : j];
if (!(((a[(typeof key === "number" && key < 0) ? a.length + key : key] === b[(typeof key === "number" && key < 0) ? b.length + key : key] || typeof a[(typeof key === "number" && key < 0) ? a.length + key : key] === "object" && ρσ_equals(a[(typeof key === "number" && key < 0) ? a.length + key : key], b[(typeof key === "number" && key < 0) ? b.length + key : key]))))) {
return false;
}
}
return true;
}
return false;
};
if (!ρσ_equals.__argnames__) Object.defineProperties(ρσ_equals, {
__argnames__ : {value: ["a", "b"]},
__module__ : {value: "__main__"}
});
function ρσ_not_equals(a, b) {
if (a === b) {
return false;
}
if (a && typeof a.__ne__ === "function") {
return a.__ne__(b);
}
if (b && typeof b.__ne__ === "function") {
return b.__ne__(a);
}
return !ρσ_equals(a, b);
};
if (!ρσ_not_equals.__argnames__) Object.defineProperties(ρσ_not_equals, {
__argnames__ : {value: ["a", "b"]},
__module__ : {value: "__main__"}
});
var equals = ρσ_equals;
function ρσ_list_iterator(value) {
var self;
self = this;
return (function(){
var ρσ_d = {};
ρσ_d["_i"] = -1;
ρσ_d["_list"] = self;
ρσ_d["next"] = (function() {
var ρσ_anonfunc = function () {
this._i += 1;
if (this._i >= this._list.length) {
return (function(){
var ρσ_d = {};
ρσ_d["done"] = true;
return ρσ_d;
}).call(this);
}
return (function(){
var ρσ_d = {};
ρσ_d["done"] = false;
ρσ_d["value"] = (ρσ_expr_temp = this._list)[ρσ_bound_index(this._i, ρσ_expr_temp)];
return ρσ_d;
}).call(this);
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this);
};
if (!ρσ_list_iterator.__argnames__) Object.defineProperties(ρσ_list_iterator, {
__argnames__ : {value: ["value"]},
__module__ : {value: "__main__"}
});
function ρσ_list_constructor(iterable) {
var ans, iterator, result;
if (iterable === undefined) {
ans = [];
} else if (ρσ_arraylike(iterable)) {
ans = new Array(iterable.length);
for (var i = 0; i < iterable.length; i++) {
ans[(typeof i === "number" && i < 0) ? ans.length + i : i] = iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i];
}
} else if (typeof iterable[ρσ_iterator_symbol] === "function") {
iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
ans = [];
result = iterator.next();
while (!result.done) {
ans.push(result.value);
result = iterator.next();
}
} else if (typeof iterable === "number") {
ans = new Array(iterable);
} else {
ans = Object.keys(iterable);
}
return ans;
};
if (!ρσ_list_constructor.__argnames__) Object.defineProperties(ρσ_list_constructor, {
__argnames__ : {value: ["iterable"]},
__module__ : {value: "__main__"}
});
ρσ_list_constructor.__name__ = "list";
if (typeof Array.prototype.append !== "function") {
Object.defineProperty(Array.prototype, "append", (function(){
var ρσ_d = {};
ρσ_d["writable"] = false;
ρσ_d["configurable"] = false;
ρσ_d["enumerable"] = false;
ρσ_d["value"] = Array.prototype.push;
return ρσ_d;
}).call(this));
Object.defineProperty(Array.prototype, "extend", (function(){
var ρσ_d = {};
ρσ_d["writable"] = false;
ρσ_d["configurable"] = false;
ρσ_d["enumerable"] = false;
ρσ_d["value"] = (function() {
var ρσ_anonfunc = function (iterable) {
var start, iterator, result;
if (Array.isArray(iterable) || typeof iterable === "string") {
start = this.length;
this.length += iterable.length;
for (var i = 0; i < iterable.length; i++) {
(ρσ_expr_temp = this)[ρσ_bound_index(start + i, ρσ_expr_temp)] = iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i];
}
} else {
iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
result = iterator.next();
while (!result.done) {
this.push(result.value);
result = iterator.next();
}
}
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["iterable"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this));
Object.defineProperty(Array.prototype, "index", (function(){
var ρσ_d = {};
ρσ_d["writable"] = false;
ρσ_d["configurable"] = false;
ρσ_d["enumerable"] = false;
ρσ_d["value"] = (function() {
var ρσ_anonfunc = function (val, start, stop) {
start = start || 0;
if (start < 0) {
start = this.length + start;
}
if (start < 0) {
throw new ValueError(val + " is not in list");
}
if (stop === undefined) {
stop = this.length;
}
if (stop < 0) {
stop = this.length + stop;
}
for (var i = start; i < stop; i++) {
if (((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === val || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], val))) {
return i;
}
}
throw new ValueError(val + " is not in list");
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["val", "start", "stop"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this));
Object.defineProperty(Array.prototype, "pypop", (function(){
var ρσ_d = {};
ρσ_d["writable"] = false;
ρσ_d["configurable"] = false;
ρσ_d["enumerable"] = false;
ρσ_d["value"] = (function() {
var ρσ_anonfunc = function (index) {
var ans;
if (this.length === 0) {
throw new IndexError("list is empty");
}
if (index === undefined) {
index = -1;
}
ans = this.splice(index, 1);
if (!ans.length) {
throw new IndexError("pop index out of range");
}
return ans[0];
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["index"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this));
Object.defineProperty(Array.prototype, "remove", (function(){
var ρσ_d = {};
ρσ_d["writable"] = false;
ρσ_d["configurable"] = false;
ρσ_d["enumerable"] = false;
ρσ_d["value"] = (function() {
var ρσ_anonfunc = function (value) {
for (var i = 0; i < this.length; i++) {
if (((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === value || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], value))) {
this.splice(i, 1);
return;
}
}
throw new ValueError(value + " not in list");
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["value"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this));
Object.defineProperty(Array.prototype, "toString", (function(){
var ρσ_d = {};
ρσ_d["writable"] = false;
ρσ_d["configurable"] = false;
ρσ_d["enumerable"] = false;
ρσ_d["value"] = (function() {
var ρσ_anonfunc = function () {
return "[" + this.join(", ") + "]";
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this));
Object.defineProperty(Array.prototype, "inspect", (function(){
var ρσ_d = {};
ρσ_d["writable"] = false;
ρσ_d["configurable"] = false;
ρσ_d["enumerable"] = false;
ρσ_d["value"] = (function() {
var ρσ_anonfunc = function () {
return "[" + this.join(", ") + "]";
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this));
Object.defineProperty(Array.prototype, "insert", (function(){
var ρσ_d = {};
ρσ_d["writable"] = false;
ρσ_d["configurable"] = false;
ρσ_d["enumerable"] = false;
ρσ_d["value"] = (function() {
var ρσ_anonfunc = function (index, val) {
if (index < 0) {
index += this.length;
}
index = min(this.length, max(index, 0));
if (index === 0) {
this.unshift(val);
return;
}
for (var i = this.length; i > index; i--) {
(ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] = (ρσ_expr_temp = this)[ρσ_bound_index(i - 1, ρσ_expr_temp)];
}
(ρσ_expr_temp = this)[(typeof index === "number" && index < 0) ? ρσ_expr_temp.length + index : index] = val;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["index", "val"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this));
Object.defineProperty(Array.prototype, "copy", (function(){
var ρσ_d = {};
ρσ_d["writable"] = false;
ρσ_d["configurable"] = false;
ρσ_d["enumerable"] = false;
ρσ_d["value"] = (function() {
var ρσ_anonfunc = function () {
return ρσ_list_constructor(this);
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this));
Object.defineProperty(Array.prototype, "clear", (function(){
var ρσ_d = {};
ρσ_d["writable"] = false;
ρσ_d["configurable"] = false;
ρσ_d["enumerable"] = false;
ρσ_d["value"] = (function() {
var ρσ_anonfunc = function () {
this.length = 0;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this));
Object.defineProperty(Array.prototype, "count", (function(){
var ρσ_d = {};
ρσ_d["writable"] = false;
ρσ_d["configurable"] = false;
ρσ_d["enumerable"] = false;
ρσ_d["value"] = (function() {
var ρσ_anonfunc = function (value) {
return this.reduce((function() {
var ρσ_anonfunc = function (n, val) {
return n + (val === value);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["n", "val"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})(), 0);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["value"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this));
Object.defineProperty(Array.prototype, "pysort", (function(){
var ρσ_d = {};
ρσ_d["writable"] = false;
ρσ_d["configurable"] = false;
ρσ_d["enumerable"] = false;
ρσ_d["value"] = (function() {
var ρσ_anonfunc = function () {
var key = (arguments[0] === undefined || ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ρσ_anonfunc.__defaults__.key : arguments[0];
var reverse = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ρσ_anonfunc.__defaults__.reverse : arguments[1];
var ρσ_kwargs_obj = arguments[arguments.length-1];
if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "key")){
key = ρσ_kwargs_obj.key;
}
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "reverse")){
reverse = ρσ_kwargs_obj.reverse;
}
var _sort_key, _sort_cmp, mult, keymap, posmap, k;
_sort_key = (function() {
var ρσ_anonfunc = function (value) {
var t;
t = typeof value;
if (t === "string" || t === "number") {
return value;
}
return value.toString();
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["value"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
_sort_cmp = (function() {
var ρσ_anonfunc = function (a, b, ap, bp) {
if (a < b) {
return -1;
}
if (a > b) {
return 1;
}
return ap - bp;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["a", "b", "ap", "bp"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
key = key || _sort_key;
mult = (reverse) ? -1 : 1;
keymap = dict();
posmap = dict();
for (var i=0; i < this.length; i++) {
k = (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i];
keymap.set(k, key(k));
posmap.set(k, i);
}
this.sort((function() {
var ρσ_anonfunc = function (a, b) {
return mult * _sort_cmp(keymap.get(a), keymap.get(b), posmap.get(a), posmap.get(b));
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["a", "b"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
};
if (!ρσ_anonfunc.__defaults__) Object.defineProperties(ρσ_anonfunc, {
__defaults__ : {value: {key:null, reverse:false}},
__handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["key", "reverse"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this));
Object.defineProperty(Array.prototype, "as_array", (function(){
var ρσ_d = {};
ρσ_d["writable"] = false;
ρσ_d["configurable"] = false;
ρσ_d["enumerable"] = false;
ρσ_d["value"] = (function() {
var ρσ_anonfunc = function () {
return Array.from(this);
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this));
Object.defineProperty(Array.prototype, "__len__", (function(){
var ρσ_d = {};
ρσ_d["writable"] = false;
ρσ_d["configurable"] = false;
ρσ_d["enumerable"] = false;
ρσ_d["value"] = (function() {
var ρσ_anonfunc = function () {
return this.length;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this));
Object.defineProperty(Array.prototype, "__contains__", (function(){
var ρσ_d = {};
ρσ_d["writable"] = false;
ρσ_d["configurable"] = false;
ρσ_d["enumerable"] = false;
ρσ_d["value"] = (function() {
var ρσ_anonfunc = function (val) {
for (var i = 0; i < this.length; i++) {
if (((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === val || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], val))) {
return true;
}
}
return false;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["val"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this));
Object.defineProperty(Array.prototype, "__eq__", (function(){
var ρσ_d = {};
ρσ_d["writable"] = false;
ρσ_d["configurable"] = false;
ρσ_d["enumerable"] = false;
ρσ_d["value"] = (function() {
var ρσ_anonfunc = function (other) {
if (!ρσ_arraylike(other)) {
return false;
}
if ((this.length !== other.length && (typeof this.length !== "object" || ρσ_not_equals(this.length, other.length)))) {
return false;
}
for (var i = 0; i < this.length; i++) {
if (!((((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === other[(typeof i === "number" && i < 0) ? other.length + i : i] || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], other[(typeof i === "number" && i < 0) ? other.length + i : i]))))) {
return false;
}
}
return true;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["other"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this));
Object.defineProperty(Array.prototype, "constructor", (function(){
var ρσ_d = {};
ρσ_d["writable"] = false;
ρσ_d["configurable"] = false;
ρσ_d["enumerable"] = false;
ρσ_d["value"] = ρσ_list_constructor;
return ρσ_d;
}).call(this));
}
function ρσ_list_decorate(ans) {
return ans;
};
if (!ρσ_list_decorate.__argnames__) Object.defineProperties(ρσ_list_decorate, {
__argnames__ : {value: ["ans"]},
__module__ : {value: "__main__"}
});
var list = ρσ_list_constructor, list_wrap = ρσ_list_decorate;
function sorted() {
var iterable = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
var key = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? sorted.__defaults__.key : arguments[1];
var reverse = (arguments[2] === undefined || ( 2 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? sorted.__defaults__.reverse : arguments[2];
var ρσ_kwargs_obj = arguments[arguments.length-1];
if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "key")){
key = ρσ_kwargs_obj.key;
}
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "reverse")){
reverse = ρσ_kwargs_obj.reverse;
}
var ans;
ans = ρσ_list_constructor(iterable);
ans.pysort(key, reverse);
return ans;
};
if (!sorted.__defaults__) Object.defineProperties(sorted, {
__defaults__ : {value: {key:null, reverse:false}},
__handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["iterable", "key", "reverse"]},
__module__ : {value: "__main__"}
});
var ρσ_global_object_id = 0, ρσ_set_implementation;
function ρσ_set_keyfor(x) {
var t, ans;
t = typeof x;
if (t === "string" || t === "number" || t === "boolean") {
return "_" + t[0] + x;
}
if (x === null) {
return "__!@#$0";
}
ans = x.ρσ_hash_key_prop;
if (ans === undefined) {
ans = "_!@#$" + (++ρσ_global_object_id);
Object.defineProperty(x, "ρσ_hash_key_prop", (function(){
var ρσ_d = {};
ρσ_d["value"] = ans;
return ρσ_d;
}).call(this));
}
return ans;
};
if (!ρσ_set_keyfor.__argnames__) Object.defineProperties(ρσ_set_keyfor, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
function ρσ_set_polyfill() {
this._store = {};
this.size = 0;
};
if (!ρσ_set_polyfill.__module__) Object.defineProperties(ρσ_set_polyfill, {
__module__ : {value: "__main__"}
});
ρσ_set_polyfill.prototype.add = (function() {
var ρσ_anonfunc = function (x) {
var key;
key = ρσ_set_keyfor(x);
if (!Object.prototype.hasOwnProperty.call(this._store, key)) {
this.size += 1;
(ρσ_expr_temp = this._store)[(typeof key === "number" && key < 0) ? ρσ_expr_temp.length + key : key] = x;
}
return this;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set_polyfill.prototype.clear = (function() {
var ρσ_anonfunc = function (x) {
this._store = {};
this.size = 0;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set_polyfill.prototype.delete = (function() {
var ρσ_anonfunc = function (x) {
var key;
key = ρσ_set_keyfor(x);
if (Object.prototype.hasOwnProperty.call(this._store, key)) {
this.size -= 1;
delete this._store[key];
return true;
}
return false;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set_polyfill.prototype.has = (function() {
var ρσ_anonfunc = function (x) {
return Object.prototype.hasOwnProperty.call(this._store, ρσ_set_keyfor(x));
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set_polyfill.prototype.values = (function() {
var ρσ_anonfunc = function (x) {
var ans;
ans = {'_keys': Object.keys(this._store), '_i':-1, '_s':this._store};
ans[ρσ_iterator_symbol] = (function() {
var ρσ_anonfunc = function () {
return this;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ans["next"] = (function() {
var ρσ_anonfunc = function () {
this._i += 1;
if (this._i >= this._keys.length) {
return {'done': true};
}
return {'done':false, 'value':this._s[this._keys[this._i]]};
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ans;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
if (typeof Set !== "function" || typeof Set.prototype.delete !== "function") {
ρσ_set_implementation = ρσ_set_polyfill;
} else {
ρσ_set_implementation = Set;
}
function ρσ_set(iterable) {
var ans, s, iterator, result, keys;
if (this instanceof ρσ_set) {
this.jsset = new ρσ_set_implementation;
ans = this;
if (iterable === undefined) {
return ans;
}
s = ans.jsset;
if (ρσ_arraylike(iterable)) {
for (var i = 0; i < iterable.length; i++) {
s.add(iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i]);
}
} else if (typeof iterable[ρσ_iterator_symbol] === "function") {
iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
result = iterator.next();
while (!result.done) {
s.add(result.value);
result = iterator.next();
}
} else {
keys = Object.keys(iterable);
for (var j=0; j < keys.length; j++) {
s.add(keys[(typeof j === "number" && j < 0) ? keys.length + j : j]);
}
}
return ans;
} else {
return new ρσ_set(iterable);
}
};
if (!ρσ_set.__argnames__) Object.defineProperties(ρσ_set, {
__argnames__ : {value: ["iterable"]},
__module__ : {value: "__main__"}
});
ρσ_set.prototype.__name__ = "set";
Object.defineProperties(ρσ_set.prototype, (function(){
var ρσ_d = {};
ρσ_d["length"] = (function(){
var ρσ_d = {};
ρσ_d["get"] = (function() {
var ρσ_anonfunc = function () {
return this.jsset.size;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this);
ρσ_d["size"] = (function(){
var ρσ_d = {};
ρσ_d["get"] = (function() {
var ρσ_anonfunc = function () {
return this.jsset.size;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this);
return ρσ_d;
}).call(this));
ρσ_set.prototype.__len__ = (function() {
var ρσ_anonfunc = function () {
return this.jsset.size;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set.prototype.has = ρσ_set.prototype.__contains__ = (function() {
var ρσ_anonfunc = function (x) {
return this.jsset.has(x);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set.prototype.add = (function() {
var ρσ_anonfunc = function (x) {
this.jsset.add(x);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set.prototype.clear = (function() {
var ρσ_anonfunc = function () {
this.jsset.clear();
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set.prototype.copy = (function() {
var ρσ_anonfunc = function () {
return ρσ_set(this);
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set.prototype.discard = (function() {
var ρσ_anonfunc = function (x) {
this.jsset.delete(x);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set.prototype[ρσ_iterator_symbol] = (function() {
var ρσ_anonfunc = function () {
return this.jsset.values();
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set.prototype.difference = (function() {
var ρσ_anonfunc = function () {
var ans, s, iterator, r, x, has;
ans = new ρσ_set;
s = ans.jsset;
iterator = this.jsset.values();
r = iterator.next();
while (!r.done) {
x = r.value;
has = false;
for (var i = 0; i < arguments.length; i++) {
if (arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i].has(x)) {
has = true;
break;
}
}
if (!has) {
s.add(x);
}
r = iterator.next();
}
return ans;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set.prototype.difference_update = (function() {
var ρσ_anonfunc = function () {
var s, remove, iterator, r, x;
s = this.jsset;
remove = [];
iterator = s.values();
r = iterator.next();
while (!r.done) {
x = r.value;
for (var i = 0; i < arguments.length; i++) {
if (arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i].has(x)) {
remove.push(x);
break;
}
}
r = iterator.next();
}
for (var j = 0; j < remove.length; j++) {
s.delete(remove[(typeof j === "number" && j < 0) ? remove.length + j : j]);
}
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set.prototype.intersection = (function() {
var ρσ_anonfunc = function () {
var ans, s, iterator, r, x, has;
ans = new ρσ_set;
s = ans.jsset;
iterator = this.jsset.values();
r = iterator.next();
while (!r.done) {
x = r.value;
has = true;
for (var i = 0; i < arguments.length; i++) {
if (!arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i].has(x)) {
has = false;
break;
}
}
if (has) {
s.add(x);
}
r = iterator.next();
}
return ans;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set.prototype.intersection_update = (function() {
var ρσ_anonfunc = function () {
var s, remove, iterator, r, x;
s = this.jsset;
remove = [];
iterator = s.values();
r = iterator.next();
while (!r.done) {
x = r.value;
for (var i = 0; i < arguments.length; i++) {
if (!arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i].has(x)) {
remove.push(x);
break;
}
}
r = iterator.next();
}
for (var j = 0; j < remove.length; j++) {
s.delete(remove[(typeof j === "number" && j < 0) ? remove.length + j : j]);
}
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set.prototype.isdisjoint = (function() {
var ρσ_anonfunc = function (other) {
var iterator, r, x;
iterator = this.jsset.values();
r = iterator.next();
while (!r.done) {
x = r.value;
if (other.has(x)) {
return false;
}
r = iterator.next();
}
return true;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["other"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set.prototype.issubset = (function() {
var ρσ_anonfunc = function (other) {
var iterator, r, x;
iterator = this.jsset.values();
r = iterator.next();
while (!r.done) {
x = r.value;
if (!other.has(x)) {
return false;
}
r = iterator.next();
}
return true;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["other"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set.prototype.issuperset = (function() {
var ρσ_anonfunc = function (other) {
var s, iterator, r, x;
s = this.jsset;
iterator = other.jsset.values();
r = iterator.next();
while (!r.done) {
x = r.value;
if (!s.has(x)) {
return false;
}
r = iterator.next();
}
return true;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["other"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set.prototype.pop = (function() {
var ρσ_anonfunc = function () {
var iterator, r;
iterator = this.jsset.values();
r = iterator.next();
if (r.done) {
throw new KeyError("pop from an empty set");
}
this.jsset.delete(r.value);
return r.value;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set.prototype.remove = (function() {
var ρσ_anonfunc = function (x) {
if (!this.jsset.delete(x)) {
throw new KeyError(x.toString());
}
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set.prototype.symmetric_difference = (function() {
var ρσ_anonfunc = function (other) {
return this.union(other).difference(this.intersection(other));
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["other"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set.prototype.symmetric_difference_update = (function() {
var ρσ_anonfunc = function (other) {
var common;
common = this.intersection(other);
this.update(other);
this.difference_update(common);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["other"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set.prototype.union = (function() {
var ρσ_anonfunc = function () {
var ans;
ans = ρσ_set(this);
ans.update.apply(ans, arguments);
return ans;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set.prototype.update = (function() {
var ρσ_anonfunc = function () {
var s, iterator, r;
s = this.jsset;
for (var i=0; i < arguments.length; i++) {
iterator = arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i][ρσ_iterator_symbol]();
r = iterator.next();
while (!r.done) {
s.add(r.value);
r = iterator.next();
}
}
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set.prototype.toString = ρσ_set.prototype.__repr__ = ρσ_set.prototype.__str__ = ρσ_set.prototype.inspect = (function() {
var ρσ_anonfunc = function () {
return "{" + list(this).join(", ") + "}";
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_set.prototype.__eq__ = (function() {
var ρσ_anonfunc = function (other) {
var iterator, r;
if (!other instanceof this.constructor) {
return false;
}
if (other.size !== this.size) {
return false;
}
if (other.size === 0) {
return true;
}
iterator = other[ρσ_iterator_symbol]();
r = iterator.next();
while (!r.done) {
if (!this.has(r.value)) {
return false;
}
r = iterator.next();
}
return true;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["other"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
function ρσ_set_wrap(x) {
var ans;
ans = new ρσ_set;
ans.jsset = x;
return ans;
};
if (!ρσ_set_wrap.__argnames__) Object.defineProperties(ρσ_set_wrap, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
var set = ρσ_set, set_wrap = ρσ_set_wrap;
var ρσ_dict_implementation;
function ρσ_dict_polyfill() {
this._store = {};
this.size = 0;
};
if (!ρσ_dict_polyfill.__module__) Object.defineProperties(ρσ_dict_polyfill, {
__module__ : {value: "__main__"}
});
ρσ_dict_polyfill.prototype.set = (function() {
var ρσ_anonfunc = function (x, value) {
var key;
key = ρσ_set_keyfor(x);
if (!Object.prototype.hasOwnProperty.call(this._store, key)) {
this.size += 1;
}
(ρσ_expr_temp = this._store)[(typeof key === "number" && key < 0) ? ρσ_expr_temp.length + key : key] = [x, value];
return this;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["x", "value"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict_polyfill.prototype.clear = (function() {
var ρσ_anonfunc = function (x) {
this._store = {};
this.size = 0;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict_polyfill.prototype.delete = (function() {
var ρσ_anonfunc = function (x) {
var key;
key = ρσ_set_keyfor(x);
if (Object.prototype.hasOwnProperty.call(this._store, key)) {
this.size -= 1;
delete this._store[key];
return true;
}
return false;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict_polyfill.prototype.has = (function() {
var ρσ_anonfunc = function (x) {
return Object.prototype.hasOwnProperty.call(this._store, ρσ_set_keyfor(x));
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict_polyfill.prototype.get = (function() {
var ρσ_anonfunc = function (x) {
try {
return (ρσ_expr_temp = this._store)[ρσ_bound_index(ρσ_set_keyfor(x), ρσ_expr_temp)][1];
} catch (ρσ_Exception) {
ρσ_last_exception = ρσ_Exception;
if (ρσ_Exception instanceof TypeError) {
return undefined;
} else {
throw ρσ_Exception;
}
}
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict_polyfill.prototype.values = (function() {
var ρσ_anonfunc = function (x) {
var ans;
ans = {'_keys': Object.keys(this._store), '_i':-1, '_s':this._store};
ans[ρσ_iterator_symbol] = (function() {
var ρσ_anonfunc = function () {
return this;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ans["next"] = (function() {
var ρσ_anonfunc = function () {
this._i += 1;
if (this._i >= this._keys.length) {
return {'done': true};
}
return {'done':false, 'value':this._s[this._keys[this._i]][1]};
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ans;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict_polyfill.prototype.keys = (function() {
var ρσ_anonfunc = function (x) {
var ans;
ans = {'_keys': Object.keys(this._store), '_i':-1, '_s':this._store};
ans[ρσ_iterator_symbol] = (function() {
var ρσ_anonfunc = function () {
return this;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ans["next"] = (function() {
var ρσ_anonfunc = function () {
this._i += 1;
if (this._i >= this._keys.length) {
return {'done': true};
}
return {'done':false, 'value':this._s[this._keys[this._i]][0]};
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ans;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict_polyfill.prototype.entries = (function() {
var ρσ_anonfunc = function (x) {
var ans;
ans = {'_keys': Object.keys(this._store), '_i':-1, '_s':this._store};
ans[ρσ_iterator_symbol] = (function() {
var ρσ_anonfunc = function () {
return this;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ans["next"] = (function() {
var ρσ_anonfunc = function () {
this._i += 1;
if (this._i >= this._keys.length) {
return {'done': true};
}
return {'done':false, 'value':this._s[this._keys[this._i]]};
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ans;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
if (typeof Map !== "function" || typeof Map.prototype.delete !== "function") {
ρσ_dict_implementation = ρσ_dict_polyfill;
} else {
ρσ_dict_implementation = Map;
}
function ρσ_dict() {
var iterable = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
var kw = arguments[arguments.length-1];
if (kw === null || typeof kw !== "object" || kw [ρσ_kwargs_symbol] !== true) kw = {};
if (this instanceof ρσ_dict) {
this.jsmap = new ρσ_dict_implementation;
if (iterable !== undefined) {
this.update(iterable);
}
this.update(kw);
return this;
} else {
return ρσ_interpolate_kwargs_constructor.call(Object.create(ρσ_dict.prototype), false, ρσ_dict, [iterable].concat([ρσ_desugar_kwargs(kw)]));
}
};
if (!ρσ_dict.__handles_kwarg_interpolation__) Object.defineProperties(ρσ_dict, {
__handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["iterable"]},
__module__ : {value: "__main__"}
});
ρσ_dict.prototype.__name__ = "dict";
Object.defineProperties(ρσ_dict.prototype, (function(){
var ρσ_d = {};
ρσ_d["length"] = (function(){
var ρσ_d = {};
ρσ_d["get"] = (function() {
var ρσ_anonfunc = function () {
return this.jsmap.size;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this);
ρσ_d["size"] = (function(){
var ρσ_d = {};
ρσ_d["get"] = (function() {
var ρσ_anonfunc = function () {
return this.jsmap.size;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this);
return ρσ_d;
}).call(this));
ρσ_dict.prototype.__len__ = (function() {
var ρσ_anonfunc = function () {
return this.jsmap.size;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict.prototype.has = ρσ_dict.prototype.__contains__ = (function() {
var ρσ_anonfunc = function (x) {
return this.jsmap.has(x);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict.prototype.set = ρσ_dict.prototype.__setitem__ = (function() {
var ρσ_anonfunc = function (key, value) {
this.jsmap.set(key, value);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["key", "value"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict.prototype.__delitem__ = (function() {
var ρσ_anonfunc = function (key) {
this.jsmap.delete(key);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["key"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict.prototype.clear = (function() {
var ρσ_anonfunc = function () {
this.jsmap.clear();
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict.prototype.copy = (function() {
var ρσ_anonfunc = function () {
return ρσ_dict(this);
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict.prototype.keys = (function() {
var ρσ_anonfunc = function () {
return this.jsmap.keys();
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict.prototype.values = (function() {
var ρσ_anonfunc = function () {
return this.jsmap.values();
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict.prototype.items = ρσ_dict.prototype.entries = (function() {
var ρσ_anonfunc = function () {
return this.jsmap.entries();
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict.prototype[ρσ_iterator_symbol] = (function() {
var ρσ_anonfunc = function () {
return this.jsmap.keys();
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict.prototype.__getitem__ = (function() {
var ρσ_anonfunc = function (key) {
var ans;
ans = this.jsmap.get(key);
if (ans === undefined && !this.jsmap.has(key)) {
throw new KeyError(key + "");
}
return ans;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["key"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict.prototype.get = (function() {
var ρσ_anonfunc = function (key, defval) {
var ans;
ans = this.jsmap.get(key);
if (ans === undefined && !this.jsmap.has(key)) {
return (defval === undefined) ? null : defval;
}
return ans;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["key", "defval"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict.prototype.set_default = ρσ_dict.prototype.setdefault = (function() {
var ρσ_anonfunc = function (key, defval) {
var j;
j = this.jsmap;
if (!j.has(key)) {
j.set(key, defval);
return defval;
}
return j.get(key);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["key", "defval"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict.fromkeys = ρσ_dict.prototype.fromkeys = (function() {
var ρσ_anonfunc = function () {
var iterable = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
var value = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ρσ_anonfunc.__defaults__.value : arguments[1];
var ρσ_kwargs_obj = arguments[arguments.length-1];
if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "value")){
value = ρσ_kwargs_obj.value;
}
var ans, iterator, r;
ans = ρσ_dict();
iterator = iter(iterable);
r = iterator.next();
while (!r.done) {
ans.set(r.value, value);
r = iterator.next();
}
return ans;
};
if (!ρσ_anonfunc.__defaults__) Object.defineProperties(ρσ_anonfunc, {
__defaults__ : {value: {value:null}},
__handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["iterable", "value"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict.prototype.pop = (function() {
var ρσ_anonfunc = function (key, defval) {
var ans;
ans = this.jsmap.get(key);
if (ans === undefined && !this.jsmap.has(key)) {
if (defval === undefined) {
throw new KeyError(key);
}
return defval;
}
this.jsmap.delete(key);
return ans;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["key", "defval"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict.prototype.popitem = (function() {
var ρσ_anonfunc = function () {
var last, e, r;
last = null;
e = this.jsmap.entries();
while (true) {
r = e.next();
if (r.done) {
if (last === null) {
throw new KeyError("dict is empty");
}
this.jsmap.delete(last.value[0]);
return last.value;
}
last = r;
}
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict.prototype.update = (function() {
var ρσ_anonfunc = function () {
var m, iterable, iterator, result, keys;
if (arguments.length === 0) {
return;
}
m = this.jsmap;
iterable = arguments[0];
if (Array.isArray(iterable)) {
for (var i = 0; i < iterable.length; i++) {
m.set(iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i][0], iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i][1]);
}
} else if (iterable instanceof ρσ_dict) {
iterator = iterable.items();
result = iterator.next();
while (!result.done) {
m.set(result.value[0], result.value[1]);
result = iterator.next();
}
} else if (typeof Map === "function" && iterable instanceof Map) {
iterator = iterable.entries();
result = iterator.next();
while (!result.done) {
m.set(result.value[0], result.value[1]);
result = iterator.next();
}
} else if (typeof iterable[ρσ_iterator_symbol] === "function") {
iterator = iterable[ρσ_iterator_symbol]();
result = iterator.next();
while (!result.done) {
m.set(result.value[0], result.value[1]);
result = iterator.next();
}
} else {
keys = Object.keys(iterable);
for (var j=0; j < keys.length; j++) {
if (keys[(typeof j === "number" && j < 0) ? keys.length + j : j] !== ρσ_iterator_symbol) {
m.set(keys[(typeof j === "number" && j < 0) ? keys.length + j : j], iterable[ρσ_bound_index(keys[(typeof j === "number" && j < 0) ? keys.length + j : j], iterable)]);
}
}
}
if (arguments.length > 1) {
ρσ_dict.prototype.update.call(this, arguments[1]);
}
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict.prototype.toString = ρσ_dict.prototype.inspect = ρσ_dict.prototype.__str__ = ρσ_dict.prototype.__repr__ = (function() {
var ρσ_anonfunc = function () {
var entries, iterator, r;
entries = [];
iterator = this.jsmap.entries();
r = iterator.next();
while (!r.done) {
entries.push(ρσ_repr(r.value[0]) + ": " + ρσ_repr(r.value[1]));
r = iterator.next();
}
return "{" + entries.join(", ") + "}";
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict.prototype.__eq__ = (function() {
var ρσ_anonfunc = function (other) {
var iterator, r, x;
if (!(other instanceof this.constructor)) {
return false;
}
if (other.size !== this.size) {
return false;
}
if (other.size === 0) {
return true;
}
iterator = other.items();
r = iterator.next();
while (!r.done) {
x = this.jsmap.get(r.value[0]);
if (x === undefined && !this.jsmap.has(r.value[0]) || x !== r.value[1]) {
return false;
}
r = iterator.next();
}
return true;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["other"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_dict.prototype.as_object = (function() {
var ρσ_anonfunc = function (other) {
var ans, iterator, r;
ans = {};
iterator = this.jsmap.entries();
r = iterator.next();
while (!r.done) {
ans[ρσ_bound_index(r.value[0], ans)] = r.value[1];
r = iterator.next();
}
return ans;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["other"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
function ρσ_dict_wrap(x) {
var ans;
ans = new ρσ_dict;
ans.jsmap = x;
return ans;
};
if (!ρσ_dict_wrap.__argnames__) Object.defineProperties(ρσ_dict_wrap, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
var dict = ρσ_dict, dict_wrap = ρσ_dict_wrap;// }}}
var NameError;
NameError = ReferenceError;
function Exception() {
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
Exception.prototype.__init__.apply(this, arguments);
}
ρσ_extends(Exception, Error);
Exception.prototype.__init__ = function __init__(message) {
var self = this;
self.message = message;
self.stack = (new Error).stack;
self.name = self.constructor.name;
};
if (!Exception.prototype.__init__.__argnames__) Object.defineProperties(Exception.prototype.__init__, {
__argnames__ : {value: ["message"]},
__module__ : {value: "__main__"}
});
Exception.__argnames__ = Exception.prototype.__init__.__argnames__;
Exception.__handles_kwarg_interpolation__ = Exception.prototype.__init__.__handles_kwarg_interpolation__;
Exception.prototype.__repr__ = function __repr__() {
var self = this;
return self.name + ": " + self.message;
};
if (!Exception.prototype.__repr__.__module__) Object.defineProperties(Exception.prototype.__repr__, {
__module__ : {value: "__main__"}
});
Exception.prototype.__str__ = function __str__ () {
if(Error.prototype.__str__) return Error.prototype.__str__.call(this);
return this.__repr__();
};
Object.defineProperty(Exception.prototype, "__bases__", {value: [Error]});
function AttributeError() {
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
AttributeError.prototype.__init__.apply(this, arguments);
}
ρσ_extends(AttributeError, Exception);
AttributeError.prototype.__init__ = function __init__ () {
Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
};
AttributeError.prototype.__repr__ = function __repr__ () {
if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
};
AttributeError.prototype.__str__ = function __str__ () {
if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
return this.__repr__();
};
Object.defineProperty(AttributeError.prototype, "__bases__", {value: [Exception]});
function IndexError() {
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
IndexError.prototype.__init__.apply(this, arguments);
}
ρσ_extends(IndexError, Exception);
IndexError.prototype.__init__ = function __init__ () {
Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
};
IndexError.prototype.__repr__ = function __repr__ () {
if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
};
IndexError.prototype.__str__ = function __str__ () {
if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
return this.__repr__();
};
Object.defineProperty(IndexError.prototype, "__bases__", {value: [Exception]});
function KeyError() {
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
KeyError.prototype.__init__.apply(this, arguments);
}
ρσ_extends(KeyError, Exception);
KeyError.prototype.__init__ = function __init__ () {
Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
};
KeyError.prototype.__repr__ = function __repr__ () {
if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
};
KeyError.prototype.__str__ = function __str__ () {
if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
return this.__repr__();
};
Object.defineProperty(KeyError.prototype, "__bases__", {value: [Exception]});
function ValueError() {
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
ValueError.prototype.__init__.apply(this, arguments);
}
ρσ_extends(ValueError, Exception);
ValueError.prototype.__init__ = function __init__ () {
Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
};
ValueError.prototype.__repr__ = function __repr__ () {
if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
};
ValueError.prototype.__str__ = function __str__ () {
if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
return this.__repr__();
};
Object.defineProperty(ValueError.prototype, "__bases__", {value: [Exception]});
function UnicodeDecodeError() {
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
UnicodeDecodeError.prototype.__init__.apply(this, arguments);
}
ρσ_extends(UnicodeDecodeError, Exception);
UnicodeDecodeError.prototype.__init__ = function __init__ () {
Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
};
UnicodeDecodeError.prototype.__repr__ = function __repr__ () {
if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
};
UnicodeDecodeError.prototype.__str__ = function __str__ () {
if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
return this.__repr__();
};
Object.defineProperty(UnicodeDecodeError.prototype, "__bases__", {value: [Exception]});
function AssertionError() {
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
AssertionError.prototype.__init__.apply(this, arguments);
}
ρσ_extends(AssertionError, Exception);
AssertionError.prototype.__init__ = function __init__ () {
Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
};
AssertionError.prototype.__repr__ = function __repr__ () {
if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
};
AssertionError.prototype.__str__ = function __str__ () {
if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
return this.__repr__();
};
Object.defineProperty(AssertionError.prototype, "__bases__", {value: [Exception]});
function ZeroDivisionError() {
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
ZeroDivisionError.prototype.__init__.apply(this, arguments);
}
ρσ_extends(ZeroDivisionError, Exception);
ZeroDivisionError.prototype.__init__ = function __init__ () {
Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
};
ZeroDivisionError.prototype.__repr__ = function __repr__ () {
if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
};
ZeroDivisionError.prototype.__str__ = function __str__ () {
if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
return this.__repr__();
};
Object.defineProperty(ZeroDivisionError.prototype, "__bases__", {value: [Exception]});
var ρσ_in, ρσ_desugar_kwargs, ρσ_exists;
function ρσ_eslice(arr, step, start, end) {
var is_string;
if (typeof arr === "string" || arr instanceof String) {
is_string = true;
arr = arr.split("");
}
if (step < 0) {
step = -step;
arr = arr.slice().reverse();
if (typeof start !== "undefined") {
start = arr.length - start - 1;
}
if (typeof end !== "undefined") {
end = arr.length - end - 1;
}
}
if (typeof start === "undefined") {
start = 0;
}
if (typeof end === "undefined") {
end = arr.length;
}
arr = arr.slice(start, end).filter((function() {
var ρσ_anonfunc = function (e, i) {
return i % step === 0;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["e", "i"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
if (is_string) {
arr = arr.join("");
}
return arr;
};
if (!ρσ_eslice.__argnames__) Object.defineProperties(ρσ_eslice, {
__argnames__ : {value: ["arr", "step", "start", "end"]},
__module__ : {value: "__main__"}
});
function ρσ_delslice(arr, step, start, end) {
var is_string, ρσ_unpack, indices;
if (typeof arr === "string" || arr instanceof String) {
is_string = true;
arr = arr.split("");
}
if (step < 0) {
if (typeof start === "undefined") {
start = arr.length;
}
if (typeof end === "undefined") {
end = 0;
}
ρσ_unpack = [end, start, -step];
start = ρσ_unpack[0];
end = ρσ_unpack[1];
step = ρσ_unpack[2];
}
if (typeof start === "undefined") {
start = 0;
}
if (typeof end === "undefined") {
end = arr.length;
}
if (step === 1) {
arr.splice(start, end - start);
} else {
if (end > start) {
indices = [];
for (var i = start; i < end; i += step) {
indices.push(i);
}
for (var i = indices.length - 1; i >= 0; i--) {
arr.splice(indices[(typeof i === "number" && i < 0) ? indices.length + i : i], 1);
}
}
}
if (is_string) {
arr = arr.join("");
}
return arr;
};
if (!ρσ_delslice.__argnames__) Object.defineProperties(ρσ_delslice, {
__argnames__ : {value: ["arr", "step", "start", "end"]},
__module__ : {value: "__main__"}
});
function ρσ_flatten(arr) {
var ans, value;
ans = [];
for (var i=0; i < arr.length; i++) {
value = arr[(typeof i === "number" && i < 0) ? arr.length + i : i];
if (Array.isArray(value)) {
ans = ans.concat(ρσ_flatten(value));
} else {
ans.push(value);
}
}
return ans;
};
if (!ρσ_flatten.__argnames__) Object.defineProperties(ρσ_flatten, {
__argnames__ : {value: ["arr"]},
__module__ : {value: "__main__"}
});
function ρσ_unpack_asarray(num, iterable) {
var ans, iterator, result;
if (ρσ_arraylike(iterable)) {
return iterable;
}
ans = [];
if (typeof iterable[ρσ_iterator_symbol] === "function") {
iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
result = iterator.next();
while (!result.done && ans.length < num) {
ans.push(result.value);
result = iterator.next();
}
}
return ans;
};
if (!ρσ_unpack_asarray.__argnames__) Object.defineProperties(ρσ_unpack_asarray, {
__argnames__ : {value: ["num", "iterable"]},
__module__ : {value: "__main__"}
});
function ρσ_extends(child, parent) {
child.prototype = Object.create(parent.prototype);
child.prototype.constructor = child;
};
if (!ρσ_extends.__argnames__) Object.defineProperties(ρσ_extends, {
__argnames__ : {value: ["child", "parent"]},
__module__ : {value: "__main__"}
});
ρσ_in = (function() {
var ρσ_anonfunc = function () {
if (typeof Map === "function" && typeof Set === "function") {
return (function() {
var ρσ_anonfunc = function (val, arr) {
if (typeof arr === "string") {
return arr.indexOf(val) !== -1;
}
if (typeof arr.__contains__ === "function") {
return arr.__contains__(val);
}
if (arr instanceof Map || arr instanceof Set) {
return arr.has(val);
}
if (ρσ_arraylike(arr)) {
return Array.prototype.__contains__.call(arr, val);
}
return Object.prototype.hasOwnProperty.call(arr, val);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["val", "arr"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
}
return (function() {
var ρσ_anonfunc = function (val, arr) {
if (typeof arr === "string") {
return arr.indexOf(val) !== -1;
}
if (typeof arr.__contains__ === "function") {
return arr.__contains__(val);
}
if (ρσ_arraylike(arr)) {
return Array.prototype.__contains__.call(arr, val);
}
return Object.prototype.hasOwnProperty.call(arr, val);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["val", "arr"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})()();
function ρσ_Iterable(iterable) {
var iterator, ans, result;
if (ρσ_arraylike(iterable)) {
return iterable;
}
if (typeof iterable[ρσ_iterator_symbol] === "function") {
iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
ans = [];
result = iterator.next();
while (!result.done) {
ans.push(result.value);
result = iterator.next();
}
return ans;
}
return Object.keys(iterable);
};
if (!ρσ_Iterable.__argnames__) Object.defineProperties(ρσ_Iterable, {
__argnames__ : {value: ["iterable"]},
__module__ : {value: "__main__"}
});
ρσ_desugar_kwargs = (function() {
var ρσ_anonfunc = function () {
if (typeof Object.assign === "function") {
return (function() {
var ρσ_anonfunc = function () {
var ans;
ans = Object.create(null);
ans[ρσ_kwargs_symbol] = true;
for (var i = 0; i < arguments.length; i++) {
Object.assign(ans, arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i]);
}
return ans;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
}
return (function() {
var ρσ_anonfunc = function () {
var ans, keys;
ans = Object.create(null);
ans[ρσ_kwargs_symbol] = true;
for (var i = 0; i < arguments.length; i++) {
keys = Object.keys(arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i]);
for (var j = 0; j < keys.length; j++) {
ans[ρσ_bound_index(keys[(typeof j === "number" && j < 0) ? keys.length + j : j], ans)] = (ρσ_expr_temp = arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i])[ρσ_bound_index(keys[(typeof j === "number" && j < 0) ? keys.length + j : j], ρσ_expr_temp)];
}
}
return ans;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})()();
function ρσ_interpolate_kwargs(f, supplied_args) {
var has_prop, kwobj, args, prop;
if (!f.__argnames__) {
return f.apply(this, supplied_args);
}
has_prop = Object.prototype.hasOwnProperty;
kwobj = supplied_args.pop();
if (f.__handles_kwarg_interpolation__) {
args = new Array(Math.max(supplied_args.length, f.__argnames__.length) + 1);
args[args.length-1] = kwobj;
for (var i = 0; i < args.length - 1; i++) {
if (i < f.__argnames__.length) {
prop = (ρσ_expr_temp = f.__argnames__)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i];
if (has_prop.call(kwobj, prop)) {
args[(typeof i === "number" && i < 0) ? args.length + i : i] = kwobj[(typeof prop === "number" && prop < 0) ? kwobj.length + prop : prop];
delete kwobj[prop];
} else if (i < supplied_args.length) {
args[(typeof i === "number" && i < 0) ? args.length + i : i] = supplied_args[(typeof i === "number" && i < 0) ? supplied_args.length + i : i];
}
} else {
args[(typeof i === "number" && i < 0) ? args.length + i : i] = supplied_args[(typeof i === "number" && i < 0) ? supplied_args.length + i : i];
}
}
return f.apply(this, args);
}
for (var i = 0; i < f.__argnames__.length; i++) {
prop = (ρσ_expr_temp = f.__argnames__)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i];
if (has_prop.call(kwobj, prop)) {
supplied_args[(typeof i === "number" && i < 0) ? supplied_args.length + i : i] = kwobj[(typeof prop === "number" && prop < 0) ? kwobj.length + prop : prop];
}
}
return f.apply(this, supplied_args);
};
if (!ρσ_interpolate_kwargs.__argnames__) Object.defineProperties(ρσ_interpolate_kwargs, {
__argnames__ : {value: ["f", "supplied_args"]},
__module__ : {value: "__main__"}
});
function ρσ_interpolate_kwargs_constructor(apply, f, supplied_args) {
if (apply) {
f.apply(this, supplied_args);
} else {
ρσ_interpolate_kwargs.call(this, f, supplied_args);
}
return this;
};
if (!ρσ_interpolate_kwargs_constructor.__argnames__) Object.defineProperties(ρσ_interpolate_kwargs_constructor, {
__argnames__ : {value: ["apply", "f", "supplied_args"]},
__module__ : {value: "__main__"}
});
function ρσ_getitem(obj, key) {
if (obj.__getitem__) {
return obj.__getitem__(key);
}
if (typeof key === "number" && key < 0) {
key += obj.length;
}
return obj[(typeof key === "number" && key < 0) ? obj.length + key : key];
};
if (!ρσ_getitem.__argnames__) Object.defineProperties(ρσ_getitem, {
__argnames__ : {value: ["obj", "key"]},
__module__ : {value: "__main__"}
});
function ρσ_setitem(obj, key, val) {
if (obj.__setitem__) {
obj.__setitem__(key, val);
} else {
if (typeof key === "number" && key < 0) {
key += obj.length;
}
obj[(typeof key === "number" && key < 0) ? obj.length + key : key] = val;
}
return val;
};
if (!ρσ_setitem.__argnames__) Object.defineProperties(ρσ_setitem, {
__argnames__ : {value: ["obj", "key", "val"]},
__module__ : {value: "__main__"}
});
function ρσ_delitem(obj, key) {
if (obj.__delitem__) {
obj.__delitem__(key);
} else if (typeof obj.splice === "function") {
obj.splice(key, 1);
} else {
if (typeof key === "number" && key < 0) {
key += obj.length;
}
delete obj[key];
}
};
if (!ρσ_delitem.__argnames__) Object.defineProperties(ρσ_delitem, {
__argnames__ : {value: ["obj", "key"]},
__module__ : {value: "__main__"}
});
function ρσ_bound_index(idx, arr) {
if (typeof idx === "number" && idx < 0) {
idx += arr.length;
}
return idx;
};
if (!ρσ_bound_index.__argnames__) Object.defineProperties(ρσ_bound_index, {
__argnames__ : {value: ["idx", "arr"]},
__module__ : {value: "__main__"}
});
function ρσ_splice(arr, val, start, end) {
start = start || 0;
if (start < 0) {
start += arr.length;
}
if (end === undefined) {
end = arr.length;
}
if (end < 0) {
end += arr.length;
}
Array.prototype.splice.apply(arr, [start, end - start].concat(val));
};
if (!ρσ_splice.__argnames__) Object.defineProperties(ρσ_splice, {
__argnames__ : {value: ["arr", "val", "start", "end"]},
__module__ : {value: "__main__"}
});
ρσ_exists = (function(){
var ρσ_d = {};
ρσ_d["n"] = (function() {
var ρσ_anonfunc = function (expr) {
return expr !== undefined && expr !== null;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["expr"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_d["d"] = (function() {
var ρσ_anonfunc = function (expr) {
if (expr === undefined || expr === null) {
return Object.create(null);
}
return expr;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["expr"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_d["c"] = (function() {
var ρσ_anonfunc = function (expr) {
if (typeof expr === "function") {
return expr;
}
return (function() {
var ρσ_anonfunc = function () {
return undefined;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["expr"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_d["g"] = (function() {
var ρσ_anonfunc = function (expr) {
if (expr === undefined || expr === null || typeof expr.__getitem__ !== "function") {
return (function(){
var ρσ_d = {};
ρσ_d["__getitem__"] = (function() {
var ρσ_anonfunc = function () {
return undefined;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this);
}
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["expr"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_d["e"] = (function() {
var ρσ_anonfunc = function (expr, alt) {
return (expr === undefined || expr === null) ? alt : expr;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["expr", "alt"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this);
function ρσ_mixin() {
var seen, resolved_props, p, target, props, name;
seen = Object.create(null);
seen.__argnames__ = seen.__handles_kwarg_interpolation__ = seen.__init__ = seen.__annotations__ = seen.__doc__ = seen.__bind_methods__ = seen.__bases__ = seen.constructor = seen.__class__ = true;
resolved_props = {};
p = target = arguments[0].prototype;
while (p && p !== Object.prototype) {
props = Object.getOwnPropertyNames(p);
for (var i = 0; i < props.length; i++) {
seen[ρσ_bound_index(props[(typeof i === "number" && i < 0) ? props.length + i : i], seen)] = true;
}
p = Object.getPrototypeOf(p);
}
for (var c = 1; c < arguments.length; c++) {
p = arguments[(typeof c === "number" && c < 0) ? arguments.length + c : c].prototype;
while (p && p !== Object.prototype) {
props = Object.getOwnPropertyNames(p);
for (var i = 0; i < props.length; i++) {
name = props[(typeof i === "number" && i < 0) ? props.length + i : i];
if (seen[(typeof name === "number" && name < 0) ? seen.length + name : name]) {
continue;
}
seen[(typeof name === "number" && name < 0) ? seen.length + name : name] = true;
resolved_props[(typeof name === "number" && name < 0) ? resolved_props.length + name : name] = Object.getOwnPropertyDescriptor(p, name);
}
p = Object.getPrototypeOf(p);
}
}
Object.defineProperties(target, resolved_props);
};
if (!ρσ_mixin.__module__) Object.defineProperties(ρσ_mixin, {
__module__ : {value: "__main__"}
});
function ρσ_instanceof() {
var obj, bases, q, cls, p;
obj = arguments[0];
bases = "";
if (obj && obj.constructor && obj.constructor.prototype) {
bases = obj.constructor.prototype.__bases__ || "";
}
for (var i = 1; i < arguments.length; i++) {
q = arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i];
if (obj instanceof q) {
return true;
}
if ((q === Array || q === ρσ_list_constructor) && Array.isArray(obj)) {
return true;
}
if (q === ρσ_str && (typeof obj === "string" || obj instanceof String)) {
return true;
}
if (q === ρσ_int && typeof obj === "number" && Number.isInteger(obj)) {
return true;
}
if (q === ρσ_float && typeof obj === "number" && !Number.isInteger(obj)) {
return true;
}
if (bases.length > 1) {
for (var c = 1; c < bases.length; c++) {
cls = bases[(typeof c === "number" && c < 0) ? bases.length + c : c];
while (cls) {
if (q === cls) {
return true;
}
p = Object.getPrototypeOf(cls.prototype);
if (!p) {
break;
}
cls = p.constructor;
}
}
}
}
return false;
};
if (!ρσ_instanceof.__module__) Object.defineProperties(ρσ_instanceof, {
__module__ : {value: "__main__"}
});
function sum(iterable, start) {
var ans, iterator, r;
if (Array.isArray(iterable)) {
return iterable.reduce((function() {
var ρσ_anonfunc = function (prev, cur) {
return prev + cur;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["prev", "cur"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})(), start || 0);
}
ans = start || 0;
iterator = iter(iterable);
r = iterator.next();
while (!r.done) {
ans += r.value;
r = iterator.next();
}
return ans;
};
if (!sum.__argnames__) Object.defineProperties(sum, {
__argnames__ : {value: ["iterable", "start"]},
__module__ : {value: "__main__"}
});
function map() {
var iterators, func, args, ans;
iterators = new Array(arguments.length - 1);
func = arguments[0];
args = new Array(arguments.length - 1);
for (var i = 1; i < arguments.length; i++) {
iterators[ρσ_bound_index(i - 1, iterators)] = iter(arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i]);
}
ans = {'_func':func, '_iterators':iterators, '_args':args};
ans[ρσ_iterator_symbol] = (function() {
var ρσ_anonfunc = function () {
return this;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ans["next"] = (function() {
var ρσ_anonfunc = function () {
var r;
for (var i = 0; i < this._iterators.length; i++) {
r = (ρσ_expr_temp = this._iterators)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i].next();
if (r.done) {
return {'done':true};
}
(ρσ_expr_temp = this._args)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] = r.value;
}
return {'done':false, 'value':this._func.apply(undefined, this._args)};
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ans;
};
if (!map.__module__) Object.defineProperties(map, {
__module__ : {value: "__main__"}
});
function filter(func_or_none, iterable) {
var func, ans;
func = (func_or_none === null) ? ρσ_bool : func_or_none;
ans = {'_func':func, '_iterator':ρσ_iter(iterable)};
ans[ρσ_iterator_symbol] = (function() {
var ρσ_anonfunc = function () {
return this;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ans["next"] = (function() {
var ρσ_anonfunc = function () {
var r;
r = this._iterator.next();
while (!r.done) {
if (this._func(r.value)) {
return r;
}
r = this._iterator.next();
}
return {'done':true};
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ans;
};
if (!filter.__argnames__) Object.defineProperties(filter, {
__argnames__ : {value: ["func_or_none", "iterable"]},
__module__ : {value: "__main__"}
});
function zip() {
var iterators, ans;
iterators = new Array(arguments.length);
for (var i = 0; i < arguments.length; i++) {
iterators[(typeof i === "number" && i < 0) ? iterators.length + i : i] = iter(arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i]);
}
ans = {'_iterators':iterators};
ans[ρσ_iterator_symbol] = (function() {
var ρσ_anonfunc = function () {
return this;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ans["next"] = (function() {
var ρσ_anonfunc = function () {
var args, r;
args = new Array(this._iterators.length);
for (var i = 0; i < this._iterators.length; i++) {
r = (ρσ_expr_temp = this._iterators)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i].next();
if (r.done) {
return {'done':true};
}
args[(typeof i === "number" && i < 0) ? args.length + i : i] = r.value;
}
return {'done':false, 'value':args};
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ans;
};
if (!zip.__module__) Object.defineProperties(zip, {
__module__ : {value: "__main__"}
});
function any(iterable) {
var i;
var ρσ_Iter0 = iterable;
ρσ_Iter0 = ((typeof ρσ_Iter0[Symbol.iterator] === "function") ? (ρσ_Iter0 instanceof Map ? ρσ_Iter0.keys() : ρσ_Iter0) : Object.keys(ρσ_Iter0));
for (var ρσ_Index0 of ρσ_Iter0) {
i = ρσ_Index0;
if (i) {
return true;
}
}
return false;
};
if (!any.__argnames__) Object.defineProperties(any, {
__argnames__ : {value: ["iterable"]},
__module__ : {value: "__main__"}
});
function all(iterable) {
var i;
var ρσ_Iter1 = iterable;
ρσ_Iter1 = ((typeof ρσ_Iter1[Symbol.iterator] === "function") ? (ρσ_Iter1 instanceof Map ? ρσ_Iter1.keys() : ρσ_Iter1) : Object.keys(ρσ_Iter1));
for (var ρσ_Index1 of ρσ_Iter1) {
i = ρσ_Index1;
if (!i) {
return false;
}
}
return true;
};
if (!all.__argnames__) Object.defineProperties(all, {
__argnames__ : {value: ["iterable"]},
__module__ : {value: "__main__"}
});
var decimal_sep, define_str_func, ρσ_orig_split, ρσ_orig_replace;
decimal_sep = 1.1.toLocaleString()[1];
function ρσ_repr_js_builtin(x, as_array) {
var ans, b, keys, key;
ans = [];
b = "{}";
if (as_array) {
b = "[]";
for (var i = 0; i < x.length; i++) {
ans.push(ρσ_repr(x[(typeof i === "number" && i < 0) ? x.length + i : i]));
}
} else {
keys = Object.keys(x);
for (var k = 0; k < keys.length; k++) {
key = keys[(typeof k === "number" && k < 0) ? keys.length + k : k];
ans.push(JSON.stringify(key) + ":" + ρσ_repr(x[(typeof key === "number" && key < 0) ? x.length + key : key]));
}
}
return b[0] + ans.join(", ") + b[1];
};
if (!ρσ_repr_js_builtin.__argnames__) Object.defineProperties(ρσ_repr_js_builtin, {
__argnames__ : {value: ["x", "as_array"]},
__module__ : {value: "__main__"}
});
function ρσ_html_element_to_string(elem) {
var attrs, val, attr, ans;
attrs = [];
var ρσ_Iter0 = elem.attributes;
ρσ_Iter0 = ((typeof ρσ_Iter0[Symbol.iterator] === "function") ? (ρσ_Iter0 instanceof Map ? ρσ_Iter0.keys() : ρσ_Iter0) : Object.keys(ρσ_Iter0));
for (var ρσ_Index0 of ρσ_Iter0) {
attr = ρσ_Index0;
if (attr.specified) {
val = attr.value;
if (val.length > 10) {
val = val.slice(0, 15) + "...";
}
val = JSON.stringify(val);
attrs.push("" + ρσ_str.format("{}", attr.name) + "=" + ρσ_str.format("{}", val) + "");
}
}
attrs = (attrs.length) ? " " + attrs.join(" ") : "";
ans = "<" + ρσ_str.format("{}", elem.tagName) + "" + ρσ_str.format("{}", attrs) + ">";
return ans;
};
if (!ρσ_html_element_to_string.__argnames__) Object.defineProperties(ρσ_html_element_to_string, {
__argnames__ : {value: ["elem"]},
__module__ : {value: "__main__"}
});
function ρσ_repr(x) {
var ans, name, mapped;
if (x === null) {
return "None";
}
if (x === undefined) {
return "undefined";
}
ans = x;
if (typeof x.__repr__ === "function") {
ans = x.__repr__();
} else if (x === true || x === false) {
ans = (x) ? "True" : "False";
} else if (Array.isArray(x)) {
ans = ρσ_repr_js_builtin(x, true);
} else if (typeof x === "function") {
ans = x.toString();
} else if (typeof x === "object" && !x.toString) {
ans = ρσ_repr_js_builtin(x);
} else {
name = Object.prototype.toString.call(x).slice(8, -1);
if (ρσ_not_equals(("Int8Array Uint8Array Uint8ClampedArray Int16Array" + " Uint16Array Int32Array Uint32Array" + " Float32Array Float64Array").indexOf(name), -1)) {
mapped = x.map((function() {
var ρσ_anonfunc = function (i) {
return str.format("0x{:02x}", i);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["i"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
return name + "([" + mapped.join(", ") + "])";
}
if (typeof HTMLElement !== "undefined" && x instanceof HTMLElement) {
ans = ρσ_html_element_to_string(x);
} else {
ans = (typeof x.toString === "function") ? x.toString() : x;
}
if (ans === "[object Object]") {
return ρσ_repr_js_builtin(x);
}
try {
ans = JSON.stringify(x);
} catch (ρσ_Exception) {
ρσ_last_exception = ρσ_Exception;
{
}
}
}
return ans + "";
};
if (!ρσ_repr.__argnames__) Object.defineProperties(ρσ_repr, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
function ρσ_str(x) {
var ans, name, mapped;
if (x === null) {
return "None";
}
if (x === undefined) {
return "undefined";
}
ans = x;
if (typeof x.__str__ === "function") {
ans = x.__str__();
} else if (typeof x.__repr__ === "function") {
ans = x.__repr__();
} else if (x === true || x === false) {
ans = (x) ? "True" : "False";
} else if (Array.isArray(x)) {
ans = ρσ_repr_js_builtin(x, true);
} else if (typeof x.toString === "function") {
name = Object.prototype.toString.call(x).slice(8, -1);
if (ρσ_not_equals(("Int8Array Uint8Array Uint8ClampedArray Int16Array" + " Uint16Array Int32Array Uint32Array" + " Float32Array Float64Array").indexOf(name), -1)) {
mapped = x.map((function() {
var ρσ_anonfunc = function (i) {
return str.format("0x{:02x}", i);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["i"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
return name + "([" + mapped.join(", ") + "])";
}
if (typeof HTMLElement !== "undefined" && x instanceof HTMLElement) {
ans = ρσ_html_element_to_string(x);
} else {
ans = x.toString();
}
if (ans === "[object Object]") {
ans = ρσ_repr_js_builtin(x);
}
} else if (typeof x === "object" && !x.toString) {
ans = ρσ_repr_js_builtin(x);
}
return ans + "";
};
if (!ρσ_str.__argnames__) Object.defineProperties(ρσ_str, {
__argnames__ : {value: ["x"]},
__module__ : {value: "__main__"}
});
define_str_func = (function() {
var ρσ_anonfunc = function (name, func) {
var f;
(ρσ_expr_temp = ρσ_str.prototype)[(typeof name === "number" && name < 0) ? ρσ_expr_temp.length + name : name] = func;
ρσ_str[(typeof name === "number" && name < 0) ? ρσ_str.length + name : name] = f = func.call.bind(func);
if (func.__argnames__) {
Object.defineProperty(f, "__argnames__", (function(){
var ρσ_d = {};
ρσ_d["value"] = ['string'].concat(func.__argnames__);
return ρσ_d;
}).call(this));
}
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["name", "func"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_orig_split = String.prototype.split.call.bind(String.prototype.split);
ρσ_orig_replace = String.prototype.replace.call.bind(String.prototype.replace);
define_str_func("format", (function() {
var ρσ_anonfunc = function () {
var template, args, kwargs, explicit, implicit, idx, split, ans, pos, in_brace, markup, ch;
template = this;
if (template === undefined) {
throw new TypeError("Template is required");
}
args = Array.from(arguments);
kwargs = {};
if (args[args.length-1] && args[args.length-1][ρσ_kwargs_symbol] !== undefined) {
kwargs = args[args.length-1];
args = args.slice(0, -1);
}
explicit = implicit = false;
idx = 0;
split = ρσ_orig_split;
if (ρσ_str.format._template_resolve_pat === undefined) {
ρσ_str.format._template_resolve_pat = /[.\[]/;
}
function resolve(arg, object) {
var ρσ_unpack, first, key, rest, ans;
if (!arg) {
return object;
}
ρσ_unpack = [arg[0], arg.slice(1)];
first = ρσ_unpack[0];
arg = ρσ_unpack[1];
key = split(arg, ρσ_str.format._template_resolve_pat, 1)[0];
rest = arg.slice(key.length);
ans = (first === "[") ? object[ρσ_bound_index(key.slice(0, -1), object)] : getattr(object, key);
if (ans === undefined) {
throw new KeyError((first === "[") ? key.slice(0, -1) : key);
}
return resolve(rest, ans);
};
if (!resolve.__argnames__) Object.defineProperties(resolve, {
__argnames__ : {value: ["arg", "object"]},
__module__ : {value: "__main__"}
});
function resolve_format_spec(format_spec) {
var pat;
if (ρσ_str.format._template_resolve_fs_pat === undefined) {
ρσ_str.format._template_resolve_fs_pat = /[{]([a-zA-Z0-9_]+)[}]/g;
}
pat = ρσ_str.format._template_resolve_fs_pat;
return format_spec.replace(pat, (function() {
var ρσ_anonfunc = function (match, key) {
if (!Object.prototype.hasOwnProperty.call(kwargs, key)) {
return "";
}
return "" + kwargs[(typeof key === "number" && key < 0) ? kwargs.length + key : key];
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["match", "key"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
};
if (!resolve_format_spec.__argnames__) Object.defineProperties(resolve_format_spec, {
__argnames__ : {value: ["format_spec"]},
__module__ : {value: "__main__"}
});
function set_comma(ans, comma) {
var sep;
if (comma !== ",") {
sep = 1234;
sep = sep.toLocaleString(undefined, {useGrouping: true})[1];
ans = str.replace(ans, sep, comma);
}
return ans;
};
if (!set_comma.__argnames__) Object.defineProperties(set_comma, {
__argnames__ : {value: ["ans", "comma"]},
__module__ : {value: "__main__"}
});
function safe_comma(value, comma) {
try {
return set_comma(value.toLocaleString(undefined, {useGrouping: true}), comma);
} catch (ρσ_Exception) {
ρσ_last_exception = ρσ_Exception;
{
return value.toString(10);
}
}
};
if (!safe_comma.__argnames__) Object.defineProperties(safe_comma, {
__argnames__ : {value: ["value", "comma"]},
__module__ : {value: "__main__"}
});
function safe_fixed(value, precision, comma) {
var ufmt;
if (!comma) {
return value.toFixed(precision);
}
try {
ufmt = (function(){
var ρσ_d = {};
ρσ_d["useGrouping"] = true;
ρσ_d["minimumFractionDigits"] = precision;
ρσ_d["maximumFractionDigits"] = precision;
return ρσ_d;
}).call(this);
return set_comma(value.toLocaleString(undefined, ufmt), comma);
} catch (ρσ_Exception) {
ρσ_last_exception = ρσ_Exception;
{
return value.toFixed(precision);
}
}
};
if (!safe_fixed.__argnames__) Object.defineProperties(safe_fixed, {
__argnames__ : {value: ["value", "precision", "comma"]},
__module__ : {value: "__main__"}
});
function apply_formatting(value, format_spec) {
var m, ρσ_unpack, fill, align, sign, fhash, zeropad, width, comma, precision, ftype, is_numeric, is_int, lftype, code, prec, exp, nval, is_positive, left, right;
if (format_spec.indexOf("{") !== -1) {
format_spec = resolve_format_spec(format_spec);
}
if (ρσ_str.format._template_format_pat === undefined) {
ρσ_str.format._template_format_pat = /([^{}](?=[<>=^]))?([<>=^])?([-+\x20])?(\#)?(0)?(\d+)?([,_])?(?:\.(\d+))?([bcdeEfFgGnosxX%])?/;
}
try {
m = format_spec.match(ρσ_str.format._template_format_pat);
ρσ_unpack = [m[1], m[2], m[3], m[4], m[5]];
fill = ρσ_unpack[0];
align = ρσ_unpack[1];
sign = ρσ_unpack[2];
fhash = ρσ_unpack[3];
zeropad = ρσ_unpack[4];
ρσ_unpack = [m[6], m[7], m[8], m[9]];
width = ρσ_unpack[0];
comma = ρσ_unpack[1];
precision = ρσ_unpack[2];
ftype = ρσ_unpack[3];
} catch (ρσ_Exception) {
ρσ_last_exception = ρσ_Exception;
if (ρσ_Exception instanceof TypeError) {
return value;
} else {
throw ρσ_Exception;
}
}
if (zeropad) {
fill = fill || "0";
align = align || "=";
} else {
fill = fill || " ";
align = align || ">";
}
is_numeric = Number(value) === value;
is_int = is_numeric && value % 1 === 0;
precision = parseInt(precision, 10);
lftype = (ftype || "").toLowerCase();
if (ftype === "n") {
is_numeric = true;
if (is_int) {
if (comma) {
throw new ValueError("Cannot specify ',' with 'n'");
}
value = parseInt(value, 10).toLocaleString();
} else {
value = parseFloat(value).toLocaleString();
}
} else if (['b', 'c', 'd', 'o', 'x'].indexOf(lftype) !== -1) {
value = parseInt(value, 10);
is_numeric = true;
if (!isNaN(value)) {
if (ftype === "b") {
value = (value >>> 0).toString(2);
if (fhash) {
value = "0b" + value;
}
} else if (ftype === "c") {
if (value > 65535) {
code = value - 65536;
value = String.fromCharCode(55296 + (code >> 10), 56320 + (code & 1023));
} else {
value = String.fromCharCode(value);
}
} else if (ftype === "d") {
if (comma) {
value = safe_comma(value, comma);
} else {
value = value.toString(10);
}
} else if (ftype === "o") {
value = value.toString(8);
if (fhash) {
value = "0o" + value;
}
} else if (lftype === "x") {
value = value.toString(16);
value = (ftype === "x") ? value.toLowerCase() : value.toUpperCase();
if (fhash) {
value = "0x" + value;
}
}
}
} else if (['e','f','g','%'].indexOf(lftype) !== -1) {
is_numeric = true;
value = parseFloat(value);
prec = (isNaN(precision)) ? 6 : precision;
if (lftype === "e") {
value = value.toExponential(prec);
value = (ftype === "E") ? value.toUpperCase() : value.toLowerCase();
} else if (lftype === "f") {
value = safe_fixed(value, prec, comma);
value = (ftype === "F") ? value.toUpperCase() : value.toLowerCase();
} else if (lftype === "%") {
value *= 100;
value = safe_fixed(value, prec, comma) + "%";
} else if (lftype === "g") {
prec = max(1, prec);
exp = parseInt(split(value.toExponential(prec - 1).toLowerCase(), "e")[1], 10);
if (-4 <= exp && exp < prec) {
value = safe_fixed(value, prec - 1 - exp, comma);
} else {
value = value.toExponential(prec - 1);
}
value = value.replace(/0+$/g, "");
if (value[value.length-1] === decimal_sep) {
value = value.slice(0, -1);
}
if (ftype === "G") {
value = value.toUpperCase();
}
}
} else {
if (comma) {
value = parseInt(value, 10);
if (isNaN(value)) {
throw new ValueError("Must use numbers with , or _");
}
value = safe_comma(value, comma);
}
value += "";
if (!isNaN(precision)) {
value = value.slice(0, precision);
}
}
value += "";
if (is_numeric && sign) {
nval = Number(value);
is_positive = !isNaN(nval) && nval >= 0;
if (is_positive && (sign === " " || sign === "+")) {
value = sign + value;
}
}
function repeat(char, num) {
return (new Array(num+1)).join(char);
};
if (!repeat.__argnames__) Object.defineProperties(repeat, {
__argnames__ : {value: ["char", "num"]},
__module__ : {value: "__main__"}
});
if (is_numeric && width && width[0] === "0") {
width = width.slice(1);
ρσ_unpack = ["0", "="];
fill = ρσ_unpack[0];
align = ρσ_unpack[1];
}
width = parseInt(width || "-1", 10);
if (isNaN(width)) {
throw new ValueError("Invalid width specification: " + width);
}
if (fill && value.length < width) {
if (align === "<") {
value = value + repeat(fill, width - value.length);
} else if (align === ">") {
value = repeat(fill, width - value.length) + value;
} else if (align === "^") {
left = Math.floor((width - value.length) / 2);
right = width - left - value.length;
value = repeat(fill, left) + value + repeat(fill, right);
} else if (align === "=") {
if (ρσ_in(value[0], "+- ")) {
value = value[0] + repeat(fill, width - value.length) + value.slice(1);
} else {
value = repeat(fill, width - value.length) + value;
}
} else {
throw new ValueError("Unrecognized alignment: " + align);
}
}
return value;
};
if (!apply_formatting.__argnames__) Object.defineProperties(apply_formatting, {
__argnames__ : {value: ["value", "format_spec"]},
__module__ : {value: "__main__"}
});
function parse_markup(markup) {
var key, transformer, format_spec, pos, state, ch;
key = transformer = format_spec = "";
pos = 0;
state = 0;
while (pos < markup.length) {
ch = markup[(typeof pos === "number" && pos < 0) ? markup.length + pos : pos];
if (state === 0) {
if (ch === "!") {
state = 1;
} else if (ch === ":") {
state = 2;
} else {
key += ch;
}
} else if (state === 1) {
if (ch === ":") {
state = 2;
} else {
transformer += ch;
}
} else {
format_spec += ch;
}
pos += 1;
}
return [key, transformer, format_spec];
};
if (!parse_markup.__argnames__) Object.defineProperties(parse_markup, {
__argnames__ : {value: ["markup"]},
__module__ : {value: "__main__"}
});
function render_markup(markup) {
var ρσ_unpack, key, transformer, format_spec, ends_with_equal, lkey, nvalue, object, ans;
ρσ_unpack = parse_markup(markup);
ρσ_unpack = ρσ_unpack_asarray(3, ρσ_unpack);
key = ρσ_unpack[0];
transformer = ρσ_unpack[1];
format_spec = ρσ_unpack[2];
if (transformer && ['a', 'r', 's'].indexOf(transformer) === -1) {
throw new ValueError("Unknown conversion specifier: " + transformer);
}
ends_with_equal = key.endsWith("=");
if (ends_with_equal) {
key = key.slice(0, -1);
}
lkey = key.length && split(key, /[.\[]/, 1)[0];
if (lkey) {
explicit = true;
if (implicit) {
throw new ValueError("cannot switch from automatic field numbering" + " to manual field specification");
}
nvalue = parseInt(lkey);
object = (isNaN(nvalue)) ? kwargs[(typeof lkey === "number" && lkey < 0) ? kwargs.length + lkey : lkey] : args[(typeof nvalue === "number" && nvalue < 0) ? args.length + nvalue : nvalue];
if (object === undefined) {
if (isNaN(nvalue)) {
throw new KeyError(lkey);
}
throw new IndexError(lkey);
}
object = resolve(key.slice(lkey.length), object);
} else {
implicit = true;
if (explicit) {
throw new ValueError("cannot switch from manual field specification" + " to automatic field numbering");
}
if (idx >= args.length) {
throw new IndexError("Not enough arguments to match template: " + template);
}
object = args[(typeof idx === "number" && idx < 0) ? args.length + idx : idx];
idx += 1;
}
if (typeof object === "function") {
object = object();
}
ans = "" + object;
if (format_spec) {
ans = apply_formatting(ans, format_spec);
}
if (ends_with_equal) {
ans = "" + ρσ_str.format("{}", key) + "=" + ρσ_str.format("{}", ans) + "";
}
return ans;
};
if (!render_markup.__argnames__) Object.defineProperties(render_markup, {
__argnames__ : {value: ["markup"]},
__module__ : {value: "__main__"}
});
ans = "";
pos = 0;
in_brace = 0;
markup = "";
while (pos < template.length) {
ch = template[(typeof pos === "number" && pos < 0) ? template.length + pos : pos];
if (in_brace) {
if (ch === "{") {
in_brace += 1;
markup += "{";
} else if (ch === "}") {
in_brace -= 1;
if (in_brace > 0) {
markup += "}";
} else {
ans += render_markup(markup);
}
} else {
markup += ch;
}
} else {
if (ch === "{") {
if (template[ρσ_bound_index(pos + 1, template)] === "{") {
pos += 1;
ans += "{";
} else {
in_brace = 1;
markup = "";
}
} else {
ans += ch;
if (ch === "}" && template[ρσ_bound_index(pos + 1, template)] === "}") {
pos += 1;
}
}
}
pos += 1;
}
if (in_brace) {
throw new ValueError("expected '}' before end of string");
}
return ans;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("capitalize", (function() {
var ρσ_anonfunc = function () {
var string;
string = this;
if (string) {
string = string[0].toUpperCase() + string.slice(1).toLowerCase();
}
return string;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("center", (function() {
var ρσ_anonfunc = function (width, fill) {
var left, right, left_pad, right_pad;
left = Math.floor((width - this.length) / 2);
right = width - left - this.length;
fill = fill || " ";
left_pad = new Array(left+1).join(fill);
right_pad = new Array(right+1).join(fill);
return left_pad + this + right_pad;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["width", "fill"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("count", (function() {
var ρσ_anonfunc = function (needle, start, end) {
var string, ρσ_unpack, pos, step, ans;
string = this;
start = start || 0;
end = end || string.length;
if (start < 0 || end < 0) {
string = string.slice(start, end);
ρσ_unpack = [0, string.length];
start = ρσ_unpack[0];
end = ρσ_unpack[1];
}
pos = start;
step = needle.length;
if (!step) {
return 0;
}
ans = 0;
while (pos !== -1) {
pos = string.indexOf(needle, pos);
if (pos !== -1) {
ans += 1;
pos += step;
}
}
return ans;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["needle", "start", "end"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("endswith", (function() {
var ρσ_anonfunc = function (suffixes, start, end) {
var string, q;
string = this;
start = start || 0;
if (typeof suffixes === "string") {
suffixes = [suffixes];
}
if (end !== undefined) {
string = string.slice(0, end);
}
for (var i = 0; i < suffixes.length; i++) {
q = suffixes[(typeof i === "number" && i < 0) ? suffixes.length + i : i];
if (string.indexOf(q, Math.max(start, string.length - q.length)) !== -1) {
return true;
}
}
return false;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["suffixes", "start", "end"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("startswith", (function() {
var ρσ_anonfunc = function (prefixes, start, end) {
var prefix;
start = start || 0;
if (typeof prefixes === "string") {
prefixes = [prefixes];
}
for (var i = 0; i < prefixes.length; i++) {
prefix = prefixes[(typeof i === "number" && i < 0) ? prefixes.length + i : i];
end = (end === undefined) ? this.length : end;
if (end - start >= prefix.length && prefix === this.slice(start, start + prefix.length)) {
return true;
}
}
return false;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["prefixes", "start", "end"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("find", (function() {
var ρσ_anonfunc = function (needle, start, end) {
var ans;
while (start < 0) {
start += this.length;
}
ans = this.indexOf(needle, start);
if (end !== undefined && ans !== -1) {
while (end < 0) {
end += this.length;
}
if (ans >= end - needle.length) {
return -1;
}
}
return ans;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["needle", "start", "end"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("rfind", (function() {
var ρσ_anonfunc = function (needle, start, end) {
var ans;
while (end < 0) {
end += this.length;
}
ans = this.lastIndexOf(needle, end - 1);
if (start !== undefined && ans !== -1) {
while (start < 0) {
start += this.length;
}
if (ans < start) {
return -1;
}
}
return ans;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["needle", "start", "end"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("index", (function() {
var ρσ_anonfunc = function (needle, start, end) {
var ans;
ans = ρσ_str.prototype.find.apply(this, arguments);
if (ans === -1) {
throw new ValueError("substring not found");
}
return ans;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["needle", "start", "end"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("rindex", (function() {
var ρσ_anonfunc = function (needle, start, end) {
var ans;
ans = ρσ_str.prototype.rfind.apply(this, arguments);
if (ans === -1) {
throw new ValueError("substring not found");
}
return ans;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["needle", "start", "end"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("islower", (function() {
var ρσ_anonfunc = function () {
return this.length > 0 && this.toLowerCase() === this.toString();
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("isupper", (function() {
var ρσ_anonfunc = function () {
return this.length > 0 && this.toUpperCase() === this.toString();
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("isspace", (function() {
var ρσ_anonfunc = function () {
return this.length > 0 && /^\s+$/.test(this);
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("join", (function() {
var ρσ_anonfunc = function (iterable) {
var ans, r;
if (Array.isArray(iterable)) {
return iterable.join(this);
}
ans = "";
r = iterable.next();
while (!r.done) {
if (ans) {
ans += this;
}
ans += r.value;
r = iterable.next();
}
return ans;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["iterable"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("ljust", (function() {
var ρσ_anonfunc = function (width, fill) {
var string;
string = this;
if (width > string.length) {
fill = fill || " ";
string += new Array(width - string.length + 1).join(fill);
}
return string;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["width", "fill"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("rjust", (function() {
var ρσ_anonfunc = function (width, fill) {
var string;
string = this;
if (width > string.length) {
fill = fill || " ";
string = new Array(width - string.length + 1).join(fill) + string;
}
return string;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["width", "fill"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("lower", (function() {
var ρσ_anonfunc = function () {
return this.toLowerCase();
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("upper", (function() {
var ρσ_anonfunc = function () {
return this.toUpperCase();
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("lstrip", (function() {
var ρσ_anonfunc = function (chars) {
var string, pos;
string = this;
pos = 0;
chars = chars || ρσ_str.whitespace;
while (chars.indexOf(string[(typeof pos === "number" && pos < 0) ? string.length + pos : pos]) !== -1) {
pos += 1;
}
if (pos) {
string = string.slice(pos);
}
return string;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["chars"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("rstrip", (function() {
var ρσ_anonfunc = function (chars) {
var string, pos;
string = this;
pos = string.length - 1;
chars = chars || ρσ_str.whitespace;
while (chars.indexOf(string[(typeof pos === "number" && pos < 0) ? string.length + pos : pos]) !== -1) {
pos -= 1;
}
if (pos < string.length - 1) {
string = string.slice(0, pos + 1);
}
return string;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["chars"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("strip", (function() {
var ρσ_anonfunc = function (chars) {
return ρσ_str.prototype.lstrip.call(ρσ_str.prototype.rstrip.call(this, chars), chars);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["chars"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("partition", (function() {
var ρσ_anonfunc = function (sep) {
var idx;
idx = this.indexOf(sep);
if (idx === -1) {
return [this, "", ""];
}
return [this.slice(0, idx), sep, this.slice(idx + sep.length)];
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["sep"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("rpartition", (function() {
var ρσ_anonfunc = function (sep) {
var idx;
idx = this.lastIndexOf(sep);
if (idx === -1) {
return ["", "", this];
}
return [this.slice(0, idx), sep, this.slice(idx + sep.length)];
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["sep"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("replace", (function() {
var ρσ_anonfunc = function (old, repl, count) {
var string, pos, idx;
string = this;
if (count === 1) {
return ρσ_orig_replace(string, old, repl);
}
if (count < 1) {
return string;
}
count = count || Number.MAX_VALUE;
pos = 0;
while (count > 0) {
count -= 1;
idx = string.indexOf(old, pos);
if (idx === -1) {
break;
}
pos = idx + repl.length;
string = string.slice(0, idx) + repl + string.slice(idx + old.length);
}
return string;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["old", "repl", "count"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("split", (function() {
var ρσ_anonfunc = function (sep, maxsplit) {
var split, ans, extra, parts;
if (maxsplit === 0) {
return [ this ];
}
split = ρσ_orig_split;
if (sep === undefined || sep === null) {
if (maxsplit > 0) {
ans = split(this, /(\s+)/);
extra = "";
parts = [];
for (var i = 0; i < ans.length; i++) {
if (parts.length >= maxsplit + 1) {
extra += ans[(typeof i === "number" && i < 0) ? ans.length + i : i];
} else if (i % 2 === 0) {
parts.push(ans[(typeof i === "number" && i < 0) ? ans.length + i : i]);
}
}
parts[parts.length-1] += extra;
ans = parts;
} else {
ans = split(this, /\s+/);
}
} else {
if (sep === "") {
throw new ValueError("empty separator");
}
ans = split(this, sep);
if (maxsplit > 0 && ans.length > maxsplit) {
extra = ans.slice(maxsplit).join(sep);
ans = ans.slice(0, maxsplit);
ans.push(extra);
}
}
return ans;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["sep", "maxsplit"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("rsplit", (function() {
var ρσ_anonfunc = function (sep, maxsplit) {
var split, ans, is_space, pos, current, spc, ch, end, idx;
if (!maxsplit) {
return ρσ_str.prototype.split.call(this, sep);
}
split = ρσ_orig_split;
if (sep === undefined || sep === null) {
if (maxsplit > 0) {
ans = [];
is_space = /\s/;
pos = this.length - 1;
current = "";
while (pos > -1 && maxsplit > 0) {
spc = false;
ch = (ρσ_expr_temp = this)[(typeof pos === "number" && pos < 0) ? ρσ_expr_temp.length + pos : pos];
while (pos > -1 && is_space.test(ch)) {
spc = true;
ch = this[--pos];
}
if (spc) {
if (current) {
ans.push(current);
maxsplit -= 1;
}
current = ch;
} else {
current += ch;
}
pos -= 1;
}
ans.push(this.slice(0, pos + 1) + current);
ans.reverse();
} else {
ans = split(this, /\s+/);
}
} else {
if (sep === "") {
throw new ValueError("empty separator");
}
ans = [];
pos = end = this.length;
while (pos > -1 && maxsplit > 0) {
maxsplit -= 1;
idx = this.lastIndexOf(sep, pos);
if (idx === -1) {
break;
}
ans.push(this.slice(idx + sep.length, end));
pos = idx - 1;
end = idx;
}
ans.push(this.slice(0, end));
ans.reverse();
}
return ans;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["sep", "maxsplit"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("splitlines", (function() {
var ρσ_anonfunc = function (keepends) {
var split, parts, ans;
split = ρσ_orig_split;
if (keepends) {
parts = split(this, /((?:\r?\n)|\r)/);
ans = [];
for (var i = 0; i < parts.length; i++) {
if (i % 2 === 0) {
ans.push(parts[(typeof i === "number" && i < 0) ? parts.length + i : i]);
} else {
ans[ans.length-1] += parts[(typeof i === "number" && i < 0) ? parts.length + i : i];
}
}
} else {
ans = split(this, /(?:\r?\n)|\r/);
}
return ans;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["keepends"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("swapcase", (function() {
var ρσ_anonfunc = function () {
var ans, a, b;
ans = new Array(this.length);
for (var i = 0; i < ans.length; i++) {
a = (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i];
b = a.toLowerCase();
if (a === b) {
b = a.toUpperCase();
}
ans[(typeof i === "number" && i < 0) ? ans.length + i : i] = b;
}
return ans.join("");
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
define_str_func("zfill", (function() {
var ρσ_anonfunc = function (width) {
var string;
string = this;
if (width > string.length) {
string = new Array(width - string.length + 1).join("0") + string;
}
return string;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["width"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})());
ρσ_str.uchrs = (function() {
var ρσ_anonfunc = function (string, with_positions) {
return (function(){
var ρσ_d = {};
ρσ_d["_string"] = string;
ρσ_d["_pos"] = 0;
ρσ_d[ρσ_iterator_symbol] = (function() {
var ρσ_anonfunc = function () {
return this;
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_d["next"] = (function() {
var ρσ_anonfunc = function () {
var length, pos, value, ans, extra;
length = this._string.length;
if (this._pos >= length) {
return (function(){
var ρσ_d = {};
ρσ_d["done"] = true;
return ρσ_d;
}).call(this);
}
pos = this._pos;
value = this._string.charCodeAt(this._pos++);
ans = "\ufffd";
if (55296 <= value && value <= 56319) {
if (this._pos < length) {
extra = this._string.charCodeAt(this._pos++);
if ((extra & 56320) === 56320) {
ans = String.fromCharCode(value, extra);
}
}
} else if ((value & 56320) !== 56320) {
ans = String.fromCharCode(value);
}
if (with_positions) {
return (function(){
var ρσ_d = {};
ρσ_d["done"] = false;
ρσ_d["value"] = [ pos, ans ];
return ρσ_d;
}).call(this);
} else {
return (function(){
var ρσ_d = {};
ρσ_d["done"] = false;
ρσ_d["value"] = ans;
return ρσ_d;
}).call(this);
}
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["string", "with_positions"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_str.uslice = (function() {
var ρσ_anonfunc = function (string, start, end) {
var items, iterator, r;
items = [];
iterator = ρσ_str.uchrs(string);
r = iterator.next();
while (!r.done) {
items.push(r.value);
r = iterator.next();
}
return items.slice(start || 0, (end === undefined) ? items.length : end).join("");
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["string", "start", "end"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_str.ulen = (function() {
var ρσ_anonfunc = function (string) {
var iterator, r, ans;
iterator = ρσ_str.uchrs(string);
r = iterator.next();
ans = 0;
while (!r.done) {
r = iterator.next();
ans += 1;
}
return ans;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["string"]},
__module__ : {value: "__main__"}
});
return ρσ_anonfunc;
})();
ρσ_str.ascii_lowercase = "abcdefghijklmnopqrstuvwxyz";
ρσ_str.ascii_uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
ρσ_str.ascii_letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
ρσ_str.digits = "0123456789";
ρσ_str.punctuation = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
ρσ_str.printable = "0123456789abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\u000b\f";
ρσ_str.whitespace = " \t\n\r\u000b\f";
define_str_func = undefined;
var str = ρσ_str, repr = ρσ_repr;;
var ρσ_modules = {};
ρσ_modules.traceback = {};
ρσ_modules.elementmaker = {};
ρσ_modules.gettext = {};
ρσ_modules.pythonize = {};
ρσ_modules.initialize = {};
ρσ_modules.ajax = {};
ρσ_modules.book_list = {};
ρσ_modules["book_list.globals"] = {};
ρσ_modules.lru_cache = {};
ρσ_modules.encodings = {};
ρσ_modules.uuid = {};
ρσ_modules.session = {};
ρσ_modules.dom = {};
ρσ_modules["book_list.theme"] = {};
ρσ_modules.utils = {};
ρσ_modules["book_list.library_data"] = {};
ρσ_modules.date = {};
ρσ_modules.popups = {};
ρσ_modules.widgets = {};
ρσ_modules.modals = {};
ρσ_modules.qt = {};
ρσ_modules.read_book = {};
ρσ_modules["book_list.constants"] = {};
ρσ_modules.aes = {};
ρσ_modules["read_book.globals"] = {};
ρσ_modules["book_list.router"] = {};
ρσ_modules["read_book.viewport"] = {};
ρσ_modules["read_book.cfi"] = {};
ρσ_modules["read_book.annotations"] = {};
ρσ_modules["read_book.db"] = {};
ρσ_modules.iframe_comm = {};
ρσ_modules["read_book.settings"] = {};
ρσ_modules["read_book.resources"] = {};
ρσ_modules["read_book.footnotes"] = {};
ρσ_modules.range_utils = {};
ρσ_modules["read_book.find"] = {};
ρσ_modules.fs_images = {};
ρσ_modules.select = {};
ρσ_modules["read_book.anchor_visibility"] = {};
ρσ_modules["read_book.extract"] = {};
ρσ_modules["read_book.flow_mode"] = {};
ρσ_modules["read_book.mathjax"] = {};
ρσ_modules["read_book.referencing"] = {};
ρσ_modules["read_book.shortcuts"] = {};
ρσ_modules["read_book.smil"] = {};
ρσ_modules["read_book.hints"] = {};
ρσ_modules["read_book.touch"] = {};
ρσ_modules["read_book.paged_mode"] = {};
ρσ_modules["read_book.gestures"] = {};
ρσ_modules.complete = {};
ρσ_modules["read_book.highlights"] = {};
ρσ_modules["read_book.toc"] = {};
ρσ_modules["read_book.iframe"] = {};
ρσ_modules["book_list.item_list"] = {};
ρσ_modules["read_book.open_book"] = {};
ρσ_modules["read_book.prefs"] = {};
ρσ_modules.viewer = {};
ρσ_modules["read_book.prefs.utils"] = {};
ρσ_modules["viewer.constants"] = {};
ρσ_modules["read_book.prefs.head_foot"] = {};
ρσ_modules["read_book.selection_bar"] = {};
ρσ_modules["read_book.read_aloud"] = {};
ρσ_modules["book_list.ui"] = {};
ρσ_modules["read_book.bookmarks"] = {};
ρσ_modules["read_book.content_popup"] = {};
ρσ_modules["read_book.goto"] = {};
ρσ_modules["read_book.prefs.colors"] = {};
ρσ_modules["read_book.prefs.font_size"] = {};
ρσ_modules["read_book.prefs.fonts"] = {};
ρσ_modules["read_book.prefs.scrolling"] = {};
ρσ_modules["read_book.prefs.user_stylesheet"] = {};
ρσ_modules["read_book.read_audio_ebook"] = {};
ρσ_modules["read_book.scrollbar"] = {};
ρσ_modules["read_book.timers"] = {};
ρσ_modules["book_list.cover_grid"] = {};
ρσ_modules["book_list.top_bar"] = {};
ρσ_modules["read_book.chrome"] = {};
ρσ_modules["read_book.main_overlay_style"] = {};
ρσ_modules["read_book.profiles"] = {};
ρσ_modules["read_book.word_actions"] = {};
ρσ_modules["book_list.home"] = {};
ρσ_modules.worker = {};
ρσ_modules["read_book.search_worker"] = {};
ρσ_modules["read_book.search"] = {};
ρσ_modules["read_book.prefs.keyboard"] = {};
ρσ_modules["read_book.prefs.layout"] = {};
ρσ_modules["read_book.prefs.misc"] = {};
ρσ_modules["read_book.prefs.selection"] = {};
ρσ_modules["read_book.prefs.touch"] = {};
ρσ_modules["read_book.prefs.main"] = {};
ρσ_modules["book_list.add"] = {};
ρσ_modules["book_list.details_list"] = {};
ρσ_modules["book_list.delete_book"] = {};
ρσ_modules["book_list.custom_list"] = {};
ρσ_modules["book_list.search"] = {};
ρσ_modules["book_list.views"] = {};
ρσ_modules["book_list.book_details"] = {};
ρσ_modules["read_book.overlay"] = {};
ρσ_modules["read_book.view"] = {};
(function(){
var __name__ = "traceback";
var _traceback_state, _VLQ_BASE64;
_traceback_state = (function(){
var ρσ_d = {};
ρσ_d["source_map"] = null;
ρσ_d["decoded"] = null;
return ρσ_d;
}).call(this);
_VLQ_BASE64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
function set_source_map_data(data) {
_traceback_state["source_map"] = data;
_traceback_state["decoded"] = null;
};
if (!set_source_map_data.__argnames__) Object.defineProperties(set_source_map_data, {
__argnames__ : {value: ["data"]},
__module__ : {value: "traceback"}
});
function serialize_error_for_formatting(err) {
return (function(){
var ρσ_d = {};
ρσ_d["name"] = err.name || "Error";
ρσ_d["stack"] = err.stack || "";
ρσ_d["message"] = err.message || "";
return ρσ_d;
}).call(this);
};
if (!serialize_error_for_formatting.__argnames__) Object.defineProperties(serialize_error_for_formatting, {
__argnames__ : {value: ["err"]},
__module__ : {value: "traceback"}
});
function unserialize_error_for_formatting(err) {
var ans;
ans = new Error;
ans.name = err.name;
ans.stack = err.stack;
ans.message = err.message;
return ans;
};
if (!unserialize_error_for_formatting.__argnames__) Object.defineProperties(unserialize_error_for_formatting, {
__argnames__ : {value: ["err"]},
__module__ : {value: "traceback"}
});
function _vlq_decode(encoded) {
var result, i, n, value, shift, has_more, digit;
result = [];
i = 0;
n = encoded.length;
while (i < n) {
value = 0;
shift = 0;
has_more = true;
while (has_more) {
digit = _VLQ_BASE64.indexOf(encoded[(typeof i === "number" && i < 0) ? encoded.length + i : i]);
i += 1;
has_more = ρσ_not_equals((digit & 32), 0);
value += (digit & 31) << shift;
shift += 5;
}
if (value & 1) {
value = -((value >> 1));
} else {
value = value >> 1;
}
result.push(value);
}
return result;
};
if (!_vlq_decode.__argnames__) Object.defineProperties(_vlq_decode, {
__argnames__ : {value: ["encoded"]},
__module__ : {value: "traceback"}
});
function _decode_source_map(smap) {
var sources, source_root, mappings_str, mapping_lines, decoded, prev_src_idx, prev_src_line, prev_src_col, line_str, line_entries, segments, prev_col, fields, gen_col, src_idx, src_line, src_col, src_file, seg_str, gen_line;
sources = smap.sources || [];
source_root = smap.sourceRoot || "";
mappings_str = smap.mappings || "";
mapping_lines = mappings_str.split(";");
decoded = [];
prev_src_idx = 0;
prev_src_line = 0;
prev_src_col = 0;
for (var ρσ_Index0 = 0; ρσ_Index0 < mapping_lines.length; ρσ_Index0++) {
gen_line = ρσ_Index0;
line_str = mapping_lines[(typeof gen_line === "number" && gen_line < 0) ? mapping_lines.length + gen_line : gen_line];
line_entries = [];
if (line_str) {
segments = line_str.split(",");
prev_col = 0;
var ρσ_Iter1 = segments;
ρσ_Iter1 = ((typeof ρσ_Iter1[Symbol.iterator] === "function") ? (ρσ_Iter1 instanceof Map ? ρσ_Iter1.keys() : ρσ_Iter1) : Object.keys(ρσ_Iter1));
for (var ρσ_Index1 of ρσ_Iter1) {
seg_str = ρσ_Index1;
if (!seg_str) {
continue;
}
fields = _vlq_decode(seg_str);
if (fields.length >= 4) {
gen_col = prev_col + fields[0];
prev_col = gen_col;
src_idx = prev_src_idx + fields[1];
prev_src_idx = src_idx;
src_line = prev_src_line + fields[2];
prev_src_line = src_line;
src_col = prev_src_col + fields[3];
prev_src_col = src_col;
src_file = (src_idx >= 0 && src_idx < sources.length) ? sources[(typeof src_idx === "number" && src_idx < 0) ? sources.length + src_idx : src_idx] : "";
if (source_root && src_file) {
src_file = source_root + src_file;
}
line_entries.push((function(){
var ρσ_d = {};
ρσ_d["gen_col"] = gen_col;
ρσ_d["src_file"] = src_file;
ρσ_d["src_line"] = src_line;
ρσ_d["src_col"] = src_col;
return ρσ_d;
}).call(this));
} else if (fields.length >= 1) {
prev_col += fields[0];
}
}
}
decoded.push(line_entries);
}
return decoded;
};
if (!_decode_source_map.__argnames__) Object.defineProperties(_decode_source_map, {
__argnames__ : {value: ["smap"]},
__module__ : {value: "traceback"}
});
function _find_mapping(decoded, gen_line, gen_col) {
var line_entries, best, entry;
if (!decoded || gen_line < 0 || gen_line >= decoded.length) {
return null;
}
line_entries = decoded[(typeof gen_line === "number" && gen_line < 0) ? decoded.length + gen_line : gen_line];
if (!line_entries || !line_entries.length) {
return null;
}
best = null;
var ρσ_Iter2 = line_entries;
ρσ_Iter2 = ((typeof ρσ_Iter2[Symbol.iterator] === "function") ? (ρσ_Iter2 instanceof Map ? ρσ_Iter2.keys() : ρσ_Iter2) : Object.keys(ρσ_Iter2));
for (var ρσ_Index2 of ρσ_Iter2) {
entry = ρσ_Index2;
if (entry.gen_col <= gen_col) {
if (best === null || entry.gen_col > best.gen_col) {
best = entry;
}
}
}
return best;
};
if (!_find_mapping.__argnames__) Object.defineProperties(_find_mapping, {
__argnames__ : {value: ["decoded", "gen_line", "gen_col"]},
__module__ : {value: "traceback"}
});
function _parse_stack_frame(line) {
var m;
m = /^\s*at\s+(.*?)\s+\((.+):(\d+):(\d+)\)/.exec(line);
if (m) {
return (function(){
var ρσ_d = {};
ρσ_d["func"] = m[1] || null;
ρσ_d["file"] = m[2];
ρσ_d["line"] = parseInt(m[3], 10) - 1;
ρσ_d["col"] = parseInt(m[4], 10) - 1;
return ρσ_d;
}).call(this);
}
m = /^\s*at (.+):(\d+):(\d+)$/.exec(line);
if (m) {
return (function(){
var ρσ_d = {};
ρσ_d["func"] = null;
ρσ_d["file"] = m[1];
ρσ_d["line"] = parseInt(m[2], 10) - 1;
ρσ_d["col"] = parseInt(m[3], 10) - 1;
return ρσ_d;
}).call(this);
}
m = /^(.*?)@(.+):(\d+):(\d+)$/.exec(line);
if (m) {
return (function(){
var ρσ_d = {};
ρσ_d["func"] = m[1] || null;
ρσ_d["file"] = m[2];
ρσ_d["line"] = parseInt(m[3], 10) - 1;
ρσ_d["col"] = parseInt(m[4], 10) - 1;
return ρσ_d;
}).call(this);
}
return null;
};
if (!_parse_stack_frame.__argnames__) Object.defineProperties(_parse_stack_frame, {
__argnames__ : {value: ["line"]},
__module__ : {value: "traceback"}
});
function _get_decoded_map() {
if (_traceback_state["decoded"] === null && _traceback_state["source_map"]) {
_traceback_state["decoded"] = _decode_source_map(_traceback_state["source_map"]);
}
return _traceback_state["decoded"];
};
if (!_get_decoded_map.__module__) Object.defineProperties(_get_decoded_map, {
__module__ : {value: "traceback"}
});
function _get_internal_traceback(err) {
var lines, final_lines, start_line_idx, line, ρσ_unpack, i, xline, frame_lines, decoded, mapped_lines, frame, mapping, loc, frame_line;
lines = ρσ_str.splitlines(err.stack || "");
final_lines = [];
start_line_idx = -1;
var ρσ_Iter3 = enumerate(lines);
ρσ_Iter3 = ((typeof ρσ_Iter3[Symbol.iterator] === "function") ? (ρσ_Iter3 instanceof Map ? ρσ_Iter3.keys() : ρσ_Iter3) : Object.keys(ρσ_Iter3));
for (var ρσ_Index3 of ρσ_Iter3) {
ρσ_unpack = ρσ_Index3;
i = ρσ_unpack[0];
line = ρσ_unpack[1];
if (i > 0) {
line = line.trim();
if (line.startsWith("at new " + err.name) || line.startsWith(err.name + "@")) {
start_line_idx = i + 1;
break;
}
}
}
if (start_line_idx < 0) {
start_line_idx = 1;
var ρσ_Iter4 = enumerate(lines);
ρσ_Iter4 = ((typeof ρσ_Iter4[Symbol.iterator] === "function") ? (ρσ_Iter4 instanceof Map ? ρσ_Iter4.keys() : ρσ_Iter4) : Object.keys(ρσ_Iter4));
for (var ρσ_Index4 of ρσ_Iter4) {
ρσ_unpack = ρσ_Index4;
i = ρσ_unpack[0];
xline = ρσ_unpack[1];
if (i > 0) {
line = xline.trim();
if (line.startsWith('at ') || line.includes('@') || /:\d+:\d+$/.test(line)) {
start_line_idx = i;
break;
}
}
}
}
frame_lines = lines.slice(start_line_idx);
final_lines = final_lines.concat(frame_lines);
decoded = _get_decoded_map();
mapped_lines = [];
if (decoded) {
var ρσ_Iter5 = frame_lines;
ρσ_Iter5 = ((typeof ρσ_Iter5[Symbol.iterator] === "function") ? (ρσ_Iter5 instanceof Map ? ρσ_Iter5.keys() : ρσ_Iter5) : Object.keys(ρσ_Iter5));
for (var ρσ_Index5 of ρσ_Iter5) {
frame_line = ρσ_Index5;
frame = _parse_stack_frame(frame_line);
if (frame) {
mapping = _find_mapping(decoded, frame.line, frame.col);
if (mapping) {
loc = " File \"" + mapping.src_file + "\", line " + (mapping.src_line + 1) + ", col " + (mapping.src_col + 1);
if (frame.func) {
loc += ", in " + frame.func;
}
mapped_lines.push(loc);
}
}
}
}
return [lines[0], final_lines, mapped_lines];
};
if (!_get_internal_traceback.__argnames__) Object.defineProperties(_get_internal_traceback, {
__argnames__ : {value: ["err"]},
__module__ : {value: "traceback"}
});
function format_exception(exc, limit) {
var ρσ_unpack, e, js_lines, rs_lines;
if (typeof exc === "undefined") {
exc = ρσ_last_exception;
}
if (!(ρσ_instanceof(exc, Error))) {
if (exc && exc.toString) {
return [ exc.toString() ];
}
return [];
}
ρσ_unpack = _get_internal_traceback(exc);
ρσ_unpack = ρσ_unpack_asarray(3, ρσ_unpack);
e = ρσ_unpack[0];
js_lines = ρσ_unpack[1];
rs_lines = ρσ_unpack[2];
if (js_lines.length > 0) {
if (limit) {
js_lines = (limit > 0) ? js_lines.slice(0, limit) : js_lines.slice(limit);
rs_lines = (limit > 0) ? rs_lines.slice(0, limit) : rs_lines.slice(limit);
}
js_lines.reverse();
rs_lines.reverse();
js_lines.push(e);
js_lines = ['Traceback (most recent call last):'].concat(js_lines);
if (rs_lines.length > 0) {
js_lines = js_lines.concat([ "", "Mapped Traceback (RapydScript):" ]).concat(rs_lines);
}
return (function() {
var ρσ_Iter = js_lines, ρσ_Result = [], l;
ρσ_Iter = ((typeof ρσ_Iter[Symbol.iterator] === "function") ? (ρσ_Iter instanceof Map ? ρσ_Iter.keys() : ρσ_Iter) : Object.keys(ρσ_Iter));
for (var ρσ_Index of ρσ_Iter) {
l = ρσ_Index;
ρσ_Result.push(l + "\n");
}
ρσ_Result = ρσ_list_constructor(ρσ_Result);
return ρσ_Result;
})();
}
return [ exc.toString() ];
};
if (!format_exception.__argnames__) Object.defineProperties(format_exception, {
__argnames__ : {value: ["exc", "limit"]},
__module__ : {value: "traceback"}
});
function format_exc(limit) {
return format_exception(ρσ_last_exception, limit).join("");
};
if (!format_exc.__argnames__) Object.defineProperties(format_exc, {
__argnames__ : {value: ["limit"]},
__module__ : {value: "traceback"}
});
function print_exc(limit) {
print(format_exc(limit));
};
if (!print_exc.__argnames__) Object.defineProperties(print_exc, {
__argnames__ : {value: ["limit"]},
__module__ : {value: "traceback"}
});
function format_stack(limit) {
var stack, lines;
stack = (new Error).stack;
if (!stack) {
return [];
}
lines = str.splitlines(stack).slice(2);
lines.reverse();
if (limit) {
lines = (limit > 0) ? lines.slice(0, limit + 1) : lines.slice(limit);
}
return (function() {
var ρσ_Iter = lines, ρσ_Result = [], l;
ρσ_Iter = ((typeof ρσ_Iter[Symbol.iterator] === "function") ? (ρσ_Iter instanceof Map ? ρσ_Iter.keys() : ρσ_Iter) : Object.keys(ρσ_Iter));
for (var ρσ_Index of ρσ_Iter) {
l = ρσ_Index;
ρσ_Result.push(l + "\n");
}
ρσ_Result = ρσ_list_constructor(ρσ_Result);
return ρσ_Result;
})();
};
if (!format_stack.__argnames__) Object.defineProperties(format_stack, {
__argnames__ : {value: ["limit"]},
__module__ : {value: "traceback"}
});
function print_stack(limit) {
print(format_stack(limit).join(""));
};
if (!print_stack.__argnames__) Object.defineProperties(print_stack, {
__argnames__ : {value: ["limit"]},
__module__ : {value: "traceback"}
});
ρσ_modules.traceback._traceback_state = _traceback_state;
ρσ_modules.traceback._VLQ_BASE64 = _VLQ_BASE64;
ρσ_modules.traceback.set_source_map_data = set_source_map_data;
ρσ_modules.traceback.serialize_error_for_formatting = serialize_error_for_formatting;
ρσ_modules.traceback.unserialize_error_for_formatting = unserialize_error_for_formatting;
ρσ_modules.traceback._vlq_decode = _vlq_decode;
ρσ_modules.traceback._decode_source_map = _decode_source_map;
ρσ_modules.traceback._find_mapping = _find_mapping;
ρσ_modules.traceback._parse_stack_frame = _parse_stack_frame;
ρσ_modules.traceback._get_decoded_map = _get_decoded_map;
ρσ_modules.traceback._get_internal_traceback = _get_internal_traceback;
ρσ_modules.traceback.format_exception = format_exception;
ρσ_modules.traceback.format_exc = format_exc;
ρσ_modules.traceback.print_exc = print_exc;
ρσ_modules.traceback.format_stack = format_stack;
ρσ_modules.traceback.print_stack = print_stack;
})();
(function(){
var __name__ = "elementmaker";
var html_elements, mathml_elements, svg_elements, html5_tags, E;
html_elements = (function(){
var s = ρσ_set();
s.jsset.add("a");
s.jsset.add("abbr");
s.jsset.add("acronym");
s.jsset.add("address");
s.jsset.add("area");
s.jsset.add("article");
s.jsset.add("aside");
s.jsset.add("audio");
s.jsset.add("b");
s.jsset.add("base");
s.jsset.add("big");
s.jsset.add("body");
s.jsset.add("blockquote");
s.jsset.add("br");
s.jsset.add("button");
s.jsset.add("canvas");
s.jsset.add("caption");
s.jsset.add("center");
s.jsset.add("cite");
s.jsset.add("code");
s.jsset.add("col");
s.jsset.add("colgroup");
s.jsset.add("command");
s.jsset.add("datagrid");
s.jsset.add("datalist");
s.jsset.add("dd");
s.jsset.add("del");
s.jsset.add("details");
s.jsset.add("dfn");
s.jsset.add("dialog");
s.jsset.add("dir");
s.jsset.add("div");
s.jsset.add("dl");
s.jsset.add("dt");
s.jsset.add("em");
s.jsset.add("event-source");
s.jsset.add("fieldset");
s.jsset.add("figcaption");
s.jsset.add("figure");
s.jsset.add("footer");
s.jsset.add("font");
s.jsset.add("form");
s.jsset.add("header");
s.jsset.add("h1");
s.jsset.add("h2");
s.jsset.add("h3");
s.jsset.add("h4");
s.jsset.add("h5");
s.jsset.add("h6");
s.jsset.add("hr");
s.jsset.add("head");
s.jsset.add("i");
s.jsset.add("iframe");
s.jsset.add("img");
s.jsset.add("input");
s.jsset.add("ins");
s.jsset.add("keygen");
s.jsset.add("kbd");
s.jsset.add("label");
s.jsset.add("legend");
s.jsset.add("li");
s.jsset.add("m");
s.jsset.add("map");
s.jsset.add("menu");
s.jsset.add("meter");
s.jsset.add("multicol");
s.jsset.add("nav");
s.jsset.add("nextid");
s.jsset.add("ol");
s.jsset.add("output");
s.jsset.add("optgroup");
s.jsset.add("option");
s.jsset.add("p");
s.jsset.add("pre");
s.jsset.add("progress");
s.jsset.add("q");
s.jsset.add("s");
s.jsset.add("samp");
s.jsset.add("script");
s.jsset.add("section");
s.jsset.add("select");
s.jsset.add("small");
s.jsset.add("sound");
s.jsset.add("source");
s.jsset.add("spacer");
s.jsset.add("span");
s.jsset.add("strike");
s.jsset.add("strong");
s.jsset.add("style");
s.jsset.add("sub");
s.jsset.add("sup");
s.jsset.add("table");
s.jsset.add("tbody");
s.jsset.add("td");
s.jsset.add("textarea");
s.jsset.add("time");
s.jsset.add("tfoot");
s.jsset.add("th");
s.jsset.add("thead");
s.jsset.add("tr");
s.jsset.add("tt");
s.jsset.add("u");
s.jsset.add("ul");
s.jsset.add("var");
s.jsset.add("video");
return s;
})();
mathml_elements = (function(){
var s = ρσ_set();
s.jsset.add("maction");
s.jsset.add("math");
s.jsset.add("merror");
s.jsset.add("mfrac");
s.jsset.add("mi");
s.jsset.add("mmultiscripts");
s.jsset.add("mn");
s.jsset.add("mo");
s.jsset.add("mover");
s.jsset.add("mpadded");
s.jsset.add("mphantom");
s.jsset.add("mprescripts");
s.jsset.add("mroot");
s.jsset.add("mrow");
s.jsset.add("mspace");
s.jsset.add("msqrt");
s.jsset.add("mstyle");
s.jsset.add("msub");
s.jsset.add("msubsup");
s.jsset.add("msup");
s.jsset.add("mtable");
s.jsset.add("mtd");
s.jsset.add("mtext");
s.jsset.add("mtr");
s.jsset.add("munder");
s.jsset.add("munderover");
s.jsset.add("none");
return s;
})();
svg_elements = (function(){
var s = ρσ_set();
s.jsset.add("a");
s.jsset.add("animate");
s.jsset.add("animateColor");
s.jsset.add("animateMotion");
s.jsset.add("animateTransform");
s.jsset.add("clipPath");
s.jsset.add("circle");
s.jsset.add("defs");
s.jsset.add("desc");
s.jsset.add("ellipse");
s.jsset.add("font-face");
s.jsset.add("font-face-name");
s.jsset.add("font-face-src");
s.jsset.add("g");
s.jsset.add("glyph");
s.jsset.add("hkern");
s.jsset.add("linearGradient");
s.jsset.add("line");
s.jsset.add("marker");
s.jsset.add("metadata");
s.jsset.add("missing-glyph");
s.jsset.add("mpath");
s.jsset.add("path");
s.jsset.add("polygon");
s.jsset.add("polyline");
s.jsset.add("radialGradient");
s.jsset.add("rect");
s.jsset.add("set");
s.jsset.add("stop");
s.jsset.add("svg");
s.jsset.add("switch");
s.jsset.add("text");
s.jsset.add("title");
s.jsset.add("tspan");
s.jsset.add("use");
return s;
})();
html5_tags = html_elements.union(mathml_elements).union(svg_elements);
function _makeelement() {
var tag = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
var kwargs = arguments[arguments.length-1];
if (kwargs === null || typeof kwargs !== "object" || kwargs [ρσ_kwargs_symbol] !== true) kwargs = {};
var args = Array.prototype.slice.call(arguments, 1);
if (kwargs !== null && typeof kwargs === "object" && kwargs [ρσ_kwargs_symbol] === true) args.pop();
var ans, vattr, val, attr, arg;
ans = this.createElement(tag);
var ρσ_Iter6 = kwargs;
ρσ_Iter6 = ((typeof ρσ_Iter6[Symbol.iterator] === "function") ? (ρσ_Iter6 instanceof Map ? ρσ_Iter6.keys() : ρσ_Iter6) : Object.keys(ρσ_Iter6));
for (var ρσ_Index6 of ρσ_Iter6) {
attr = ρσ_Index6;
vattr = str.replace(str.rstrip(attr, "_"), "_", "-");
val = kwargs[(typeof attr === "number" && attr < 0) ? kwargs.length + attr : attr];
if (callable(val)) {
if (str.startswith(attr, "on")) {
attr = attr.slice(2);
}
ans.addEventListener(attr, val);
} else if (val === true) {
ans.setAttribute(vattr, vattr);
} else if (typeof val === "string") {
ans.setAttribute(vattr, val);
}
}
var ρσ_Iter7 = args;
ρσ_Iter7 = ((typeof ρσ_Iter7[Symbol.iterator] === "function") ? (ρσ_Iter7 instanceof Map ? ρσ_Iter7.keys() : ρσ_Iter7) : Object.keys(ρσ_Iter7));
for (var ρσ_Index7 of ρσ_Iter7) {
arg = ρσ_Index7;
if (typeof arg === "string") {
arg = this.createTextNode(arg);
}
ans.appendChild(arg);
}
return ans;
};
if (!_makeelement.__handles_kwarg_interpolation__) Object.defineProperties(_makeelement, {
__handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["tag"]},
__module__ : {value: "elementmaker"}
});
function maker_for_document(document) {
var E;
E = _makeelement.bind(document);
Object.defineProperties(E, (function() {
var ρσ_Iter = html5_tags, ρσ_Result = {}, tag;
ρσ_Iter = ((typeof ρσ_Iter[Symbol.iterator] === "function") ? (ρσ_Iter instanceof Map ? ρσ_Iter.keys() : ρσ_Iter) : Object.keys(ρσ_Iter));
for (var ρσ_Index of ρσ_Iter) {
tag = ρσ_Index;
ρσ_Result[tag] = ((function(){
var ρσ_d = {};
ρσ_d["value"] = _makeelement.bind(document, tag);
return ρσ_d;
}).call(this));
}
return ρσ_Result;
})());
return E;
};
if (!maker_for_document.__argnames__) Object.defineProperties(maker_for_document, {
__argnames__ : {value: ["document"]},
__module__ : {value: "elementmaker"}
});
if (typeof document === "undefined") {
E = maker_for_document((function(){
var ρσ_d = {};
ρσ_d["createTextNode"] = (function() {
var ρσ_anonfunc = function (value) {
return value;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["value"]},
__module__ : {value: "elementmaker"}
});
return ρσ_anonfunc;
})();
ρσ_d["createElement"] = (function() {
var ρσ_anonfunc = function (name) {
return (function(){
var ρσ_d = {};
ρσ_d["name"] = name;
ρσ_d["children"] = [];
ρσ_d["attributes"] = {};
ρσ_d["setAttribute"] = (function() {
var ρσ_anonfunc = function (name, val) {
(ρσ_expr_temp = this.attributes)[(typeof name === "number" && name < 0) ? ρσ_expr_temp.length + name : name] = val;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["name", "val"]},
__module__ : {value: "elementmaker"}
});
return ρσ_anonfunc;
})();
ρσ_d["appendChild"] = (function() {
var ρσ_anonfunc = function (child) {
this.children.push(child);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["child"]},
__module__ : {value: "elementmaker"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["name"]},
__module__ : {value: "elementmaker"}
});
return ρσ_anonfunc;
})();
return ρσ_d;
}).call(this));
} else {
E = maker_for_document(document);
}
ρσ_modules.elementmaker.html_elements = html_elements;
ρσ_modules.elementmaker.mathml_elements = mathml_elements;
ρσ_modules.elementmaker.svg_elements = svg_elements;
ρσ_modules.elementmaker.html5_tags = html5_tags;
ρσ_modules.elementmaker.E = E;
ρσ_modules.elementmaker._makeelement = _makeelement;
ρσ_modules.elementmaker.maker_for_document = maker_for_document;
})();
(function(){
var __name__ = "gettext";
var Jed, plural_forms_parser, _gettext, _ngettext, has_prop, empty_translation_data;
Jed = {};
Jed.PF = {};
Jed.PF.parse = function ( p ) {
var plural_str = Jed.PF.extractPluralExpr( p );
return Jed.PF.parser.parse.call(Jed.PF.parser, plural_str);
};
Jed.PF.compile = function ( p ) {
// Handle trues and falses as 0 and 1
function imply( val ) {
return (val === true ? 1 : val ? val : 0);
}
var ast = Jed.PF.parse( p );
return function ( n ) {
return imply( Jed.PF.interpreter( ast )( n ) );
};
};
Jed.PF.interpreter = function ( ast ) {
return function ( n ) {
var res;
switch ( ast.type ) {
case 'GROUP':
return Jed.PF.interpreter( ast.expr )( n );
case 'TERNARY':
if ( Jed.PF.interpreter( ast.expr )( n ) ) {
return Jed.PF.interpreter( ast.truthy )( n );
}
return Jed.PF.interpreter( ast.falsey )( n );
case 'OR':
return Jed.PF.interpreter( ast.left )( n ) || Jed.PF.interpreter( ast.right )( n );
case 'AND':
return Jed.PF.interpreter( ast.left )( n ) && Jed.PF.interpreter( ast.right )( n );
case 'LT':
return Jed.PF.interpreter( ast.left )( n ) < Jed.PF.interpreter( ast.right )( n );
case 'GT':
return Jed.PF.interpreter( ast.left )( n ) > Jed.PF.interpreter( ast.right )( n );
case 'LTE':
return Jed.PF.interpreter( ast.left )( n ) <= Jed.PF.interpreter( ast.right )( n );
case 'GTE':
return Jed.PF.interpreter( ast.left )( n ) >= Jed.PF.interpreter( ast.right )( n );
case 'EQ':
return Jed.PF.interpreter( ast.left )( n ) == Jed.PF.interpreter( ast.right )( n );
case 'NEQ':
return Jed.PF.interpreter( ast.left )( n ) != Jed.PF.interpreter( ast.right )( n );
case 'MOD':
return Jed.PF.interpreter( ast.left )( n ) % Jed.PF.interpreter( ast.right )( n );
case 'VAR':
return n;
case 'NUM':
return ast.val;
default:
throw new Error("Invalid Token found.");
}
};
};
Jed.PF.extractPluralExpr = function ( p ) {
// trim first
p = p.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
if (! /;\s*$/.test(p)) {
p = p.concat(';');
}
var nplurals_re = /nplurals\=(\d+);/,
plural_re = /plural\=(.*);/,
nplurals_matches = p.match( nplurals_re ),
res = {},
plural_matches;
// Find the nplurals number
if ( nplurals_matches.length > 1 ) {
res.nplurals = nplurals_matches[1];
}
else {
throw new Error('nplurals not found in plural_forms string: ' + p );
}
// remove that data to get to the formula
p = p.replace( nplurals_re, "" );
plural_matches = p.match( plural_re );
if (!( plural_matches && plural_matches.length > 1 ) ) {
throw new Error('`plural` expression not found: ' + p);
}
return plural_matches[ 1 ];
};
/* Jison generated parser */
Jed.PF.parser = (function(){
var parser = {trace: function trace() { },
yy: {},
symbols_: {"error":2,"expressions":3,"e":4,"EOF":5,"?":6,":":7,"||":8,"&&":9,"<":10,"<=":11,">":12,">=":13,"!=":14,"==":15,"%":16,"(":17,")":18,"n":19,"NUMBER":20,"$accept":0,"$end":1},
terminals_: {2:"error",5:"EOF",6:"?",7:":",8:"||",9:"&&",10:"<",11:"<=",12:">",13:">=",14:"!=",15:"==",16:"%",17:"(",18:")",19:"n",20:"NUMBER"},
productions_: [0,[3,2],[4,5],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,1],[4,1]],
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
var $0 = $$.length - 1;
switch (yystate) {
case 1: return { type : 'GROUP', expr: $$[$0-1] };
case 2:this.$ = { type: 'TERNARY', expr: $$[$0-4], truthy : $$[$0-2], falsey: $$[$0] };
break;
case 3:this.$ = { type: "OR", left: $$[$0-2], right: $$[$0] };
break;
case 4:this.$ = { type: "AND", left: $$[$0-2], right: $$[$0] };
break;
case 5:this.$ = { type: 'LT', left: $$[$0-2], right: $$[$0] };
break;
case 6:this.$ = { type: 'LTE', left: $$[$0-2], right: $$[$0] };
break;
case 7:this.$ = { type: 'GT', left: $$[$0-2], right: $$[$0] };
break;
case 8:this.$ = { type: 'GTE', left: $$[$0-2], right: $$[$0] };
break;
case 9:this.$ = { type: 'NEQ', left: $$[$0-2], right: $$[$0] };
break;
case 10:this.$ = { type: 'EQ', left: $$[$0-2], right: $$[$0] };
break;
case 11:this.$ = { type: 'MOD', left: $$[$0-2], right: $$[$0] };
break;
case 12:this.$ = { type: 'GROUP', expr: $$[$0-1] };
break;
case 13:this.$ = { type: 'VAR' };
break;
case 14:this.$ = { type: 'NUM', val: Number(yytext) };
break;
}
},
table: [{3:1,4:2,17:[1,3],19:[1,4],20:[1,5]},{1:[3]},{5:[1,6],6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{4:17,17:[1,3],19:[1,4],20:[1,5]},{5:[2,13],6:[2,13],7:[2,13],8:[2,13],9:[2,13],10:[2,13],11:[2,13],12:[2,13],13:[2,13],14:[2,13],15:[2,13],16:[2,13],18:[2,13]},{5:[2,14],6:[2,14],7:[2,14],8:[2,14],9:[2,14],10:[2,14],11:[2,14],12:[2,14],13:[2,14],14:[2,14],15:[2,14],16:[2,14],18:[2,14]},{1:[2,1]},{4:18,17:[1,3],19:[1,4],20:[1,5]},{4:19,17:[1,3],19:[1,4],20:[1,5]},{4:20,17:[1,3],19:[1,4],20:[1,5]},{4:21,17:[1,3],19:[1,4],20:[1,5]},{4:22,17:[1,3],19:[1,4],20:[1,5]},{4:23,17:[1,3],19:[1,4],20:[1,5]},{4:24,17:[1,3],19:[1,4],20:[1,5]},{4:25,17:[1,3],19:[1,4],20:[1,5]},{4:26,17:[1,3],19:[1,4],20:[1,5]},{4:27,17:[1,3],19:[1,4],20:[1,5]},{6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[1,28]},{6:[1,7],7:[1,29],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{5:[2,3],6:[2,3],7:[2,3],8:[2,3],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,3]},{5:[2,4],6:[2,4],7:[2,4],8:[2,4],9:[2,4],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,4]},{5:[2,5],6:[2,5],7:[2,5],8:[2,5],9:[2,5],10:[2,5],11:[2,5],12:[2,5],13:[2,5],14:[2,5],15:[2,5],16:[1,16],18:[2,5]},{5:[2,6],6:[2,6],7:[2,6],8:[2,6],9:[2,6],10:[2,6],11:[2,6],12:[2,6],13:[2,6],14:[2,6],15:[2,6],16:[1,16],18:[2,6]},{5:[2,7],6:[2,7],7:[2,7],8:[2,7],9:[2,7],10:[2,7],11:[2,7],12:[2,7],13:[2,7],14:[2,7],15:[2,7],16:[1,16],18:[2,7]},{5:[2,8],6:[2,8],7:[2,8],8:[2,8],9:[2,8],10:[2,8],11:[2,8],12:[2,8],13:[2,8],14:[2,8],15:[2,8],16:[1,16],18:[2,8]},{5:[2,9],6:[2,9],7:[2,9],8:[2,9],9:[2,9],10:[2,9],11:[2,9],12:[2,9],13:[2,9],14:[2,9],15:[2,9],16:[1,16],18:[2,9]},{5:[2,10],6:[2,10],7:[2,10],8:[2,10],9:[2,10],10:[2,10],11:[2,10],12:[2,10],13:[2,10],14:[2,10],15:[2,10],16:[1,16],18:[2,10]},{5:[2,11],6:[2,11],7:[2,11],8:[2,11],9:[2,11],10:[2,11],11:[2,11],12:[2,11],13:[2,11],14:[2,11],15:[2,11],16:[2,11],18:[2,11]},{5:[2,12],6:[2,12],7:[2,12],8:[2,12],9:[2,12],10:[2,12],11:[2,12],12:[2,12],13:[2,12],14:[2,12],15:[2,12],16:[2,12],18:[2,12]},{4:30,17:[1,3],19:[1,4],20:[1,5]},{5:[2,2],6:[1,7],7:[2,2],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,2]}],
defaultActions: {6:[2,1]},
parseError: function parseError(str, hash) {
throw new Error(str);
},
parse: function parse(input) {
var self = this,
stack = [0],
vstack = [null], // semantic value stack
lstack = [], // location stack
table = this.table,
yytext = '',
yylineno = 0,
yyleng = 0,
recovering = 0,
TERROR = 2,
EOF = 1;
//this.reductionCount = this.shiftCount = 0;
this.lexer.setInput(input);
this.lexer.yy = this.yy;
this.yy.lexer = this.lexer;
if (typeof this.lexer.yylloc == 'undefined')
this.lexer.yylloc = {};
var yyloc = this.lexer.yylloc;
lstack.push(yyloc);
if (typeof this.yy.parseError === 'function')
this.parseError = this.yy.parseError;
function popStack (n) {
stack.length = stack.length - 2*n;
vstack.length = vstack.length - n;
lstack.length = lstack.length - n;
}
function lex() {
var token;
token = self.lexer.lex() || 1; // $end = 1
// if token isn't its numeric value, convert
if (typeof token !== 'number') {
token = self.symbols_[token] || token;
}
return token;
}
var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected, errStr;
while (true) {
// retreive state number from top of stack
state = stack[stack.length-1];
// use default actions if available
if (this.defaultActions[state]) {
action = this.defaultActions[state];
} else {
if (symbol === null || symbol === undefined)
symbol = lex();
// read action for current state and first input
action = table[state] && table[state][symbol];
}
// handle parse error
_handle_error:
if (typeof action === 'undefined' || !action.length || !action[0]) {
if (!recovering) {
// Report error
expected = [];
for (p in table[state]) if (this.terminals_[p] && p > 2) {
expected.push("'"+this.terminals_[p]+"'");
}
errStr = '';
if (this.lexer.showPosition) {
errStr = 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(', ') + ", got '" + this.terminals_[symbol]+ "'";
} else {
errStr = 'Parse error on line '+(yylineno+1)+": Unexpected " +
(symbol == 1 /*EOF*/ ? "end of input" :
("'"+(this.terminals_[symbol] || symbol)+"'"));
}
this.parseError(errStr,
{text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});
}
// just recovered from another error
if (recovering == 3) {
if (symbol == EOF) {
throw new Error(errStr || 'Parsing halted.');
}
// discard current lookahead and grab another
yyleng = this.lexer.yyleng;
yytext = this.lexer.yytext;
yylineno = this.lexer.yylineno;
yyloc = this.lexer.yylloc;
symbol = lex();
}
// try to recover from error
while (1) {
// check for error recovery rule in this state
if ((TERROR.toString()) in table[state]) {
break;
}
if (state === 0) {
throw new Error(errStr || 'Parsing halted.');
}
popStack(1);
state = stack[stack.length-1];
}
preErrorSymbol = symbol; // save the lookahead token
symbol = TERROR; // insert generic error symbol as new lookahead
state = stack[stack.length-1];
action = table[state] && table[state][TERROR];
recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
}
// this shouldn't happen, unless resolve defaults are off
if (action[0] instanceof Array && action.length > 1) {
throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol);
}
switch (action[0]) {
case 1: // shift
//this.shiftCount++;
stack.push(symbol);
vstack.push(this.lexer.yytext);
lstack.push(this.lexer.yylloc);
stack.push(action[1]); // push state
symbol = null;
if (!preErrorSymbol) { // normal execution/no error
yyleng = this.lexer.yyleng;
yytext = this.lexer.yytext;
yylineno = this.lexer.yylineno;
yyloc = this.lexer.yylloc;
if (recovering > 0)
recovering--;
} else { // error just occurred, resume old lookahead f/ before error
symbol = preErrorSymbol;
preErrorSymbol = null;
}
break;
case 2: // reduce
//this.reductionCount++;
len = this.productions_[action[1]][1];
// perform semantic action
yyval.$ = vstack[vstack.length-len]; // default to $$ = $1
// default location, uses first token for firsts, last for lasts
yyval._$ = {
first_line: lstack[lstack.length-(len||1)].first_line,
last_line: lstack[lstack.length-1].last_line,
first_column: lstack[lstack.length-(len||1)].first_column,
last_column: lstack[lstack.length-1].last_column
};
r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
if (typeof r !== 'undefined') {
return r;
}
// pop off stack
if (len) {
stack = stack.slice(0,-1*len*2);
vstack = vstack.slice(0, -1*len);
lstack = lstack.slice(0, -1*len);
}
stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce)
vstack.push(yyval.$);
lstack.push(yyval._$);
// goto new state = table[STATE][NONTERMINAL]
newState = table[stack[stack.length-2]][stack[stack.length-1]];
stack.push(newState);
break;
case 3: // accept
return true;
}
}
return true;
}};/* Jison generated lexer */
var lexer = (function(){
var lexer = ({EOF:1,
parseError:function parseError(str, hash) {
if (this.yy.parseError) {
this.yy.parseError(str, hash);
} else {
throw new Error(str);
}
},
setInput:function (input) {
this._input = input;
this._more = this._less = this.done = false;
this.yylineno = this.yyleng = 0;
this.yytext = this.matched = this.match = '';
this.conditionStack = ['INITIAL'];
this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};
return this;
},
input:function () {
var ch = this._input[0];
this.yytext+=ch;
this.yyleng++;
this.match+=ch;
this.matched+=ch;
var lines = ch.match(/\n/);
if (lines) this.yylineno++;
this._input = this._input.slice(1);
return ch;
},
unput:function (ch) {
this._input = ch + this._input;
return this;
},
more:function () {
this._more = true;
return this;
},
pastInput:function () {
var past = this.matched.substr(0, this.matched.length - this.match.length);
return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
},
upcomingInput:function () {
var next = this.match;
if (next.length < 20) {
next += this._input.substr(0, 20-next.length);
}
return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, "");
},
showPosition:function () {
var pre = this.pastInput();
var c = new Array(pre.length + 1).join("-");
return pre + this.upcomingInput() + "\n" + c+"^";
},
next:function () {
if (this.done) {
return this.EOF;
}
if (!this._input) this.done = true;
var token,
match,
col,
lines;
if (!this._more) {
this.yytext = '';
this.match = '';
}
var rules = this._currentRules();
for (var i=0;i < rules.length; i++) {
match = this._input.match(this.rules[rules[i]]);
if (match) {
lines = match[0].match(/\n.*/g);
if (lines) this.yylineno += lines.length;
this.yylloc = {first_line: this.yylloc.last_line,
last_line: this.yylineno+1,
first_column: this.yylloc.last_column,
last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length};
this.yytext += match[0];
this.match += match[0];
this.matches = match;
this.yyleng = this.yytext.length;
this._more = false;
this._input = this._input.slice(match[0].length);
this.matched += match[0];
token = this.performAction.call(this, this.yy, this, rules[i],this.conditionStack[this.conditionStack.length-1]);
if (token) return token;
else return;
}
}
if (this._input === "") {
return this.EOF;
} else {
this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
{text: "", token: null, line: this.yylineno});
}
},
lex:function lex() {
var r = this.next();
if (typeof r !== 'undefined') {
return r;
} else {
return this.lex();
}
},
begin:function begin(condition) {
this.conditionStack.push(condition);
},
popState:function popState() {
return this.conditionStack.pop();
},
_currentRules:function _currentRules() {
return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;
},
topState:function () {
return this.conditionStack[this.conditionStack.length-2];
},
pushState:function begin(condition) {
this.begin(condition);
}});
lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
var YYSTATE=YY_START;
switch($avoiding_name_collisions) {
case 0:/* skip whitespace */
break;
case 1:return 20
break;
case 2:return 19
break;
case 3:return 8
break;
case 4:return 9
break;
case 5:return 6
break;
case 6:return 7
break;
case 7:return 11
break;
case 8:return 13
break;
case 9:return 10
break;
case 10:return 12
break;
case 11:return 14
break;
case 12:return 15
break;
case 13:return 16
break;
case 14:return 17
break;
case 15:return 18
break;
case 16:return 5
break;
case 17:return 'INVALID'
break;
}
};
lexer.rules = [/^\s+/,/^[0-9]+(\.[0-9]+)?\b/,/^n\b/,/^\|\|/,/^&&/,/^\?/,/^:/,/^<=/,/^>=/,/^,/^>/,/^!=/,/^==/,/^%/,/^\(/,/^\)/,/^$/,/^./];
lexer.conditions = {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],"inclusive":true}};return lexer;})()
parser.lexer = lexer;
return parser;
})();
;
plural_forms_parser = Jed.PF;
function _get_plural_forms_function(plural_forms_string) {
return plural_forms_parser.compile(plural_forms_string || "nplurals=2; plural=(n != 1);");
};
if (!_get_plural_forms_function.__argnames__) Object.defineProperties(_get_plural_forms_function, {
__argnames__ : {value: ["plural_forms_string"]},
__module__ : {value: "gettext"}
});
_gettext = (function() {
var ρσ_anonfunc = function (text) {
return text;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["text"]},
__module__ : {value: "gettext"}
});
return ρσ_anonfunc;
})();
_ngettext = (function() {
var ρσ_anonfunc = function (text, plural, n) {
return (n === 1) ? text : plural;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["text", "plural", "n"]},
__module__ : {value: "gettext"}
});
return ρσ_anonfunc;
})();
function gettext(text) {
return _gettext(text);
};
if (!gettext.__argnames__) Object.defineProperties(gettext, {
__argnames__ : {value: ["text"]},
__module__ : {value: "gettext"}
});
function ngettext(text, plural, n) {
return _ngettext(text, plural, n);
};
if (!ngettext.__argnames__) Object.defineProperties(ngettext, {
__argnames__ : {value: ["text", "plural", "n"]},
__module__ : {value: "gettext"}
});
function install(translation_data) {
var t, func;
t = new Translations(translation_data);
t.install();
var ρσ_Iter8 = register_callback.install_callbacks;
ρσ_Iter8 = ((typeof ρσ_Iter8[Symbol.iterator] === "function") ? (ρσ_Iter8 instanceof Map ? ρσ_Iter8.keys() : ρσ_Iter8) : Object.keys(ρσ_Iter8));
for (var ρσ_Index8 of ρσ_Iter8) {
func = ρσ_Index8;
try {
func(t);
} catch (ρσ_Exception) {
ρσ_last_exception = ρσ_Exception;
{
}
}
}
return t;
};
if (!install.__argnames__) Object.defineProperties(install, {
__argnames__ : {value: ["translation_data"]},
__module__ : {value: "gettext"}
});
has_prop = Object.prototype.hasOwnProperty.call.bind(Object.prototype.hasOwnProperty);
function register_callback(func) {
register_callback.install_callbacks.push(func);
};
if (!register_callback.__argnames__) Object.defineProperties(register_callback, {
__argnames__ : {value: ["func"]},
__module__ : {value: "gettext"}
});
register_callback.install_callbacks = [];
empty_translation_data = (function(){
var ρσ_d = {};
ρσ_d["entries"] = {};
return ρσ_d;
}).call(this);
function Translations() {
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
Translations.prototype.__init__.apply(this, arguments);
}
Translations.prototype.__init__ = function __init__(translation_data) {
var self = this;
var func;
translation_data = translation_data || empty_translation_data;
func = _get_plural_forms_function(translation_data.plural_forms);
self.translations = [ [ translation_data, func ] ];
self.language = translation_data["language"];
};
if (!Translations.prototype.__init__.__argnames__) Object.defineProperties(Translations.prototype.__init__, {
__argnames__ : {value: ["translation_data"]},
__module__ : {value: "gettext"}
});
Translations.__argnames__ = Translations.prototype.__init__.__argnames__;
Translations.__handles_kwarg_interpolation__ = Translations.prototype.__init__.__handles_kwarg_interpolation__;
Translations.prototype.add_fallback = function add_fallback(fallback) {
var self = this;
var func;
fallback = fallback || empty_translation_data;
func = _get_plural_forms_function(fallback.plural_forms);
self.translations.push([ fallback, func ]);
};
if (!Translations.prototype.add_fallback.__argnames__) Object.defineProperties(Translations.prototype.add_fallback, {
__argnames__ : {value: ["fallback"]},
__module__ : {value: "gettext"}
});
Translations.prototype.gettext = function gettext(text) {
var self = this;
var m, t;
var ρσ_Iter9 = self.translations;
ρσ_Iter9 = ((typeof ρσ_Iter9[Symbol.iterator] === "function") ? (ρσ_Iter9 instanceof Map ? ρσ_Iter9.keys() : ρσ_Iter9) : Object.keys(ρσ_Iter9));
for (var ρσ_Index9 of ρσ_Iter9) {
t = ρσ_Index9;
m = t[0].entries;
if (has_prop(m, text)) {
return m[(typeof text === "number" && text < 0) ? m.length + text : text][0];
}
}
return text;
};
if (!Translations.prototype.gettext.__argnames__) Object.defineProperties(Translations.prototype.gettext, {
__argnames__ : {value: ["text"]},
__module__ : {value: "gettext"}
});
Translations.prototype.ngettext = function ngettext(text, plural, n) {
var self = this;
var m, idx, t;
var ρσ_Iter10 = self.translations;
ρσ_Iter10 = ((typeof ρσ_Iter10[Symbol.iterator] === "function") ? (ρσ_Iter10 instanceof Map ? ρσ_Iter10.keys() : ρσ_Iter10) : Object.keys(ρσ_Iter10));
for (var ρσ_Index10 of ρσ_Iter10) {
t = ρσ_Index10;
m = t[0].entries;
if (has_prop(m, text)) {
idx = t[1](n);
return (ρσ_expr_temp = m[(typeof text === "number" && text < 0) ? m.length + text : text])[(typeof idx === "number" && idx < 0) ? ρσ_expr_temp.length + idx : idx] || ((n === 1) ? text : plural);
}
}
return (n === 1) ? text : plural;
};
if (!Translations.prototype.ngettext.__argnames__) Object.defineProperties(Translations.prototype.ngettext, {
__argnames__ : {value: ["text", "plural", "n"]},
__module__ : {value: "gettext"}
});
Translations.prototype.install = function install() {
var self = this;
_gettext = (function() {
var ρσ_anonfunc = function () {
return self.gettext.apply(self, arguments);
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "gettext"}
});
return ρσ_anonfunc;
})();
_ngettext = (function() {
var ρσ_anonfunc = function () {
return self.ngettext.apply(self, arguments);
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "gettext"}
});
return ρσ_anonfunc;
})();
};
if (!Translations.prototype.install.__module__) Object.defineProperties(Translations.prototype.install, {
__module__ : {value: "gettext"}
});
Translations.prototype.__repr__ = function __repr__ () {
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
};
Translations.prototype.__str__ = function __str__ () {
return this.__repr__();
};
Object.defineProperty(Translations.prototype, "__bases__", {value: []});
ρσ_modules.gettext.Jed = Jed;
ρσ_modules.gettext.plural_forms_parser = plural_forms_parser;
ρσ_modules.gettext._gettext = _gettext;
ρσ_modules.gettext._ngettext = _ngettext;
ρσ_modules.gettext.has_prop = has_prop;
ρσ_modules.gettext.empty_translation_data = empty_translation_data;
ρσ_modules.gettext._get_plural_forms_function = _get_plural_forms_function;
ρσ_modules.gettext.gettext = gettext;
ρσ_modules.gettext.ngettext = ngettext;
ρσ_modules.gettext.install = install;
ρσ_modules.gettext.register_callback = register_callback;
ρσ_modules.gettext.Translations = Translations;
})();
(function(){
var __name__ = "pythonize";
function strings() {
var string_funcs, exclude, name;
string_funcs = set("capitalize strip lstrip rstrip islower isupper isspace lower upper swapcase center count endswith startswith find rfind index rindex format join ljust rjust partition rpartition replace split rsplit splitlines zfill".split(" "));
if (!arguments.length) {
exclude = (function(){
var s = ρσ_set();
s.jsset.add("split");
s.jsset.add("replace");
return s;
})();
} else if (arguments[0]) {
exclude = Array.from(arguments);
} else {
exclude = null;
}
if (exclude) {
string_funcs = string_funcs.difference(set(exclude));
}
var ρσ_Iter11 = string_funcs;
ρσ_Iter11 = ((typeof ρσ_Iter11[Symbol.iterator] === "function") ? (ρσ_Iter11 instanceof Map ? ρσ_Iter11.keys() : ρσ_Iter11) : Object.keys(ρσ_Iter11));
for (var ρσ_Index11 of ρσ_Iter11) {
name = ρσ_Index11;
(ρσ_expr_temp = String.prototype)[(typeof name === "number" && name < 0) ? ρσ_expr_temp.length + name : name] = (ρσ_expr_temp = ρσ_str.prototype)[(typeof name === "number" && name < 0) ? ρσ_expr_temp.length + name : name];
}
};
if (!strings.__module__) Object.defineProperties(strings, {
__module__ : {value: "pythonize"}
});
ρσ_modules.pythonize.strings = strings;
})();
(function(){
var __name__ = "initialize";
var strings = ρσ_modules.pythonize.strings;
strings();
})();
(function(){
var __name__ = "ajax";
var default_timeout;
var _ = ρσ_modules.gettext.gettext;
default_timeout = 300;
function encode_query_component(x) {
var ans;
ans = encodeURIComponent(x);
ans = ans.replace(/%2[fF]/g, "/");
ans = ans.replace(/%40/g, "@");
ans = ans.replace(/%5[bB]/g, "[");
ans = ans.replace(/%5[dD]/g, "]");
ans = ans.replace(/%5[eE]/g, "^");
ans = ans.replace(/%3[aA]/g, ":");
return ans;
};
if (!encode_query_component.__argnames__) Object.defineProperties(encode_query_component, {
__argnames__ : {value: ["x"]},
__module__ : {value: "ajax"}
});
function encode_query(query, qchar) {
var keys, ans, val, k;
if (!query) {
return "";
}
qchar = qchar || "?";
keys = Object.keys(query).sort();
ans = "";
if (keys.length) {
var ρσ_Iter12 = keys;
ρσ_Iter12 = ((typeof ρσ_Iter12[Symbol.iterator] === "function") ? (ρσ_Iter12 instanceof Map ? ρσ_Iter12.keys() : ρσ_Iter12) : Object.keys(ρσ_Iter12));
for (var ρσ_Index12 of ρσ_Iter12) {
k = ρσ_Index12;
val = query[(typeof k === "number" && k < 0) ? query.length + k : k];
if (val === undefined || val === null || val === "") {
continue;
}
ans += qchar + encodeURIComponent(k) + "=" + encode_query_component(val.toString());
qchar = "&";
}
}
return ans;
};
if (!encode_query.__argnames__) Object.defineProperties(encode_query, {
__argnames__ : {value: ["query", "qchar"]},
__module__ : {value: "ajax"}
});
function absolute_path(path) {
var slash;
if (path[0] !== "/") {
slash = ((ρσ_expr_temp = window.location.pathname)[ρσ_expr_temp.length-1] === "/") ? "" : "/";
path = window.location.pathname + slash + path;
}
return path;
};
if (!absolute_path.__argnames__) Object.defineProperties(absolute_path, {
__argnames__ : {value: ["path"]},
__module__ : {value: "ajax"}
});
function workaround_qt_bug() {
var xhr = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
var end_type = ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[1];
var ok_code = (arguments[2] === undefined || ( 2 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? workaround_qt_bug.__defaults__.ok_code : arguments[2];
var ρσ_kwargs_obj = arguments[arguments.length-1];
if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "ok_code")){
ok_code = ρσ_kwargs_obj.ok_code;
}
if (end_type === "error" && xhr.status === ok_code && window.navigator.userAgent.indexOf("calibre-viewer") === 0) {
end_type = "load";
}
return end_type;
};
if (!workaround_qt_bug.__defaults__) Object.defineProperties(workaround_qt_bug, {
__defaults__ : {value: {ok_code:200}},
__handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["xhr", "end_type", "ok_code"]},
__module__ : {value: "ajax"}
});
function ajax() {
var path = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
var on_complete = ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[1];
var on_progress = (arguments[2] === undefined || ( 2 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ajax.__defaults__.on_progress : arguments[2];
var bypass_cache = (arguments[3] === undefined || ( 3 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ajax.__defaults__.bypass_cache : arguments[3];
var method = (arguments[4] === undefined || ( 4 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ajax.__defaults__.method : arguments[4];
var query = (arguments[5] === undefined || ( 5 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ajax.__defaults__.query : arguments[5];
var timeout = (arguments[6] === undefined || ( 6 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ajax.__defaults__.timeout : arguments[6];
var ok_code = (arguments[7] === undefined || ( 7 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ajax.__defaults__.ok_code : arguments[7];
var progress_totals_needed = (arguments[8] === undefined || ( 8 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ajax.__defaults__.progress_totals_needed : arguments[8];
var ρσ_kwargs_obj = arguments[arguments.length-1];
if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "on_progress")){
on_progress = ρσ_kwargs_obj.on_progress;
}
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "bypass_cache")){
bypass_cache = ρσ_kwargs_obj.bypass_cache;
}
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "method")){
method = ρσ_kwargs_obj.method;
}
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "query")){
query = ρσ_kwargs_obj.query;
}
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "timeout")){
timeout = ρσ_kwargs_obj.timeout;
}
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "ok_code")){
ok_code = ρσ_kwargs_obj.ok_code;
}
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "progress_totals_needed")){
progress_totals_needed = ρσ_kwargs_obj.progress_totals_needed;
}
var xhr, eq, has_query;
if (timeout === null) {
timeout = default_timeout;
}
query = query || Object.create(null);
xhr = new XMLHttpRequest;
eq = encode_query(query);
has_query = eq.length > 0;
path = absolute_path(path) + eq;
if (bypass_cache) {
path += ((has_query) ? "&" : "?") + (new Date).getTime();
}
xhr.request_path = path;
xhr.error_html = "";
function set_error(event, is_network_error) {
var rtext;
if (is_network_error) {
xhr.error_html = str.format(_("Failed to communicate with \"{}\", network error. Is the server running and accessible?"), xhr.request_path);
} else if (event === "timeout") {
xhr.error_html = str.format(_("Failed to communicate with \"{}\", timed out after: {} seconds"), xhr.request_path, timeout);
} else if (event === "abort") {
xhr.error_html = str.format(_("Failed to communicate with \"{}\", aborted"), xhr.request_path);
} else {
try {
rtext = xhr.responseText || "";
} catch (ρσ_Exception) {
ρσ_last_exception = ρσ_Exception;
{
rtext = "";
}
}
xhr.error_html = str.format(_("Failed to communicate with \"{}\", with status: [{} ({})] {}
{}"), xhr.request_path, xhr.status, event, xhr.statusText, rtext.slice(0, 200));
}
};
if (!set_error.__argnames__) Object.defineProperties(set_error, {
__argnames__ : {value: ["event", "is_network_error"]},
__module__ : {value: "ajax"}
});
function progress_callback(ev) {
var ul;
if (ev.lengthComputable) {
on_progress(ev.loaded, ev.total, xhr);
} else if (ev.loaded) {
if (!progress_totals_needed) {
on_progress(ev.loaded, undefined, xhr);
return;
}
ul = xhr.getResponseHeader("Calibre-Uncompressed-Length");
if (ul) {
try {
ul = int(ul);
} catch (ρσ_Exception) {
ρσ_last_exception = ρσ_Exception;
if (ρσ_Exception instanceof Error) {
return;
} else {
throw ρσ_Exception;
}
}
on_progress(ev.loaded, ul, xhr);
}
}
};
if (!progress_callback.__argnames__) Object.defineProperties(progress_callback, {
__argnames__ : {value: ["ev"]},
__module__ : {value: "ajax"}
});
function complete_callback(end_type, ev) {
var is_network_error;
is_network_error = (end_type === "error") ? ev : false;
if (xhr.status !== ok_code && end_type === "load") {
end_type = "error";
}
end_type = workaround_qt_bug(xhr, end_type, ok_code);
if (end_type !== "load") {
set_error(end_type, is_network_error);
}
on_complete(end_type, xhr, ev);
};
if (!complete_callback.__argnames__) Object.defineProperties(complete_callback, {
__argnames__ : {value: ["end_type", "ev"]},
__module__ : {value: "ajax"}
});
if (on_progress) {
xhr.addEventListener("progress", progress_callback);
}
xhr.addEventListener("abort", (function() {
var ρσ_anonfunc = function (ev) {
complete_callback("abort", ev);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["ev"]},
__module__ : {value: "ajax"}
});
return ρσ_anonfunc;
})());
xhr.addEventListener("error", (function() {
var ρσ_anonfunc = function (ev) {
complete_callback("error", ev);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["ev"]},
__module__ : {value: "ajax"}
});
return ρσ_anonfunc;
})());
xhr.addEventListener("load", (function() {
var ρσ_anonfunc = function (ev) {
complete_callback("load", ev);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["ev"]},
__module__ : {value: "ajax"}
});
return ρσ_anonfunc;
})());
xhr.addEventListener("timeout", (function() {
var ρσ_anonfunc = function (ev) {
complete_callback("timeout", ev);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["ev"]},
__module__ : {value: "ajax"}
});
return ρσ_anonfunc;
})());
xhr.open(method, path);
xhr.timeout = timeout * 1e3;
return xhr;
};
if (!ajax.__defaults__) Object.defineProperties(ajax, {
__defaults__ : {value: {on_progress:null, bypass_cache:true, method:"GET", query:null, timeout:null, ok_code:200, progress_totals_needed:true}},
__handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["path", "on_complete", "on_progress", "bypass_cache", "method", "query", "timeout", "ok_code", "progress_totals_needed"]},
__module__ : {value: "ajax"}
});
function ajax_send() {
var path = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
var data = ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[1];
var on_complete = ( 2 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[2];
var on_progress = (arguments[3] === undefined || ( 3 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ajax_send.__defaults__.on_progress : arguments[3];
var query = (arguments[4] === undefined || ( 4 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ajax_send.__defaults__.query : arguments[4];
var timeout = (arguments[5] === undefined || ( 5 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ajax_send.__defaults__.timeout : arguments[5];
var ok_code = (arguments[6] === undefined || ( 6 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ajax_send.__defaults__.ok_code : arguments[6];
var ρσ_kwargs_obj = arguments[arguments.length-1];
if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "on_progress")){
on_progress = ρσ_kwargs_obj.on_progress;
}
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "query")){
query = ρσ_kwargs_obj.query;
}
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "timeout")){
timeout = ρσ_kwargs_obj.timeout;
}
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "ok_code")){
ok_code = ρσ_kwargs_obj.ok_code;
}
var xhr;
xhr = ajax(path, on_complete, on_progress, false, "POST", query, timeout, ok_code);
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
xhr.send(JSON.stringify(data));
return xhr;
};
if (!ajax_send.__defaults__) Object.defineProperties(ajax_send, {
__defaults__ : {value: {on_progress:null, query:null, timeout:null, ok_code:200}},
__handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["path", "data", "on_complete", "on_progress", "query", "timeout", "ok_code"]},
__module__ : {value: "ajax"}
});
ρσ_modules.ajax.default_timeout = default_timeout;
ρσ_modules.ajax.encode_query_component = encode_query_component;
ρσ_modules.ajax.encode_query = encode_query;
ρσ_modules.ajax.absolute_path = absolute_path;
ρσ_modules.ajax.workaround_qt_bug = workaround_qt_bug;
ρσ_modules.ajax.ajax = ajax;
ρσ_modules.ajax.ajax_send = ajax_send;
})();
(function(){
var __name__ = "book_list";
})();
(function(){
var __name__ = "book_list.globals";
var session_data;
session_data = null;
function set_session_data(sd) {
session_data = sd;
return session_data;
};
if (!set_session_data.__argnames__) Object.defineProperties(set_session_data, {
__argnames__ : {value: ["sd"]},
__module__ : {value: "book_list.globals"}
});
function get_session_data() {
return session_data;
};
if (!get_session_data.__module__) Object.defineProperties(get_session_data, {
__module__ : {value: "book_list.globals"}
});
function main_js(newval) {
if (newval !== undefined) {
main_js.ans = newval;
}
return main_js.ans;
};
if (!main_js.__argnames__) Object.defineProperties(main_js, {
__argnames__ : {value: ["newval"]},
__module__ : {value: "book_list.globals"}
});
function get_current_query(newval) {
if (newval) {
get_current_query.ans = newval;
}
return get_current_query.ans;
};
if (!get_current_query.__argnames__) Object.defineProperties(get_current_query, {
__argnames__ : {value: ["newval"]},
__module__ : {value: "book_list.globals"}
});
function get_translations(val) {
if (val) {
get_translations.ans = val;
}
return get_translations.ans;
};
if (!get_translations.__argnames__) Object.defineProperties(get_translations, {
__argnames__ : {value: ["val"]},
__module__ : {value: "book_list.globals"}
});
ρσ_modules["book_list.globals"].session_data = session_data;
ρσ_modules["book_list.globals"].set_session_data = set_session_data;
ρσ_modules["book_list.globals"].get_session_data = get_session_data;
ρσ_modules["book_list.globals"].main_js = main_js;
ρσ_modules["book_list.globals"].get_current_query = get_current_query;
ρσ_modules["book_list.globals"].get_translations = get_translations;
})();
(function(){
var __name__ = "lru_cache";
function lru_node(key, val) {
return (function(){
var ρσ_d = Object.create(null);
ρσ_d["key"] = key;
ρσ_d["val"] = val;
ρσ_d["prev"] = null;
ρσ_d["next"] = null;
return ρσ_d;
}).call(this);
};
if (!lru_node.__argnames__) Object.defineProperties(lru_node, {
__argnames__ : {value: ["key", "val"]},
__module__ : {value: "lru_cache"}
});
function LRUCache() {
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
LRUCache.prototype.__bind_methods__.call(this);
LRUCache.prototype.__init__.apply(this, arguments);
}
Object.defineProperty(LRUCache.prototype, "__bind_methods__", {value: function () {
this.set_head = LRUCache.prototype.set_head.bind(this);
this.pop = LRUCache.prototype.pop.bind(this);
this.set = LRUCache.prototype.set.bind(this);
this.get = LRUCache.prototype.get.bind(this);
this.clear = LRUCache.prototype.clear.bind(this);
}});
LRUCache.prototype.__init__ = function __init__(size) {
var self = this;
self.limit = 200;
self.clear(size);
};
if (!LRUCache.prototype.__init__.__argnames__) Object.defineProperties(LRUCache.prototype.__init__, {
__argnames__ : {value: ["size"]},
__module__ : {value: "lru_cache"}
});
LRUCache.__argnames__ = LRUCache.prototype.__init__.__argnames__;
LRUCache.__handles_kwarg_interpolation__ = LRUCache.prototype.__init__.__handles_kwarg_interpolation__;
LRUCache.prototype.set_head = function set_head(node) {
var self = this;
node.next = self.head;
node.prev = null;
if (self.head !== null) {
self.head.prev = node;
}
self.head = node;
if (self.tail === null) {
self.tail = node;
}
self.size += 1;
(ρσ_expr_temp = self.map)[ρσ_bound_index(node.key, ρσ_expr_temp)] = node;
};
if (!LRUCache.prototype.set_head.__argnames__) Object.defineProperties(LRUCache.prototype.set_head, {
__argnames__ : {value: ["node"]},
__module__ : {value: "lru_cache"}
});
LRUCache.prototype.pop = function pop(key) {
var self = this;
var node;
node = (ρσ_expr_temp = self.map)[(typeof key === "number" && key < 0) ? ρσ_expr_temp.length + key : key];
if (!node) {
return;
}
if (node.prev !== null) {
node.prev.next = node.next;
} else {
self.head = node.next;
}
if (node.next !== null) {
node.next.prev = node.prev;
} else {
self.tail = node.prev;
}
delete self.map[key];
self.size -= 1;
};
if (!LRUCache.prototype.pop.__argnames__) Object.defineProperties(LRUCache.prototype.pop, {
__argnames__ : {value: ["key"]},
__module__ : {value: "lru_cache"}
});
LRUCache.prototype.set = function set(key, val) {
var self = this;
var node, existing;
node = lru_node(key, val);
existing = (ρσ_expr_temp = self.map)[(typeof key === "number" && key < 0) ? ρσ_expr_temp.length + key : key];
if (existing) {
existing.value = node.value;
self.pop(node.key);
} else if (self.size > self.limit) {
delete self.map[self.tail.key];
self.size -= 1;
self.tail = self.tail.prev;
self.tail.next = null;
}
self.set_head(node);
};
if (!LRUCache.prototype.set.__argnames__) Object.defineProperties(LRUCache.prototype.set, {
__argnames__ : {value: ["key", "val"]},
__module__ : {value: "lru_cache"}
});
LRUCache.prototype.get = function get(key, defval) {
var self = this;
var existing, val, node;
existing = (ρσ_expr_temp = self.map)[(typeof key === "number" && key < 0) ? ρσ_expr_temp.length + key : key];
if (!existing) {
return (defval === undefined) ? null : defval;
}
val = existing.value;
node = lru_node(key, val);
self.pop(key);
self.set_head(node);
return val;
};
if (!LRUCache.prototype.get.__argnames__) Object.defineProperties(LRUCache.prototype.get, {
__argnames__ : {value: ["key", "defval"]},
__module__ : {value: "lru_cache"}
});
LRUCache.prototype.clear = function clear(size) {
var self = this;
self.size = 0;
self.map = Object.create(null);
self.head = self.tail = null;
if (typeof size === "number") {
self.limit = size;
}
};
if (!LRUCache.prototype.clear.__argnames__) Object.defineProperties(LRUCache.prototype.clear, {
__argnames__ : {value: ["size"]},
__module__ : {value: "lru_cache"}
});
LRUCache.prototype.__repr__ = function __repr__ () {
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
};
LRUCache.prototype.__str__ = function __str__ () {
return this.__repr__();
};
Object.defineProperty(LRUCache.prototype, "__bases__", {value: []});
ρσ_modules.lru_cache.lru_node = lru_node;
ρσ_modules.lru_cache.LRUCache = LRUCache;
})();
(function(){
var __name__ = "encodings";
var utf8_decoder_table, _u8enc, utf8_encode;
function base64encode(bytes, altchars, pad_char) {
var l, remainder, main_length, encodings, ans, chunk;
l = bytes.length;
remainder = l % 3;
main_length = l - remainder;
encodings = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" + (altchars || "+/");
pad_char = (pad_char === undefined) ? "=" : pad_char;
ans = [];
for (var i = 0; i < main_length; i += 3) {
chunk = bytes[(typeof i === "number" && i < 0) ? bytes.length + i : i] << 16 | bytes[ρσ_bound_index(i + 1, bytes)] << 8 | bytes[ρσ_bound_index(i + 2, bytes)];
ans.push(encodings[ρσ_bound_index((chunk & 16515072) >> 18, encodings)], encodings[ρσ_bound_index((chunk & 258048) >> 12, encodings)], encodings[ρσ_bound_index((chunk & 4032) >> 6, encodings)], encodings[ρσ_bound_index(chunk & 63, encodings)]);
}
if (remainder === 1) {
chunk = bytes[(typeof main_length === "number" && main_length < 0) ? bytes.length + main_length : main_length];
ans.push(encodings[ρσ_bound_index((chunk & 252) >> 2, encodings)], encodings[ρσ_bound_index((chunk & 3) << 4, encodings)], pad_char, pad_char);
} else if (remainder === 2) {
chunk = bytes[(typeof main_length === "number" && main_length < 0) ? bytes.length + main_length : main_length] << 8 | bytes[ρσ_bound_index(main_length + 1, bytes)];
ans.push(encodings[ρσ_bound_index((chunk & 64512) >> 10, encodings)], encodings[ρσ_bound_index((chunk & 1008) >> 4, encodings)], encodings[ρσ_bound_index((chunk & 15) << 2, encodings)], pad_char);
}
return ans.join("");
};
if (!base64encode.__argnames__) Object.defineProperties(base64encode, {
__argnames__ : {value: ["bytes", "altchars", "pad_char"]},
__module__ : {value: "encodings"}
});
function base64decode(string) {
var chars, ans, i;
if (typeof window !== "undefined") {
chars = window.atob(string);
} else {
chars = Buffer.from(string, "base64").toString("binary");
}
ans = new Uint8Array(chars.length);
for (var ρσ_Index13 = 0; ρσ_Index13 < ans.length; ρσ_Index13++) {
i = ρσ_Index13;
ans[(typeof i === "number" && i < 0) ? ans.length + i : i] = chars.charCodeAt(i);
}
return ans;
};
if (!base64decode.__argnames__) Object.defineProperties(base64decode, {
__argnames__ : {value: ["string"]},
__module__ : {value: "encodings"}
});
function urlsafe_b64encode(bytes, pad_char) {
return base64encode(bytes, "-_", pad_char);
};
if (!urlsafe_b64encode.__argnames__) Object.defineProperties(urlsafe_b64encode, {
__argnames__ : {value: ["bytes", "pad_char"]},
__module__ : {value: "encodings"}
});
function hexlify(bytes) {
var ans, x;
ans = [];
for (var i = 0; i < bytes.length; i++) {
x = bytes[(typeof i === "number" && i < 0) ? bytes.length + i : i].toString(16);
if (x.length === 1) {
x = "0" + x;
}
ans.push(x);
}
return ans.join("");
};
if (!hexlify.__argnames__) Object.defineProperties(hexlify, {
__argnames__ : {value: ["bytes"]},
__module__ : {value: "encodings"}
});
utf8_decoder_table = [
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 00..1f
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 20..3f
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 40..5f
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 60..7f
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, // 80..9f
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, // a0..bf
8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // c0..df
0xa,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x4,0x3,0x3, // e0..ef
0xb,0x6,0x6,0x6,0x5,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8, // f0..ff
0x0,0x1,0x2,0x3,0x5,0x8,0x7,0x1,0x1,0x1,0x4,0x6,0x1,0x1,0x1,0x1, // s0..s0
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,1,1, // s1..s2
1,2,1,1,1,1,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1, // s3..s4
1,2,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,3,1,1,1,1,1,1, // s5..s6
1,3,1,1,1,1,1,3,1,3,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // s7..s8
];
function _from_code_point(x) {
if (x <= 65535) {
return String.fromCharCode(x);
}
x -= 65536;
return String.fromCharCode((x >> 10) + 55296, x % 1024 + 56320);
};
if (!_from_code_point.__argnames__) Object.defineProperties(_from_code_point, {
__argnames__ : {value: ["x"]},
__module__ : {value: "encodings"}
});
function utf8_decode(bytes, errors, replacement) {
var state, ans, byte, typ, codep;
state = 0;
ans = [];
for (var i = 0, l = bytes.length; i < l; i++) {
byte = bytes[(typeof i === "number" && i < 0) ? bytes.length + i : i];
typ = utf8_decoder_table[(typeof byte === "number" && byte < 0) ? utf8_decoder_table.length + byte : byte];
codep = (state !== 0) ? byte & 63 | codep << 6 : 255 >> typ & byte;
state = utf8_decoder_table[ρσ_bound_index(256 + state * 16 + typ, utf8_decoder_table)];
if (state === 0) {
ans.push(_from_code_point(codep));
} else if (state === 1) {
if (!errors || errors === "strict") {
throw new UnicodeDecodeError(str.format("The byte 0x{:02x} at position {} is not valid UTF-8", byte, i));
} else if (errors === "replace") {
ans.push(replacement || "?");
}
}
}
return ans.join("");
};
if (!utf8_decode.__argnames__) Object.defineProperties(utf8_decode, {
__argnames__ : {value: ["bytes", "errors", "replacement"]},
__module__ : {value: "encodings"}
});
function utf8_encode_js(string) {
var escstr, ans, ch, i;
escstr = encodeURIComponent(string);
ans = [];
for (var i = 0; i < escstr.length; i++) {
ch = escstr[(typeof i === "number" && i < 0) ? escstr.length + i : i];
if (ch === "%") {
ans.push(parseInt(escstr.slice(i + 1, i + 3), 16));
i += 2;
} else {
ans.push(ch.charCodeAt(0));
}
}
return new Uint8Array(ans);
};
if (!utf8_encode_js.__argnames__) Object.defineProperties(utf8_encode_js, {
__argnames__ : {value: ["string"]},
__module__ : {value: "encodings"}
});
if (typeof TextEncoder === "function") {
_u8enc = new TextEncoder("utf-8");
utf8_encode = _u8enc.encode.bind(_u8enc);
_u8enc = undefined;
} else {
utf8_encode = utf8_encode_js;
}
ρσ_modules.encodings.utf8_decoder_table = utf8_decoder_table;
ρσ_modules.encodings._u8enc = _u8enc;
ρσ_modules.encodings.utf8_encode = utf8_encode;
ρσ_modules.encodings.base64encode = base64encode;
ρσ_modules.encodings.base64decode = base64decode;
ρσ_modules.encodings.urlsafe_b64encode = urlsafe_b64encode;
ρσ_modules.encodings.hexlify = hexlify;
ρσ_modules.encodings._from_code_point = _from_code_point;
ρσ_modules.encodings.utf8_decode = utf8_decode;
ρσ_modules.encodings.utf8_encode_js = utf8_encode_js;
})();
(function(){
var __name__ = "uuid";
var RFC_4122, random_bytes;
var urlsafe_b64encode = ρσ_modules.encodings.urlsafe_b64encode;
RFC_4122 = 1;
if (typeof crypto === "object" && crypto.getRandomValues) {
random_bytes = (function() {
var ρσ_anonfunc = function (num) {
var ans;
ans = new Uint8Array(num || 16);
crypto.getRandomValues(ans);
return ans;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["num"]},
__module__ : {value: "uuid"}
});
return ρσ_anonfunc;
})();
} else {
random_bytes = (function() {
var ρσ_anonfunc = function (num) {
var ans, i;
ans = new Uint8Array(num || 16);
for (var ρσ_Index14 = 0; ρσ_Index14 < ans.length; ρσ_Index14++) {
i = ρσ_Index14;
ans[(typeof i === "number" && i < 0) ? ans.length + i : i] = Math.floor(Math.random() * 256);
}
return ans;
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["num"]},
__module__ : {value: "uuid"}
});
return ρσ_anonfunc;
})();
}
function short_uuid() {
return urlsafe_b64encode(random_bytes(), "");
};
if (!short_uuid.__module__) Object.defineProperties(short_uuid, {
__module__ : {value: "uuid"}
});
ρσ_modules.uuid.RFC_4122 = RFC_4122;
ρσ_modules.uuid.random_bytes = random_bytes;
ρσ_modules.uuid.short_uuid = short_uuid;
})();
(function(){
var __name__ = "session";
var all_settings, defaults, x, standalone_reader_defaults, default_interface_data;
var short_uuid = ρσ_modules.uuid.short_uuid;
all_settings = (function(){
var ρσ_d = Object.create(null);
ρσ_d["copy_to_library_dupes"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = "add;overwrite";
ρσ_d["category"] = "book_list";
return ρσ_d;
}).call(this);
ρσ_d["last_sort_order"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = Object.create(null);
ρσ_d["category"] = "book_list";
return ρσ_d;
}).call(this);
ρσ_d["show_all_metadata"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = false;
ρσ_d["category"] = "book_list";
return ρσ_d;
}).call(this);
ρσ_d["show_nav_list_book_count"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = true;
ρσ_d["category"] = "book_list";
ρσ_d["is_local"] = false;
return ρσ_d;
}).call(this);
ρσ_d["show_nav_list_avg_rating"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = true;
ρσ_d["category"] = "book_list";
ρσ_d["is_local"] = false;
return ρσ_d;
}).call(this);
ρσ_d["show_sidebar_in_book_viewer"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = false;
ρσ_d["category"] = "book_list";
ρσ_d["is_local"] = false;
return ρσ_d;
}).call(this);
ρσ_d["book_list_color_scheme"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = "auto";
ρσ_d["category"] = "book_list";
ρσ_d["is_local"] = false;
return ρσ_d;
}).call(this);
ρσ_d["ui_highlight_colors"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["light"] = "#437000";
ρσ_d["dark"] = "#6cb4ee";
return ρσ_d;
}).call(this);
ρσ_d["category"] = "book_list";
ρσ_d["is_local"] = false;
return ρσ_d;
}).call(this);
ρσ_d["series_nav_display_mode"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = "stack";
ρσ_d["category"] = "book_list";
ρσ_d["is_local"] = false;
return ρσ_d;
}).call(this);
ρσ_d["saved_virtual_libraries"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = [];
ρσ_d["category"] = "book_list";
ρσ_d["is_local"] = false;
return ρσ_d;
}).call(this);
ρσ_d["browse_visible_fields"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = Object.create(null);
ρσ_d["category"] = "book_list";
ρσ_d["is_local"] = false;
return ρσ_d;
}).call(this);
ρσ_d["sort"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = "timestamp.desc";
ρσ_d["category"] = "book_list";
return ρσ_d;
}).call(this);
ρσ_d["view_mode"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = "cover_grid";
ρσ_d["category"] = "book_list";
return ρσ_d;
}).call(this);
ρσ_d["cover_grid_tile_pct"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = 17;
ρσ_d["category"] = "book_list";
return ρσ_d;
}).call(this);
ρσ_d["fts_related_words"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = true;
ρσ_d["category"] = "book_list";
return ρσ_d;
}).call(this);
ρσ_d["and_search_terms"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = false;
ρσ_d["category"] = "tag_browser";
return ρσ_d;
}).call(this);
ρσ_d["collapse_at"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = 25;
ρσ_d["category"] = "tag_browser";
return ρσ_d;
}).call(this);
ρσ_d["dont_collapse"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = "";
ρσ_d["category"] = "tag_browser";
return ρσ_d;
}).call(this);
ρσ_d["hide_empty_categories"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = "no";
ρσ_d["category"] = "tag_browser";
return ρσ_d;
}).call(this);
ρσ_d["partition_method"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = "first letter";
ρσ_d["category"] = "tag_browser";
return ρσ_d;
}).call(this);
ρσ_d["sort_tags_by"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = "name";
ρσ_d["category"] = "tag_browser";
return ρσ_d;
}).call(this);
ρσ_d["background_image_fade"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = 0;
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["background_image_style"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = "scaled";
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["background_image"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = null;
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["base_font_size"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = 16;
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["book_scrollbar"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = false;
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["columns_per_screen"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["portrait"] = 0;
ρσ_d["landscape"] = 0;
return ρσ_d;
}).call(this);
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["controls_help_shown_count"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = 0;
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
ρσ_d["disallowed_in_profile"] = true;
return ρσ_d;
}).call(this);
ρσ_d["controls_help_shown_count_rtl_page_progression"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = 0;
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
ρσ_d["disallowed_in_profile"] = true;
return ρσ_d;
}).call(this);
ρσ_d["cover_preserve_aspect_ratio"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = true;
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["current_color_scheme"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = "system";
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["footer"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["left"] = "menu-icon-on-hover";
ρσ_d["right"] = "progress";
return ρσ_d;
}).call(this);
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["header"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["right"] = "menu-icon-on-hover";
return ρσ_d;
}).call(this);
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["controls_footer"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["right"] = "progress";
return ρσ_d;
}).call(this);
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["left-margin"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = Object.create(null);
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["right-margin"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = Object.create(null);
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["hide_tooltips"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = false;
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["keyboard_shortcuts"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = Object.create(null);
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["lines_per_sec_auto"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = 1;
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["lines_per_sec_smooth"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = 20;
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["margin_bottom"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = 20;
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["margin_left"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = 20;
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["margin_right"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = 20;
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["margin_top"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = 20;
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["max_text_height"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = 0;
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["max_text_width"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = 0;
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["override_book_colors"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = "never";
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["paged_margin_clicks_scroll_by_screen"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = true;
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["paged_wheel_scrolls_by_screen"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = false;
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["paged_wheel_section_jumps"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = true;
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["paged_pixel_scroll_threshold"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = 60;
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["read_mode"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = "paged";
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["scroll_auto_boundary_delay"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = 5;
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["scroll_mouse_boundary_delay"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = .5;
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["scroll_stop_boundaries"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = false;
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["standalone_font_settings"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = Object.create(null);
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["standalone_misc_settings"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = Object.create(null);
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["standalone_recently_opened"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = [];
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
ρσ_d["disallowed_in_profile"] = true;
return ρσ_d;
}).call(this);
ρσ_d["user_color_schemes"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = Object.create(null);
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["user_stylesheet"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = "";
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["word_actions"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = [];
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["highlight_style"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = null;
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["highlights_export_format"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = "text";
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["custom_highlight_styles"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = [];
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["show_selection_bar"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = true;
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["net_search_url"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = "https://google.com/search?q={q}";
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["selection_bar_actions"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = [ "copy", "lookup", "highlight", "remove_highlight", "search_net", "clear" ];
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["selection_bar_quick_highlights"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = [];
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["skipped_dialogs"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = {};
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
ρσ_d["disallowed_in_profile"] = true;
return ρσ_d;
}).call(this);
ρσ_d["tts"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = {};
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
ρσ_d["disallowed_in_profile"] = true;
return ρσ_d;
}).call(this);
ρσ_d["tts_backend"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = {};
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
ρσ_d["disallowed_in_profile"] = true;
return ρσ_d;
}).call(this);
ρσ_d["fullscreen_when_opening"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = "auto";
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["book_search_mode"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = "contains";
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["book_search_case_sensitive"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = false;
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["reverse_page_turn_zones"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = false;
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = true;
return ρσ_d;
}).call(this);
ρσ_d["gesture_overrides"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = Object.create(null);
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["cite_text_template"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = "[{text}]({url})";
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["cite_hl_template"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = "[{text}]({url})";
ρσ_d["category"] = "read_book";
return ρσ_d;
}).call(this);
ρσ_d["tts_bar_position"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["default"] = "float";
ρσ_d["category"] = "read_book";
ρσ_d["is_local"] = false;
ρσ_d["disallowed_in_profile"] = false;
return ρσ_d;
}).call(this);
return ρσ_d;
}).call(this);
defaults = Object.create(null);
var ρσ_Iter15 = Object.entries(all_settings);
ρσ_Iter15 = ((typeof ρσ_Iter15[Symbol.iterator] === "function") ? (ρσ_Iter15 instanceof Map ? ρσ_Iter15.keys() : ρσ_Iter15) : Object.keys(ρσ_Iter15));
for (var ρσ_Index15 of ρσ_Iter15) {
x = ρσ_Index15;
defaults[ρσ_bound_index(x[0], defaults)] = x[1].default;
}
function session_defaults() {
return defaults;
};
if (!session_defaults.__module__) Object.defineProperties(session_defaults, {
__module__ : {value: "session"}
});
function storage_available(which) {
var storage, x;
which = which || "localStorage";
try {
storage = window[(typeof which === "number" && which < 0) ? window.length + which : which];
x = "__storage__test__";
storage.setItem(x, x);
storage.removeItem(x);
return true;
} catch (ρσ_Exception) {
ρσ_last_exception = ρσ_Exception;
{
return false;
}
}
};
if (!storage_available.__argnames__) Object.defineProperties(storage_available, {
__argnames__ : {value: ["which"]},
__module__ : {value: "session"}
});
function FakeStorage() {
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
FakeStorage.prototype.__bind_methods__.call(this);
FakeStorage.prototype.__init__.apply(this, arguments);
}
Object.defineProperty(FakeStorage.prototype, "__bind_methods__", {value: function () {
this.getItem = FakeStorage.prototype.getItem.bind(this);
this.setItem = FakeStorage.prototype.setItem.bind(this);
this.clear = FakeStorage.prototype.clear.bind(this);
}});
FakeStorage.prototype.__init__ = function __init__() {
var self = this;
self.data = Object.create(null);
};
if (!FakeStorage.prototype.__init__.__module__) Object.defineProperties(FakeStorage.prototype.__init__, {
__module__ : {value: "session"}
});
FakeStorage.__argnames__ = FakeStorage.prototype.__init__.__argnames__;
FakeStorage.__handles_kwarg_interpolation__ = FakeStorage.prototype.__init__.__handles_kwarg_interpolation__;
FakeStorage.prototype.getItem = function getItem(key) {
var self = this;
return (ρσ_expr_temp = self.data)[(typeof key === "number" && key < 0) ? ρσ_expr_temp.length + key : key];
};
if (!FakeStorage.prototype.getItem.__argnames__) Object.defineProperties(FakeStorage.prototype.getItem, {
__argnames__ : {value: ["key"]},
__module__ : {value: "session"}
});
FakeStorage.prototype.setItem = function setItem(key, value) {
var self = this;
if (typeof value !== "string") {
value = JSON.stringify(value);
}
(ρσ_expr_temp = self.data)[(typeof key === "number" && key < 0) ? ρσ_expr_temp.length + key : key] = value;
};
if (!FakeStorage.prototype.setItem.__argnames__) Object.defineProperties(FakeStorage.prototype.setItem, {
__argnames__ : {value: ["key", "value"]},
__module__ : {value: "session"}
});
FakeStorage.prototype.clear = function clear() {
var self = this;
self.data = Object.create(null);
};
if (!FakeStorage.prototype.clear.__module__) Object.defineProperties(FakeStorage.prototype.clear, {
__module__ : {value: "session"}
});
FakeStorage.prototype.__repr__ = function __repr__ () {
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
};
FakeStorage.prototype.__str__ = function __str__ () {
return this.__repr__();
};
Object.defineProperty(FakeStorage.prototype, "__bases__", {value: []});
function get_session_storage() {
if (!get_session_storage.ans) {
if (storage_available("localStorage")) {
get_session_storage.ans = window.localStorage;
} else if (storage_available("sessionStorage")) {
get_session_storage.ans = window.sessionStorage;
console.error("localStorage not available using sessionStorage instead");
} else {
get_session_storage.ans = new FakeStorage;
console.error("sessionStorage and localStorage not available using a temp cache instead");
}
}
return get_session_storage.ans;
};
if (!get_session_storage.__module__) Object.defineProperties(get_session_storage, {
__module__ : {value: "session"}
});
function SessionData() {
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
SessionData.prototype.__bind_methods__.call(this);
SessionData.prototype.__init__.apply(this, arguments);
}
Object.defineProperty(SessionData.prototype, "__bind_methods__", {value: function () {
this.get = SessionData.prototype.get.bind(this);
this.set = SessionData.prototype.set.bind(this);
this.set_bulk = SessionData.prototype.set_bulk.bind(this);
this.clear = SessionData.prototype.clear.bind(this);
}});
SessionData.prototype.__init__ = function __init__() {
var self = this;
var global_prefix = (arguments[0] === undefined || ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? __init__.__defaults__.global_prefix : arguments[0];
var ρσ_kwargs_obj = arguments[arguments.length-1];
if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "global_prefix")){
global_prefix = ρσ_kwargs_obj.global_prefix;
}
self.global_prefix = global_prefix || "calibre-session-";
self.storage = get_session_storage();
self.overflow_storage = Object.create(null);
self.has_overflow = false;
};
if (!SessionData.prototype.__init__.__defaults__) Object.defineProperties(SessionData.prototype.__init__, {
__defaults__ : {value: {global_prefix:null}},
__handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["global_prefix"]},
__module__ : {value: "session"}
});
SessionData.__argnames__ = SessionData.prototype.__init__.__argnames__;
SessionData.__handles_kwarg_interpolation__ = SessionData.prototype.__init__.__handles_kwarg_interpolation__;
SessionData.prototype.get = function get(key, defval) {
var self = this;
var ans;
key = self.global_prefix + key;
if (self.has_overflow) {
ans = (ρσ_expr_temp = self.overflow_storage)[(typeof key === "number" && key < 0) ? ρσ_expr_temp.length + key : key];
if (ans === undefined) {
ans = self.storage.getItem(key);
}
} else {
ans = self.storage.getItem(key);
}
if (ans === undefined || ans === null) {
if (defval === undefined) {
defval = null;
}
return defval;
}
try {
return JSON.parse(ans);
} catch (ρσ_Exception) {
ρσ_last_exception = ρσ_Exception;
{
if (defval === undefined) {
defval = null;
}
return defval;
}
}
};
if (!SessionData.prototype.get.__argnames__) Object.defineProperties(SessionData.prototype.get, {
__argnames__ : {value: ["key", "defval"]},
__module__ : {value: "session"}
});
SessionData.prototype.set = function set(key, value) {
var self = this;
key = self.global_prefix + key;
if (value === null) {
self.storage.removeItem(key);
delete self.overflow_storage[key];
return true;
}
value = JSON.stringify(value);
try {
self.storage.setItem(key, value);
delete self.overflow_storage[key];
return true;
} catch (ρσ_Exception) {
ρσ_last_exception = ρσ_Exception;
{
(ρσ_expr_temp = self.overflow_storage)[(typeof key === "number" && key < 0) ? ρσ_expr_temp.length + key : key] = value;
self.has_overflow = true;
console.error("session storage has overflowed, using a temp cache instead");
}
}
return false;
};
if (!SessionData.prototype.set.__argnames__) Object.defineProperties(SessionData.prototype.set, {
__argnames__ : {value: ["key", "value"]},
__module__ : {value: "session"}
});
SessionData.prototype.set_bulk = function set_bulk(changes) {
var self = this;
var key;
var ρσ_Iter16 = Object.keys(changes);
ρσ_Iter16 = ((typeof ρσ_Iter16[Symbol.iterator] === "function") ? (ρσ_Iter16 instanceof Map ? ρσ_Iter16.keys() : ρσ_Iter16) : Object.keys(ρσ_Iter16));
for (var ρσ_Index16 of ρσ_Iter16) {
key = ρσ_Index16;
self.set(key, changes[(typeof key === "number" && key < 0) ? changes.length + key : key]);
}
};
if (!SessionData.prototype.set_bulk.__argnames__) Object.defineProperties(SessionData.prototype.set_bulk, {
__argnames__ : {value: ["changes"]},
__module__ : {value: "session"}
});
SessionData.prototype.clear = function clear() {
var self = this;
self.storage.clear();
self.overflow_storage = Object.create(null);
self.has_overflow = false;
};
if (!SessionData.prototype.clear.__module__) Object.defineProperties(SessionData.prototype.clear, {
__module__ : {value: "session"}
});
SessionData.prototype.__repr__ = function __repr__ () {
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
};
SessionData.prototype.__str__ = function __str__ () {
return this.__repr__();
};
Object.defineProperty(SessionData.prototype, "__bases__", {value: []});
function local_storage() {
if (!local_storage.storage) {
local_storage.storage = new SessionData("calibre-local-");
}
return local_storage.storage;
};
if (!local_storage.__module__) Object.defineProperties(local_storage, {
__module__ : {value: "session"}
});
function get_device_uuid() {
var s, ans;
if (!get_device_uuid.ans) {
s = local_storage();
ans = s.get("device_uuid");
if (!ans) {
ans = short_uuid();
s.set("device_uuid", ans);
}
get_device_uuid.ans = ans;
}
return get_device_uuid.ans;
};
if (!get_device_uuid.__module__) Object.defineProperties(get_device_uuid, {
__module__ : {value: "session"}
});
function deep_eq(a, b) {
var i, ka, key;
if (a === b) {
return true;
}
if (Array.isArray(a) && Array.isArray(b)) {
if (a.length !== b.length) {
return false;
}
for (var ρσ_Index17 = 0; ρσ_Index17 < a.length; ρσ_Index17++) {
i = ρσ_Index17;
if (!deep_eq(a[(typeof i === "number" && i < 0) ? a.length + i : i], b[(typeof i === "number" && i < 0) ? b.length + i : i])) {
return false;
}
}
return true;
}
if (a === null || b === null || a === undefined || b === undefined) {
return false;
}
if (typeof a !== "object" || typeof b !== "object") {
return false;
}
ka = Object.keys(a);
if (ka.length !== Object.keys(b).length) {
return false;
}
var ρσ_Iter18 = ka;
ρσ_Iter18 = ((typeof ρσ_Iter18[Symbol.iterator] === "function") ? (ρσ_Iter18 instanceof Map ? ρσ_Iter18.keys() : ρσ_Iter18) : Object.keys(ρσ_Iter18));
for (var ρσ_Index18 of ρσ_Iter18) {
key = ρσ_Index18;
if (!deep_eq(a[(typeof key === "number" && key < 0) ? a.length + key : key], b[(typeof key === "number" && key < 0) ? b.length + key : key])) {
return false;
}
}
return true;
};
if (!deep_eq.__argnames__) Object.defineProperties(deep_eq, {
__argnames__ : {value: ["a", "b"]},
__module__ : {value: "session"}
});
function get_subset_of_settings(sd, filter_func) {
var ans, curval, metadata, is_set, setting_name;
ans = Object.create(null);
var ρσ_Iter19 = Object.keys(all_settings);
ρσ_Iter19 = ((typeof ρσ_Iter19[Symbol.iterator] === "function") ? (ρσ_Iter19 instanceof Map ? ρσ_Iter19.keys() : ρσ_Iter19) : Object.keys(ρσ_Iter19));
for (var ρσ_Index19 of ρσ_Iter19) {
setting_name = ρσ_Index19;
curval = sd.get(setting_name, ans);
metadata = all_settings[(typeof setting_name === "number" && setting_name < 0) ? all_settings.length + setting_name : setting_name];
is_set = curval !== ans;
if (filter_func(setting_name, metadata, is_set, curval)) {
ans[(typeof setting_name === "number" && setting_name < 0) ? ans.length + setting_name : setting_name] = window.structuredClone((is_set) ? curval : metadata.default);
}
}
return ans;
};
if (!get_subset_of_settings.__argnames__) Object.defineProperties(get_subset_of_settings, {
__argnames__ : {value: ["sd", "filter_func"]},
__module__ : {value: "session"}
});
function apply_profile(sd, profile, filter_func) {
var changes, metadata, curval, is_set, newval, setting_name;
changes = Object.create(null);
var ρσ_Iter20 = Object.keys(all_settings);
ρσ_Iter20 = ((typeof ρσ_Iter20[Symbol.iterator] === "function") ? (ρσ_Iter20 instanceof Map ? ρσ_Iter20.keys() : ρσ_Iter20) : Object.keys(ρσ_Iter20));
for (var ρσ_Index20 of ρσ_Iter20) {
setting_name = ρσ_Index20;
metadata = all_settings[(typeof setting_name === "number" && setting_name < 0) ? all_settings.length + setting_name : setting_name];
curval = sd.get(setting_name, changes);
is_set = curval !== changes;
if (filter_func(setting_name, metadata, is_set, curval)) {
newval = null;
if (Object.prototype.hasOwnProperty.call(profile, setting_name)) {
newval = profile[(typeof setting_name === "number" && setting_name < 0) ? profile.length + setting_name : setting_name];
if (deep_eq(newval, metadata.default)) {
newval = null;
}
}
changes[(typeof setting_name === "number" && setting_name < 0) ? changes.length + setting_name : setting_name] = window.structuredClone(newval);
}
}
sd.set_bulk(changes);
return changes;
};
if (!apply_profile.__argnames__) Object.defineProperties(apply_profile, {
__argnames__ : {value: ["sd", "profile", "filter_func"]},
__module__ : {value: "session"}
});
standalone_reader_defaults = (function(){
var ρσ_d = Object.create(null);
ρσ_d["remember_window_geometry"] = false;
ρσ_d["remember_last_read"] = true;
ρσ_d["show_actions_toolbar"] = false;
ρσ_d["show_actions_toolbar_in_fullscreen"] = false;
ρσ_d["save_annotations_in_ebook"] = false;
ρσ_d["sync_annots_user"] = "";
ρσ_d["singleinstance"] = false;
ρσ_d["auto_hide_mouse"] = true;
ρσ_d["restore_docks"] = true;
return ρσ_d;
}).call(this);
function settings_for_reader_profile(sd) {
var margin_text_settings;
margin_text_settings = (function(){
var ρσ_d = Object.create(null);
ρσ_d["footer"] = true;
ρσ_d["header"] = true;
ρσ_d["controls_footer"] = true;
ρσ_d["left-margin"] = true;
ρσ_d["right-margin"] = true;
return ρσ_d;
}).call(this);
function filter_func(setting_name, metadata, is_set, curval) {
var x, key;
if (margin_text_settings[(typeof setting_name === "number" && setting_name < 0) ? margin_text_settings.length + setting_name : setting_name]) {
curval = window.structuredClone(curval);
var ρσ_Iter21 = [ "left", "right", "middle" ];
ρσ_Iter21 = ((typeof ρσ_Iter21[Symbol.iterator] === "function") ? (ρσ_Iter21 instanceof Map ? ρσ_Iter21.keys() : ρσ_Iter21) : Object.keys(ρσ_Iter21));
for (var ρσ_Index21 of ρσ_Iter21) {
x = ρσ_Index21;
if (curval[(typeof x === "number" && x < 0) ? curval.length + x : x] === "empty") {
delete curval[x];
}
}
} else if (setting_name === "standalone_misc_settings") {
curval = window.structuredClone(curval);
var ρσ_Iter22 = Object.keys(curval);
ρσ_Iter22 = ((typeof ρσ_Iter22[Symbol.iterator] === "function") ? (ρσ_Iter22 instanceof Map ? ρσ_Iter22.keys() : ρσ_Iter22) : Object.keys(ρσ_Iter22));
for (var ρσ_Index22 of ρσ_Iter22) {
key = ρσ_Index22;
if (curval[(typeof key === "number" && key < 0) ? curval.length + key : key] === standalone_reader_defaults[(typeof key === "number" && key < 0) ? standalone_reader_defaults.length + key : key]) {
delete curval[key];
}
}
}
if (!is_set || metadata.category !== "read_book" || metadata.disallowed_in_profile || deep_eq(curval, metadata.default)) {
return false;
}
return true;
};
if (!filter_func.__argnames__) Object.defineProperties(filter_func, {
__argnames__ : {value: ["setting_name", "metadata", "is_set", "curval"]},
__module__ : {value: "session"}
});
return get_subset_of_settings(sd, filter_func);
};
if (!settings_for_reader_profile.__argnames__) Object.defineProperties(settings_for_reader_profile, {
__argnames__ : {value: ["sd"]},
__module__ : {value: "session"}
});
function apply_reader_profile(sd, profile) {
function filter_func(setting_name, metadata, is_set, curval) {
return metadata.category === "read_book" && !metadata.disallowed_in_profile;
};
if (!filter_func.__argnames__) Object.defineProperties(filter_func, {
__argnames__ : {value: ["setting_name", "metadata", "is_set", "curval"]},
__module__ : {value: "session"}
});
apply_profile(sd, profile, filter_func);
};
if (!apply_reader_profile.__argnames__) Object.defineProperties(apply_reader_profile, {
__argnames__ : {value: ["sd", "profile"]},
__module__ : {value: "session"}
});
default_interface_data = (function(){
var ρσ_d = Object.create(null);
ρσ_d["username"] = null;
ρσ_d["output_format"] = "EPUB";
ρσ_d["input_formats"] = (function(){
var s = ρσ_set();
s.jsset.add("EPUB");
s.jsset.add("MOBI");
s.jsset.add("AZW3");
return s;
})();
ρσ_d["gui_pubdate_display_format"] = "MMM yyyy";
ρσ_d["gui_timestamp_display_format"] = "dd MMM yyyy";
ρσ_d["gui_last_modified_display_format"] = "dd MMM yyyy";
ρσ_d["use_roman_numerals_for_series_number"] = true;
ρσ_d["default_library_id"] = null;
ρσ_d["default_book_list_mode"] = session_defaults().view_mode;
ρσ_d["library_map"] = null;
ρσ_d["search_the_net_urls"] = [];
ρσ_d["donate_link"] = "https://calibre-ebook.com/donate";
ρσ_d["default_author_link"] = "";
ρσ_d["icon_map"] = Object.create(null);
ρσ_d["icon_path"] = "";
ρσ_d["custom_list_template"] = null;
ρσ_d["num_per_page"] = 50;
ρσ_d["lang_code_for_user_manual"] = "";
return ρσ_d;
}).call(this);
function get_interface_data() {
var ans, k;
if (!get_interface_data.storage) {
get_interface_data.storage = new SessionData("calibre-interface-data-");
}
ans = get_interface_data.storage.get("current");
if (ans) {
ans.is_default = false;
} else {
ans = (function(){
var ρσ_d = Object.create(null);
ρσ_d["is_default"] = true;
return ρσ_d;
}).call(this);
var ρσ_Iter23 = default_interface_data;
ρσ_Iter23 = ((typeof ρσ_Iter23[Symbol.iterator] === "function") ? (ρσ_Iter23 instanceof Map ? ρσ_Iter23.keys() : ρσ_Iter23) : Object.keys(ρσ_Iter23));
for (var ρσ_Index23 of ρσ_Iter23) {
k = ρσ_Index23;
ans[(typeof k === "number" && k < 0) ? ans.length + k : k] = default_interface_data[(typeof k === "number" && k < 0) ? default_interface_data.length + k : k];
}
}
return ans;
};
if (!get_interface_data.__module__) Object.defineProperties(get_interface_data, {
__module__ : {value: "session"}
});
ρσ_modules.session.all_settings = all_settings;
ρσ_modules.session.defaults = defaults;
ρσ_modules.session.x = x;
ρσ_modules.session.standalone_reader_defaults = standalone_reader_defaults;
ρσ_modules.session.default_interface_data = default_interface_data;
ρσ_modules.session.session_defaults = session_defaults;
ρσ_modules.session.storage_available = storage_available;
ρσ_modules.session.FakeStorage = FakeStorage;
ρσ_modules.session.get_session_storage = get_session_storage;
ρσ_modules.session.SessionData = SessionData;
ρσ_modules.session.local_storage = local_storage;
ρσ_modules.session.get_device_uuid = get_device_uuid;
ρσ_modules.session.deep_eq = deep_eq;
ρσ_modules.session.get_subset_of_settings = get_subset_of_settings;
ρσ_modules.session.apply_profile = apply_profile;
ρσ_modules.session.settings_for_reader_profile = settings_for_reader_profile;
ρσ_modules.session.apply_reader_profile = apply_reader_profile;
ρσ_modules.session.get_interface_data = get_interface_data;
})();
(function(){
var __name__ = "dom";
var simple_vendor_prefixes, extra_css, add_extra_css;
simple_vendor_prefixes = (function(){
var ρσ_d = Object.create(null);
ρσ_d["animation"] = [ "webkit", "moz", "o" ];
ρσ_d["animation-name"] = [ "webkit", "moz", "o" ];
ρσ_d["animation-duration"] = [ "webkit", "moz", "o" ];
ρσ_d["animation-timing-function"] = [ "webkit", "moz", "o" ];
ρσ_d["animation-delay"] = [ "webkit", "moz", "o" ];
ρσ_d["animation-iteration-count"] = [ "webkit", "moz", "o" ];
ρσ_d["animation-direction"] = [ "webkit", "moz", "o" ];
ρσ_d["animation-fill-mode"] = [ "webkit", "moz", "o" ];
ρσ_d["animation-play-state"] = [ "webkit", "moz", "o" ];
ρσ_d["hyphens"] = [ "webkit", "moz", "ms" ];
ρσ_d["transform"] = [ "webkit", "ms", "moz", "o" ];
ρσ_d["transform-origin"] = [ "webkit", "ms", "moz", "o" ];
ρσ_d["transition"] = [ "webkit", "moz", "o" ];
ρσ_d["filter"] = [ "webkit" ];
ρσ_d["user-select"] = [ "webkit", "moz", "ms" ];
ρσ_d["break-before"] = [ "webkit-column" ];
ρσ_d["break-after"] = [ "webkit-column" ];
ρσ_d["break-inside"] = [ "webkit-column" ];
ρσ_d["column-gap"] = [ "webkit", "moz" ];
ρσ_d["column-width"] = [ "webkit", "moz" ];
ρσ_d["column-rule"] = [ "webkit", "moz" ];
ρσ_d["column-fill"] = [ "moz" ];
return ρσ_d;
}).call(this);
function set_css() {
var elem = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
var kw = arguments[arguments.length-1];
if (kw === null || typeof kw !== "object" || kw [ρσ_kwargs_symbol] !== true) kw = {};
var s, ρσ_unpack, name, val, prefixes, prefix, prop;
if (typeof elem === "string") {
elem = document.querySelector(elem);
}
s = elem.style;
if (s) {
var ρσ_Iter24 = kw;
ρσ_Iter24 = ((typeof ρσ_Iter24[Symbol.iterator] === "function") ? (ρσ_Iter24 instanceof Map ? ρσ_Iter24.keys() : ρσ_Iter24) : Object.keys(ρσ_Iter24));
for (var ρσ_Index24 of ρσ_Iter24) {
prop = ρσ_Index24;
ρσ_unpack = [str.replace(str.rstrip(prop, "_"), "_", "-"), kw[(typeof prop === "number" && prop < 0) ? kw.length + prop : prop]];
name = ρσ_unpack[0];
val = ρσ_unpack[1];
if (val === null || val === undefined) {
s.removeProperty(name);
} else {
s.setProperty(name, val);
}
prefixes = simple_vendor_prefixes[(typeof name === "number" && name < 0) ? simple_vendor_prefixes.length + name : name];
if (prefixes) {
var ρσ_Iter25 = prefixes;
ρσ_Iter25 = ((typeof ρσ_Iter25[Symbol.iterator] === "function") ? (ρσ_Iter25 instanceof Map ? ρσ_Iter25.keys() : ρσ_Iter25) : Object.keys(ρσ_Iter25));
for (var ρσ_Index25 of ρσ_Iter25) {
prefix = ρσ_Index25;
if (val === null || val === undefined) {
s.removeProperty("-" + prefix + "-" + name);
} else {
s.setProperty("-" + prefix + "-" + name, val);
}
}
}
}
}
return elem;
};
if (!set_css.__handles_kwarg_interpolation__) Object.defineProperties(set_css, {
__handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["elem"]},
__module__ : {value: "dom"}
});
function set_important_css() {
var elem = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
var kw = arguments[arguments.length-1];
if (kw === null || typeof kw !== "object" || kw [ρσ_kwargs_symbol] !== true) kw = {};
var s, ρσ_unpack, name, val, prefixes, prefix, prop;
if (typeof elem === "string") {
elem = document.querySelector(elem);
}
s = elem.style;
if (s) {
var ρσ_Iter26 = kw;
ρσ_Iter26 = ((typeof ρσ_Iter26[Symbol.iterator] === "function") ? (ρσ_Iter26 instanceof Map ? ρσ_Iter26.keys() : ρσ_Iter26) : Object.keys(ρσ_Iter26));
for (var ρσ_Index26 of ρσ_Iter26) {
prop = ρσ_Index26;
ρσ_unpack = [str.replace(str.rstrip(prop, "_"), "_", "-"), kw[(typeof prop === "number" && prop < 0) ? kw.length + prop : prop]];
name = ρσ_unpack[0];
val = ρσ_unpack[1];
if (val === null || val === undefined) {
s.removeProperty(name);
} else {
s.setProperty(name, val, "important");
}
prefixes = simple_vendor_prefixes[(typeof name === "number" && name < 0) ? simple_vendor_prefixes.length + name : name];
if (prefixes) {
var ρσ_Iter27 = prefixes;
ρσ_Iter27 = ((typeof ρσ_Iter27[Symbol.iterator] === "function") ? (ρσ_Iter27 instanceof Map ? ρσ_Iter27.keys() : ρσ_Iter27) : Object.keys(ρσ_Iter27));
for (var ρσ_Index27 of ρσ_Iter27) {
prefix = ρσ_Index27;
if (val === null || val === undefined) {
s.removeProperty("-" + prefix + "-" + name);
} else {
s.setProperty("-" + prefix + "-" + name, val, "important");
}
}
}
}
}
return elem;
};
if (!set_important_css.__handles_kwarg_interpolation__) Object.defineProperties(set_important_css, {
__handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["elem"]},
__module__ : {value: "dom"}
});
function build_rule() {
var selector = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
var kw = arguments[arguments.length-1];
if (kw === null || typeof kw !== "object" || kw [ρσ_kwargs_symbol] !== true) kw = {};
var ans, ρσ_unpack, name, val, prefixes, prefix, prop;
ans = [ selector + " { " ];
var ρσ_Iter28 = kw;
ρσ_Iter28 = ((typeof ρσ_Iter28[Symbol.iterator] === "function") ? (ρσ_Iter28 instanceof Map ? ρσ_Iter28.keys() : ρσ_Iter28) : Object.keys(ρσ_Iter28));
for (var ρσ_Index28 of ρσ_Iter28) {
prop = ρσ_Index28;
ρσ_unpack = [str.replace(str.rstrip(prop, "_"), "_", "-"), kw[(typeof prop === "number" && prop < 0) ? kw.length + prop : prop]];
name = ρσ_unpack[0];
val = ρσ_unpack[1];
ans.push(name + ":" + val + ";");
prefixes = simple_vendor_prefixes[(typeof name === "number" && name < 0) ? simple_vendor_prefixes.length + name : name];
if (prefixes) {
var ρσ_Iter29 = prefixes;
ρσ_Iter29 = ((typeof ρσ_Iter29[Symbol.iterator] === "function") ? (ρσ_Iter29 instanceof Map ? ρσ_Iter29.keys() : ρσ_Iter29) : Object.keys(ρσ_Iter29));
for (var ρσ_Index29 of ρσ_Iter29) {
prefix = ρσ_Index29;
ans.push("-" + prefix + "-" + name + ":" + val + ";");
}
}
}
ans.push("}");
return ans.join("\n") + "\n";
};
if (!build_rule.__handles_kwarg_interpolation__) Object.defineProperties(build_rule, {
__handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["selector"]},
__module__ : {value: "dom"}
});
function clear() {
var node;
for (var i = 0; i < arguments.length; i++) {
node = arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i];
while (node.firstChild) {
node.removeChild(node.firstChild);
}
}
};
if (!clear.__module__) Object.defineProperties(clear, {
__module__ : {value: "dom"}
});
function remove_all_attributes() {
var node;
for (var i = 0; i < arguments.length; i++) {
node = arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i];
while (node.attributes.length > 0) {
node.removeAttributeNode(node.attributes[0]);
}
}
};
if (!remove_all_attributes.__module__) Object.defineProperties(remove_all_attributes, {
__module__ : {value: "dom"}
});
function create_keyframes() {
var animation_name = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
var frames = Array.prototype.slice.call(arguments, 1);
if (arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) frames.pop();
var ans, frame, prefix;
ans = [];
var ρσ_Iter30 = [ "-webkit-", "-moz-", "-o-", "" ];
ρσ_Iter30 = ((typeof ρσ_Iter30[Symbol.iterator] === "function") ? (ρσ_Iter30 instanceof Map ? ρσ_Iter30.keys() : ρσ_Iter30) : Object.keys(ρσ_Iter30));
for (var ρσ_Index30 of ρσ_Iter30) {
prefix = ρσ_Index30;
ans.push("@" + prefix + "keyframes " + animation_name + " {");
var ρσ_Iter31 = frames;
ρσ_Iter31 = ((typeof ρσ_Iter31[Symbol.iterator] === "function") ? (ρσ_Iter31 instanceof Map ? ρσ_Iter31.keys() : ρσ_Iter31) : Object.keys(ρσ_Iter31));
for (var ρσ_Index31 of ρσ_Iter31) {
frame = ρσ_Index31;
ans.push(frame);
}
ans.push("}");
}
return ans.join("\n") + "\n";
};
if (!create_keyframes.__handles_kwarg_interpolation__) Object.defineProperties(create_keyframes, {
__handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["animation_name"]},
__module__ : {value: "dom"}
});
function change_icon_image(icon_element, new_name, tooltip) {
var x, tt;
if (new_name) {
icon_element.firstChild.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", "#icon-" + new_name);
} else {
icon_element.firstChild.removeAttributeNS("http://www.w3.org/1999/xlink", "xlink:href");
}
if ((typeof tooltip !== "undefined" && tooltip !== null)) {
x = icon_element.getElementsByTagNameNS("http://www.w3.org/2000/svg", "title");
if (!x.length) {
tt = document.createElementNS("http://www.w3.org/2000/svg", "title");
icon_element.appendChild(tt);
x = [ tt ];
}
x[0].textContent = tooltip;
}
};
if (!change_icon_image.__argnames__) Object.defineProperties(change_icon_image, {
__argnames__ : {value: ["icon_element", "new_name", "tooltip"]},
__module__ : {value: "dom"}
});
function svgicon(name, height, width, tooltip) {
var ans, u, tt;
ans = document.createElementNS("http://www.w3.org/2000/svg", "svg");
ans.setAttribute("style", "fill: currentColor; height: {}; width: {}; vertical-align: text-top".format((typeof height !== "undefined" && height !== null ? height : "2ex"), (typeof width !== "undefined" && width !== null ? width : "2ex")));
u = document.createElementNS("http://www.w3.org/2000/svg", "use");
ans.appendChild(u);
if (name) {
ans.firstChild.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", "#icon-" + name);
}
if (tooltip) {
tt = document.createElementNS("http://www.w3.org/2000/svg", "title");
tt.textContent = tooltip;
ans.appendChild(tt);
}
return ans;
};
if (!svgicon.__argnames__) Object.defineProperties(svgicon, {
__argnames__ : {value: ["name", "height", "width", "tooltip"]},
__module__ : {value: "dom"}
});
function element(elem_id, child_selector) {
var ans;
ans = (elem_id) ? document.getElementById(elem_id) : document.body;
if (child_selector) {
ans = ans.querySelector(child_selector);
}
return ans;
};
if (!element.__argnames__) Object.defineProperties(element, {
__argnames__ : {value: ["elem_id", "child_selector"]},
__module__ : {value: "dom"}
});
function selector() {
var id_selector = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
var args = Array.prototype.slice.call(arguments, 1);
if (arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) args.pop();
var ans, x;
ans = "#" + id_selector;
var ρσ_Iter32 = args;
ρσ_Iter32 = ((typeof ρσ_Iter32[Symbol.iterator] === "function") ? (ρσ_Iter32 instanceof Map ? ρσ_Iter32.keys() : ρσ_Iter32) : Object.keys(ρσ_Iter32));
for (var ρσ_Index32 of ρσ_Iter32) {
x = ρσ_Index32;
ans += " " + x;
}
return ans;
};
if (!selector.__handles_kwarg_interpolation__) Object.defineProperties(selector, {
__handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["id_selector"]},
__module__ : {value: "dom"}
});
function rule() {
var id_selector = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
var kw = arguments[arguments.length-1];
if (kw === null || typeof kw !== "object" || kw [ρσ_kwargs_symbol] !== true) kw = {};
var args = Array.prototype.slice.call(arguments, 1);
if (kw !== null && typeof kw === "object" && kw [ρσ_kwargs_symbol] === true) args.pop();
return ρσ_interpolate_kwargs.call(this, build_rule, [selector.apply(this, [id_selector].concat(args))].concat([ρσ_desugar_kwargs(kw)]));
};
if (!rule.__handles_kwarg_interpolation__) Object.defineProperties(rule, {
__handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["id_selector"]},
__module__ : {value: "dom"}
});
function unique_id(prefix) {
var num;
prefix = prefix || "auto-id";
(ρσ_expr_temp = unique_id.counts)[(typeof prefix === "number" && prefix < 0) ? ρσ_expr_temp.length + prefix : prefix] = num = ((ρσ_expr_temp = unique_id.counts)[(typeof prefix === "number" && prefix < 0) ? ρσ_expr_temp.length + prefix : prefix] || 0) + 1;
return prefix + "-" + num;
};
if (!unique_id.__argnames__) Object.defineProperties(unique_id, {
__argnames__ : {value: ["prefix"]},
__module__ : {value: "dom"}
});
unique_id.counts = Object.create(null);
function ensure_id(w, prefix) {
var ans;
ans = w.getAttribute("id");
if (!ans) {
ans = unique_id(prefix);
w.setAttribute("id", ans);
}
return ans;
};
if (!ensure_id.__argnames__) Object.defineProperties(ensure_id, {
__argnames__ : {value: ["w", "prefix"]},
__module__ : {value: "dom"}
});
extra_css = [];
add_extra_css = extra_css.push.bind(extra_css);
function get_widget_css() {
var ans, func;
ans = [];
var ρσ_Iter33 = extra_css;
ρσ_Iter33 = ((typeof ρσ_Iter33[Symbol.iterator] === "function") ? (ρσ_Iter33 instanceof Map ? ρσ_Iter33.keys() : ρσ_Iter33) : Object.keys(ρσ_Iter33));
for (var ρσ_Index33 of ρσ_Iter33) {
func = ρσ_Index33;
ans.push(func());
}
return ans.join("\n");
};
if (!get_widget_css.__module__) Object.defineProperties(get_widget_css, {
__module__ : {value: "dom"}
});
function set_radio_group_value(parent, name, val) {
var changed, inp;
changed = false;
var ρσ_Iter34 = parent.querySelectorAll("input[name=" + ρσ_str.format("{}", name) + "]");
ρσ_Iter34 = ((typeof ρσ_Iter34[Symbol.iterator] === "function") ? (ρσ_Iter34 instanceof Map ? ρσ_Iter34.keys() : ρσ_Iter34) : Object.keys(ρσ_Iter34));
for (var ρσ_Index34 of ρσ_Iter34) {
inp = ρσ_Index34;
inp.checked = inp.value === val;
changed = true;
}
if (!changed) {
throw new KeyError("No radio group with name=" + ρσ_str.format("{}", name) + " found");
}
};
if (!set_radio_group_value.__argnames__) Object.defineProperties(set_radio_group_value, {
__argnames__ : {value: ["parent", "name", "val"]},
__module__ : {value: "dom"}
});
ρσ_modules.dom.simple_vendor_prefixes = simple_vendor_prefixes;
ρσ_modules.dom.extra_css = extra_css;
ρσ_modules.dom.add_extra_css = add_extra_css;
ρσ_modules.dom.set_css = set_css;
ρσ_modules.dom.set_important_css = set_important_css;
ρσ_modules.dom.build_rule = build_rule;
ρσ_modules.dom.clear = clear;
ρσ_modules.dom.remove_all_attributes = remove_all_attributes;
ρσ_modules.dom.create_keyframes = create_keyframes;
ρσ_modules.dom.change_icon_image = change_icon_image;
ρσ_modules.dom.svgicon = svgicon;
ρσ_modules.dom.element = element;
ρσ_modules.dom.selector = selector;
ρσ_modules.dom.rule = rule;
ρσ_modules.dom.unique_id = unique_id;
ρσ_modules.dom.ensure_id = ensure_id;
ρσ_modules.dom.get_widget_css = get_widget_css;
ρσ_modules.dom.set_radio_group_value = set_radio_group_value;
})();
(function(){
var __name__ = "book_list.theme";
var DARK, LIGHT, LIGHT_DARKER, DT_DARK, DT_DARK_DARKER, DT_DARK_LIGHTER, DT_DARK_LIGTHER_CONTRAST, DT_LIGHT, DEFAULT_COLORS, DEFAULT_SIZES, DEFAULT_FONTS;
var get_session_data = ρσ_modules["book_list.globals"].get_session_data;
var all_settings = ρσ_modules.session.all_settings;
DARK = "#39322B";
LIGHT = "#F6F3E9";
LIGHT_DARKER = "#b6b3a8";
DT_DARK = "#2d2d2d";
DT_DARK_DARKER = "black";
DT_DARK_LIGHTER = "#777";
DT_DARK_LIGTHER_CONTRAST = "#1d1d1d";
DT_LIGHT = "#ddd";
function c(light, dark) {
return (function(){
var ρσ_d = Object.create(null);
ρσ_d["light"] = light;
ρσ_d["dark"] = dark || light;
return ρσ_d;
}).call(this);
};
if (!c.__argnames__) Object.defineProperties(c, {
__argnames__ : {value: ["light", "dark"]},
__module__ : {value: "book_list.theme"}
});
function _byte(n) {
if (n < 0) {
return 0;
}
if (n > 255) {
return 255;
}
return int(n);
};
if (!_byte.__argnames__) Object.defineProperties(_byte, {
__argnames__ : {value: ["n"]},
__module__ : {value: "book_list.theme"}
});
function parse_hex_color(s) {
var v;
if (!s) {
return null;
}
v = (s + "").strip();
if (v.startsWith("#")) {
v = v.slice(1);
}
if (v.length === 3) {
v = v[0] + v[0] + v[1] + v[1] + v[2] + v[2];
}
if (v.length !== 6) {
return null;
}
try {
return [ int(v.slice(0, 2), 16), int(v.slice(2, 4), 16), int(v.slice(4, 6), 16) ];
} catch (ρσ_Exception) {
ρσ_last_exception = ρσ_Exception;
if (ρσ_Exception instanceof Error) {
return null;
} else {
throw ρσ_Exception;
}
}
};
if (!parse_hex_color.__argnames__) Object.defineProperties(parse_hex_color, {
__argnames__ : {value: ["s"]},
__module__ : {value: "book_list.theme"}
});
function hex_as_rgba() {
var s = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
var opacity = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? hex_as_rgba.__defaults__.opacity : arguments[1];
var ρσ_kwargs_obj = arguments[arguments.length-1];
if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "opacity")){
opacity = ρσ_kwargs_obj.opacity;
}
var v;
v = parse_hex_color(s);
return "rgba(" + ρσ_str.format("{}", v[0]) + "," + ρσ_str.format("{}", v[1]) + "," + ρσ_str.format("{}", v[2]) + "," + ρσ_str.format("{}", opacity) + ")";
};
if (!hex_as_rgba.__defaults__) Object.defineProperties(hex_as_rgba, {
__defaults__ : {value: {opacity:"1"}},
__handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["s", "opacity"]},
__module__ : {value: "book_list.theme"}
});
function mix_rgb_channel(a, b, t) {
return _byte(Math.round(a * (1 - t) + b * t));
};
if (!mix_rgb_channel.__argnames__) Object.defineProperties(mix_rgb_channel, {
__argnames__ : {value: ["a", "b", "t"]},
__module__ : {value: "book_list.theme"}
});
function mix_rgb(a, b, t) {
var r0, r1, r2;
r0 = mix_rgb_channel(a[0], b[0], t);
r1 = mix_rgb_channel(a[1], b[1], t);
r2 = mix_rgb_channel(a[2], b[2], t);
return [ r0, r1, r2 ];
};
if (!mix_rgb.__argnames__) Object.defineProperties(mix_rgb, {
__argnames__ : {value: ["a", "b", "t"]},
__module__ : {value: "book_list.theme"}
});
function rgb_to_hex(rgb) {
var r, g, b;
r = rgb[0];
g = rgb[1];
b = rgb[2];
function h(n) {
var s;
s = n.toString(16);
if (s.length < 2) {
s = "0" + s;
}
return s;
};
if (!h.__argnames__) Object.defineProperties(h, {
__argnames__ : {value: ["n"]},
__module__ : {value: "book_list.theme"}
});
return "#" + h(r) + h(g) + h(b);
};
if (!rgb_to_hex.__argnames__) Object.defineProperties(rgb_to_hex, {
__argnames__ : {value: ["rgb"]},
__module__ : {value: "book_list.theme"}
});
function light_mode_primary_tints(primary_rgb) {
var W, wb, wb2, tree, dlg, lh_bg, inp, bar_bg, btn_base, btn_base2, btn_s, btn_e;
W = [ 255, 255, 255 ];
wb = rgb_to_hex(mix_rgb(W, primary_rgb, .055));
wb2 = rgb_to_hex(mix_rgb(W, primary_rgb, .115));
tree = rgb_to_hex(mix_rgb(W, primary_rgb, .095));
dlg = wb;
lh_bg = rgb_to_hex(mix_rgb(W, primary_rgb, .168));
inp = rgb_to_hex(mix_rgb(W, primary_rgb, .068));
bar_bg = rgb_to_hex(mix_rgb(W, primary_rgb, .052));
btn_base = [ 36, 38, 40 ];
btn_base2 = [ 52, 54, 58 ];
btn_s = rgb_to_hex(mix_rgb(btn_base, primary_rgb, .4));
btn_e = rgb_to_hex(mix_rgb(btn_base2, primary_rgb, .36));
return (function(){
var ρσ_d = Object.create(null);
ρσ_d["--calibre-color-window-background"] = wb;
ρσ_d["--calibre-color-window-background2"] = wb2;
ρσ_d["--calibre-color-tree-highlight-item"] = tree;
ρσ_d["--calibre-color-dialog-background"] = dlg;
ρσ_d["--calibre-color-list-hover-background"] = lh_bg;
ρσ_d["--calibre-color-list-hover-foreground"] = DARK;
ρσ_d["--calibre-color-input-background"] = inp;
ρσ_d["--calibre-color-bar-background"] = bar_bg;
ρσ_d["--calibre-color-bar-foreground"] = DARK;
ρσ_d["--calibre-color-button-start"] = btn_s;
ρσ_d["--calibre-color-button-end"] = btn_e;
return ρσ_d;
}).call(this);
};
if (!light_mode_primary_tints.__argnames__) Object.defineProperties(light_mode_primary_tints, {
__argnames__ : {value: ["primary_rgb"]},
__module__ : {value: "book_list.theme"}
});
function apply_theme_variables(variables) {
var s, k;
s = document.documentElement.style;
var ρσ_Iter35 = Object.keys(variables);
ρσ_Iter35 = ((typeof ρσ_Iter35[Symbol.iterator] === "function") ? (ρσ_Iter35 instanceof Map ? ρσ_Iter35.keys() : ρσ_Iter35) : Object.keys(ρσ_Iter35));
for (var ρσ_Index35 of ρσ_Iter35) {
k = ρσ_Index35;
s.setProperty(k, variables[(typeof k === "number" && k < 0) ? variables.length + k : k]);
}
get_color_as_rgba.cache = Object.create(null);
cached_color_to_rgba.cache = Object.create(null);
};
if (!apply_theme_variables.__argnames__) Object.defineProperties(apply_theme_variables, {
__argnames__ : {value: ["variables"]},
__module__ : {value: "book_list.theme"}
});
DEFAULT_COLORS = (function(){
var ρσ_d = Object.create(null);
ρσ_d["window-background"] = c(LIGHT, DT_DARK);
ρσ_d["window-background2"] = c(LIGHT_DARKER, DT_DARK_LIGHTER);
ρσ_d["window-foreground"] = c(DARK, DT_LIGHT);
ρσ_d["window-error-foreground"] = c("red", "#C40233");
ρσ_d["window-hover-foreground"] = c("red", "#C40233");
ρσ_d["link-foreground"] = c("blue", "#6cb4ee");
ρσ_d["faded-text"] = c("#666", "#7f7f7f");
ρσ_d["border"] = c("rgba(0,0,0,0.12)", "rgba(255,255,255,0.12)");
ρσ_d["border-subtle"] = c("rgba(0,0,0,0.08)", "rgba(255,255,255,0.08)");
ρσ_d["scrollbar-thumb"] = c("rgba(0,0,0,0.26)", "rgba(255,255,255,0.34)");
ρσ_d["scrollbar-thumb-hover"] = c("rgba(0,0,0,0.38)", "rgba(255,255,255,0.48)");
ρσ_d["surface-1"] = c(hex_as_rgba(LIGHT, "0.08"), hex_as_rgba(DT_DARK, "0.08"));
ρσ_d["surface-2"] = c(hex_as_rgba(LIGHT, "0.04"), hex_as_rgba(DT_DARK, "0.04"));
ρσ_d["surface-3"] = c(hex_as_rgba(LIGHT, "0.02"), hex_as_rgba(DT_DARK, "0.02"));
ρσ_d["bar-background"] = c(DARK, DT_DARK_LIGHTER);
ρσ_d["bar-foreground"] = c(LIGHT, DT_DARK_LIGTHER_CONTRAST);
ρσ_d["bar-highlight"] = c("yellow");
ρσ_d["heart"] = c("#B92111");
ρσ_d["list-hover-background"] = c(DARK, DT_DARK_LIGHTER);
ρσ_d["list-hover-foreground"] = c(LIGHT, DT_DARK_LIGTHER_CONTRAST);
ρσ_d["tree-highlight-item"] = c(LIGHT_DARKER, DT_DARK_LIGHTER);
ρσ_d["button-start"] = c(DARK, DT_LIGHT);
ρσ_d["button-end"] = c("#49423B", "#666");
ρσ_d["button-text"] = c(LIGHT, DT_DARK);
ρσ_d["dialog-background"] = c(LIGHT, DT_DARK);
ρσ_d["dialog-background-image"] = c("none", "none");
ρσ_d["dialog-foreground"] = c(DARK, DT_LIGHT);
ρσ_d["input-background"] = c("field", DT_DARK_DARKER);
ρσ_d["input-foreground"] = c("fieldtext", DT_LIGHT);
ρσ_d["input-focus-outline-color"] = c("#4D90FE", DT_LIGHT);
return ρσ_d;
}).call(this);
DEFAULT_SIZES = (function(){
var ρσ_d = Object.create(null);
ρσ_d["title"] = "1.4rem";
ρσ_d["item-list-title"] = "1.1rem";
ρσ_d["item-list-subtitle"] = "0.8rem";
return ρσ_d;
}).call(this);
DEFAULT_FONTS = (function(){
var ρσ_d = Object.create(null);
ρσ_d["main"] = "sans-serif";
return ρσ_d;
}).call(this);
function theme_variables(is_dark_theme, primary_color) {
var attr, default_colors, rgb, ρσ_unpack, r, g, b, ans, k, tints;
attr = (is_dark_theme) ? "dark" : "light";
default_colors = all_settings.ui_highlight_colors.default;
if (!primary_color) {
primary_color = (is_dark_theme) ? default_colors.dark : default_colors.light;
}
if (!primary_color.startswith("#")) {
primary_color = "#" + primary_color;
}
rgb = parse_hex_color(primary_color);
if (!rgb) {
primary_color = (is_dark_theme) ? default_colors.dark : default_colors.light;
rgb = parse_hex_color(primary_color);
}
ρσ_unpack = rgb;
ρσ_unpack = ρσ_unpack_asarray(3, ρσ_unpack);
r = ρσ_unpack[0];
g = ρσ_unpack[1];
b = ρσ_unpack[2];
ans = (function(){
var ρσ_d = Object.create(null);
ρσ_d["--calibre-color-primary"] = primary_color;
ρσ_d["--calibre-color-primary-light"] = "rgba(" + ρσ_str.format("{}", r) + "," + ρσ_str.format("{}", g) + "," + ρσ_str.format("{}", b) + ",0.18)";
ρσ_d["--calibre-color-primary-light-2"] = "rgba(" + ρσ_str.format("{}", r) + "," + ρσ_str.format("{}", g) + "," + ρσ_str.format("{}", b) + ",0.28)";
return ρσ_d;
}).call(this);
var ρσ_Iter36 = DEFAULT_COLORS;
ρσ_Iter36 = ((typeof ρσ_Iter36[Symbol.iterator] === "function") ? (ρσ_Iter36 instanceof Map ? ρσ_Iter36.keys() : ρσ_Iter36) : Object.keys(ρσ_Iter36));
for (var ρσ_Index36 of ρσ_Iter36) {
k = ρσ_Index36;
ans[ρσ_bound_index("--calibre-color-" + k, ans)] = (ρσ_expr_temp = DEFAULT_COLORS[(typeof k === "number" && k < 0) ? DEFAULT_COLORS.length + k : k])[(typeof attr === "number" && attr < 0) ? ρσ_expr_temp.length + attr : attr];
}
if (!is_dark_theme) {
tints = light_mode_primary_tints(rgb);
var ρσ_Iter37 = Object.keys(tints);
ρσ_Iter37 = ((typeof ρσ_Iter37[Symbol.iterator] === "function") ? (ρσ_Iter37 instanceof Map ? ρσ_Iter37.keys() : ρσ_Iter37) : Object.keys(ρσ_Iter37));
for (var ρσ_Index37 of ρσ_Iter37) {
k = ρσ_Index37;
ans[(typeof k === "number" && k < 0) ? ans.length + k : k] = tints[(typeof k === "number" && k < 0) ? tints.length + k : k];
}
}
return ans;
};
if (!theme_variables.__argnames__) Object.defineProperties(theme_variables, {
__argnames__ : {value: ["is_dark_theme", "primary_color"]},
__module__ : {value: "book_list.theme"}
});
function set_ui_colors(is_dark_theme, primary_color) {
apply_theme_variables(theme_variables(is_dark_theme, primary_color));
document.documentElement.style.colorScheme = (is_dark_theme) ? "dark" : "light";
};
if (!set_ui_colors.__argnames__) Object.defineProperties(set_ui_colors, {
__argnames__ : {value: ["is_dark_theme", "primary_color"]},
__module__ : {value: "book_list.theme"}
});
function browser_in_dark_mode() {
return window.matchMedia("(prefers-color-scheme: dark)").matches;
};
if (!browser_in_dark_mode.__module__) Object.defineProperties(browser_in_dark_mode, {
__module__ : {value: "book_list.theme"}
});
function effective_book_list_is_dark() {
var sd, pref;
try {
sd = get_session_data();
if (!sd) {
return browser_in_dark_mode();
}
pref = (sd.get("book_list_color_scheme", "auto") || "auto") + "";
} catch (ρσ_Exception) {
ρσ_last_exception = ρσ_Exception;
if (ρσ_Exception instanceof Error) {
return browser_in_dark_mode();
} else {
throw ρσ_Exception;
}
}
if (pref === "dark") {
return true;
}
if (pref === "light") {
return false;
}
return browser_in_dark_mode();
};
if (!effective_book_list_is_dark.__module__) Object.defineProperties(effective_book_list_is_dark, {
__module__ : {value: "book_list.theme"}
});
function get_saved_color_settings() {
var is_dark, sd, colors, primary_color, default_colors;
is_dark = effective_book_list_is_dark();
try {
sd = get_session_data();
} catch (ρσ_Exception) {
ρσ_last_exception = ρσ_Exception;
if (ρσ_Exception instanceof Error) {
sd = null;
} else {
throw ρσ_Exception;
}
}
colors = (sd) ? sd.get("ui_highlight_colors") : all_settings.ui_highlight_colors.default;
primary_color = (is_dark) ? (typeof colors !== "undefined" && colors !== null ? colors : Object.create(null)).dark : (typeof colors !== "undefined" && colors !== null ? colors : Object.create(null)).light;
if (!primary_color) {
default_colors = all_settings.ui_highlight_colors.default;
primary_color = (is_dark) ? default_colors.dark : default_colors.light;
}
return (function(){
var ρσ_d = Object.create(null);
ρσ_d["primary_color"] = primary_color;
ρσ_d["is_dark"] = is_dark;
return ρσ_d;
}).call(this);
};
if (!get_saved_color_settings.__module__) Object.defineProperties(get_saved_color_settings, {
__module__ : {value: "book_list.theme"}
});
function color_scheme() {
return (effective_book_list_is_dark()) ? "dark" : "light";
};
if (!color_scheme.__module__) Object.defineProperties(color_scheme, {
__module__ : {value: "book_list.theme"}
});
function css_for_variables() {
var s, attr, ans, variables, k;
s = get_saved_color_settings();
attr = (s.is_dark) ? "dark" : "light";
ans = [];
variables = theme_variables(s.is_dark, s.primary_color);
var ρσ_Iter38 = Object.keys(variables);
ρσ_Iter38 = ((typeof ρσ_Iter38[Symbol.iterator] === "function") ? (ρσ_Iter38 instanceof Map ? ρσ_Iter38.keys() : ρσ_Iter38) : Object.keys(ρσ_Iter38));
for (var ρσ_Index38 of ρσ_Iter38) {
k = ρσ_Index38;
ans.push("" + ρσ_str.format("{}", k) + ": " + ρσ_str.format("{}", variables[(typeof k === "number" && k < 0) ? variables.length + k : k]) + ";");
}
return ":root { color-scheme: " + ρσ_str.format("{}", attr) + "; " + ans.join("\n") + "}\n\n";
};
if (!css_for_variables.__module__) Object.defineProperties(css_for_variables, {
__module__ : {value: "book_list.theme"}
});
function get_color(name) {
return "var(--calibre-color-" + ρσ_str.format("{}", name) + ")";
};
if (!get_color.__argnames__) Object.defineProperties(get_color, {
__argnames__ : {value: ["name"]},
__module__ : {value: "book_list.theme"}
});
function color_to_rgba(color) {
var cvs, ctx;
cvs = document.createElement("canvas");
cvs.height = 1;
cvs.width = 1;
if (color.startsWith("var(")) {
color = window.getComputedStyle(document.documentElement).getPropertyValue(color.slice(4, -1));
}
ctx = cvs.getContext("2d");
ctx.fillStyle = color;
ctx.fillRect(0, 0, 1, 1);
return ctx.getImageData(0, 0, 1, 1).data;
};
if (!color_to_rgba.__argnames__) Object.defineProperties(color_to_rgba, {
__argnames__ : {value: ["color"]},
__module__ : {value: "book_list.theme"}
});
function cached_color_to_rgba(color) {
var cache;
cache = cached_color_to_rgba.cache;
if (!cache[(typeof color === "number" && color < 0) ? cache.length + color : color]) {
cache[(typeof color === "number" && color < 0) ? cache.length + color : color] = color_to_rgba(color);
}
return cache[(typeof color === "number" && color < 0) ? cache.length + color : color];
};
if (!cached_color_to_rgba.__argnames__) Object.defineProperties(cached_color_to_rgba, {
__argnames__ : {value: ["color"]},
__module__ : {value: "book_list.theme"}
});
cached_color_to_rgba.cache = Object.create(null);
function get_color_as_rgba(name) {
var cache;
cache = get_color_as_rgba.cache;
if (!cache[(typeof name === "number" && name < 0) ? cache.length + name : name]) {
cache[(typeof name === "number" && name < 0) ? cache.length + name : name] = color_to_rgba(get_color(name));
}
return cache[(typeof name === "number" && name < 0) ? cache.length + name : name];
};
if (!get_color_as_rgba.__argnames__) Object.defineProperties(get_color_as_rgba, {
__argnames__ : {value: ["name"]},
__module__ : {value: "book_list.theme"}
});
get_color_as_rgba.cache = Object.create(null);
function get_font_size(name) {
return DEFAULT_SIZES[(typeof name === "number" && name < 0) ? DEFAULT_SIZES.length + name : name];
};
if (!get_font_size.__argnames__) Object.defineProperties(get_font_size, {
__argnames__ : {value: ["name"]},
__module__ : {value: "book_list.theme"}
});
function get_font_family(name) {
name = name || "main";
return DEFAULT_FONTS[(typeof name === "number" && name < 0) ? DEFAULT_FONTS.length + name : name];
};
if (!get_font_family.__argnames__) Object.defineProperties(get_font_family, {
__argnames__ : {value: ["name"]},
__module__ : {value: "book_list.theme"}
});
ρσ_modules["book_list.theme"].DARK = DARK;
ρσ_modules["book_list.theme"].LIGHT = LIGHT;
ρσ_modules["book_list.theme"].LIGHT_DARKER = LIGHT_DARKER;
ρσ_modules["book_list.theme"].DT_DARK = DT_DARK;
ρσ_modules["book_list.theme"].DT_DARK_DARKER = DT_DARK_DARKER;
ρσ_modules["book_list.theme"].DT_DARK_LIGHTER = DT_DARK_LIGHTER;
ρσ_modules["book_list.theme"].DT_DARK_LIGTHER_CONTRAST = DT_DARK_LIGTHER_CONTRAST;
ρσ_modules["book_list.theme"].DT_LIGHT = DT_LIGHT;
ρσ_modules["book_list.theme"].DEFAULT_COLORS = DEFAULT_COLORS;
ρσ_modules["book_list.theme"].DEFAULT_SIZES = DEFAULT_SIZES;
ρσ_modules["book_list.theme"].DEFAULT_FONTS = DEFAULT_FONTS;
ρσ_modules["book_list.theme"].c = c;
ρσ_modules["book_list.theme"]._byte = _byte;
ρσ_modules["book_list.theme"].parse_hex_color = parse_hex_color;
ρσ_modules["book_list.theme"].hex_as_rgba = hex_as_rgba;
ρσ_modules["book_list.theme"].mix_rgb_channel = mix_rgb_channel;
ρσ_modules["book_list.theme"].mix_rgb = mix_rgb;
ρσ_modules["book_list.theme"].rgb_to_hex = rgb_to_hex;
ρσ_modules["book_list.theme"].light_mode_primary_tints = light_mode_primary_tints;
ρσ_modules["book_list.theme"].apply_theme_variables = apply_theme_variables;
ρσ_modules["book_list.theme"].theme_variables = theme_variables;
ρσ_modules["book_list.theme"].set_ui_colors = set_ui_colors;
ρσ_modules["book_list.theme"].browser_in_dark_mode = browser_in_dark_mode;
ρσ_modules["book_list.theme"].effective_book_list_is_dark = effective_book_list_is_dark;
ρσ_modules["book_list.theme"].get_saved_color_settings = get_saved_color_settings;
ρσ_modules["book_list.theme"].color_scheme = color_scheme;
ρσ_modules["book_list.theme"].css_for_variables = css_for_variables;
ρσ_modules["book_list.theme"].get_color = get_color;
ρσ_modules["book_list.theme"].color_to_rgba = color_to_rgba;
ρσ_modules["book_list.theme"].cached_color_to_rgba = cached_color_to_rgba;
ρσ_modules["book_list.theme"].get_color_as_rgba = get_color_as_rgba;
ρσ_modules["book_list.theme"].get_font_size = get_font_size;
ρσ_modules["book_list.theme"].get_font_family = get_font_family;
})();
(function(){
var __name__ = "utils";
var is_ios, ios_major_version, v, copy_hash, _roman, _data_ns;
var hexlify = ρσ_modules.encodings.hexlify;
var encode_query = ρσ_modules.ajax.encode_query;
var get_font_family = ρσ_modules["book_list.theme"].get_font_family;
is_ios = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
ios_major_version = 0;
if (!is_ios && !!navigator.platform && (typeof window !== "undefined" && window !== null) && window.navigator.platform === "MacIntel" && window.navigator.maxTouchPoints > 1) {
is_ios = true;
}
if (is_ios) {
v = navigator.appVersion.match(/OS (\d+)/);
if (v && v[1]) {
ios_major_version = parseInt(v[1], 10) || 0;
}
}
function default_context_menu_should_be_allowed(evt) {
if (evt.target && evt.target.tagName && ρσ_in(evt.target.tagName.toLowerCase(), ["input",
"textarea"])) {
return true;
}
return false;
};
if (!default_context_menu_should_be_allowed.__argnames__) Object.defineProperties(default_context_menu_should_be_allowed, {
__argnames__ : {value: ["evt"]},
__module__ : {value: "utils"}
});
function debounce() {
var func = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
var wait = ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[1];
var immediate = (arguments[2] === undefined || ( 2 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? debounce.__defaults__.immediate : arguments[2];
var ρσ_kwargs_obj = arguments[arguments.length-1];
if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "immediate")){
immediate = ρσ_kwargs_obj.immediate;
}
var timeout;
timeout = null;
return (function() {
var ρσ_anonfunc = function debounce_inner() {
var ρσ_unpack, context, args, call_now;
ρσ_unpack = [this, arguments];
context = ρσ_unpack[0];
args = ρσ_unpack[1];
function later() {
timeout = null;
if (!immediate) {
func.apply(context, args);
}
};
if (!later.__module__) Object.defineProperties(later, {
__module__ : {value: "utils"}
});
call_now = immediate && !timeout;
window.clearTimeout(timeout);
timeout = window.setTimeout(later, wait);
if (call_now) {
func.apply(context, args);
}
};
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
__module__ : {value: "utils"}
});
return ρσ_anonfunc;
})();
};
if (!debounce.__defaults__) Object.defineProperties(debounce, {
__defaults__ : {value: {immediate:false}},
__handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["func", "wait", "immediate"]},
__module__ : {value: "utils"}
});
if (Object.assign) {
copy_hash = (function() {
var ρσ_anonfunc = function (obj) {
return Object.assign(Object.create(null), obj);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["obj"]},
__module__ : {value: "utils"}
});
return ρσ_anonfunc;
})();
} else {
copy_hash = (function() {
var ρσ_anonfunc = function (obj) {
return (function() {
var ρσ_Iter = Object.keys(obj), ρσ_Result = Object.create(null), k;
ρσ_Iter = ((typeof ρσ_Iter[Symbol.iterator] === "function") ? (ρσ_Iter instanceof Map ? ρσ_Iter.keys() : ρσ_Iter) : Object.keys(ρσ_Iter));
for (var ρσ_Index of ρσ_Iter) {
k = ρσ_Index;
ρσ_Result[k] = (obj[(typeof k === "number" && k < 0) ? obj.length + k : k]);
}
return ρσ_Result;
})();
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["obj"]},
__module__ : {value: "utils"}
});
return ρσ_anonfunc;
})();
}
function parse_url_params() {
var url = (arguments[0] === undefined || ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? parse_url_params.__defaults__.url : arguments[0];
var allow_multiple = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? parse_url_params.__defaults__.allow_multiple : arguments[1];
var ρσ_kwargs_obj = arguments[arguments.length-1];
if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "url")){
url = ρσ_kwargs_obj.url;
}
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "allow_multiple")){
allow_multiple = ρσ_kwargs_obj.allow_multiple;
}
var cache, qs, ans, q, pairs, ρσ_unpack, key, val, pair;
cache = parse_url_params.cache;
url = url || window.location.href;
if (cache[(typeof url === "number" && url < 0) ? cache.length + url : url]) {
return copy_hash((ρσ_expr_temp = parse_url_params.cache)[(typeof url === "number" && url < 0) ? ρσ_expr_temp.length + url : url]);
}
qs = url.indexOf("#");
ans = Object.create(null);
if (qs < 0) {
cache[(typeof url === "number" && url < 0) ? cache.length + url : url] = ans;
return copy_hash(ans);
}
q = url.slice(qs + 1, url.length + 1);
if (!q) {
cache[(typeof url === "number" && url < 0) ? cache.length + url : url] = ans;
return copy_hash(ans);
}
pairs = q.replace(/\+/g, " ").split("&");
var ρσ_Iter39 = pairs;
ρσ_Iter39 = ((typeof ρσ_Iter39[Symbol.iterator] === "function") ? (ρσ_Iter39 instanceof Map ? ρσ_Iter39.keys() : ρσ_Iter39) : Object.keys(ρσ_Iter39));
for (var ρσ_Index39 of ρσ_Iter39) {
pair = ρσ_Index39;
ρσ_unpack = ρσ_eslice(pair.partition("="), 2);
ρσ_unpack = ρσ_unpack_asarray(2, ρσ_unpack);
key = ρσ_unpack[0];
val = ρσ_unpack[1];
ρσ_unpack = [decodeURIComponent(key), decodeURIComponent(val)];
key = ρσ_unpack[0];
val = ρσ_unpack[1];
if (allow_multiple) {
if (ans[(typeof key === "number" && key < 0) ? ans.length + key : key] === undefined) {
ans[(typeof key === "number" && key < 0) ? ans.length + key : key] = [];
}
ans[(typeof key === "number" && key < 0) ? ans.length + key : key].append(val);
} else {
ans[(typeof key === "number" && key < 0) ? ans.length + key : key] = val;
}
}
cache[(typeof url === "number" && url < 0) ? cache.length + url : url] = ans;
return copy_hash(ans);
};
if (!parse_url_params.__defaults__) Object.defineProperties(parse_url_params, {
__defaults__ : {value: {url:null, allow_multiple:false}},
__handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["url", "allow_multiple"]},
__module__ : {value: "utils"}
});
parse_url_params.cache = Object.create(null);
function encode_query_with_path(query, path) {
path = path || window.location.pathname;
return path + encode_query(query, "#");
};
if (!encode_query_with_path.__argnames__) Object.defineProperties(encode_query_with_path, {
__argnames__ : {value: ["query", "path"]},
__module__ : {value: "utils"}
});
function full_screen_supported(elem) {
elem = elem || document.documentElement;
if (elem.requestFullScreen || elem.webkitRequestFullScreen || elem.mozRequestFullScreen) {
return true;
}
return false;
};
if (!full_screen_supported.__argnames__) Object.defineProperties(full_screen_supported, {
__argnames__ : {value: ["elem"]},
__module__ : {value: "utils"}
});
function request_full_screen(elem) {
var options;
elem = elem || document.documentElement;
options = (function(){
var ρσ_d = Object.create(null);
ρσ_d["navigationUI"] = "hide";
return ρσ_d;
}).call(this);
if (elem.requestFullScreen) {
elem.requestFullScreen(options);
} else if (elem.webkitRequestFullScreen) {
elem.webkitRequestFullScreen();
} else if (elem.mozRequestFullScreen) {
elem.mozRequestFullScreen();
}
};
if (!request_full_screen.__argnames__) Object.defineProperties(request_full_screen, {
__argnames__ : {value: ["elem"]},
__module__ : {value: "utils"}
});
function full_screen_element() {
return document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement;
};
if (!full_screen_element.__module__) Object.defineProperties(full_screen_element, {
__module__ : {value: "utils"}
});
_roman = list(zip([ 1e3, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 ], [ "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" ]));
function roman(num) {
var result, ρσ_unpack, d, r;
if (num <= 0 || num >= 4e3 || int(num) !== num) {
return num + "";
}
result = [];
var ρσ_Iter40 = _roman;
ρσ_Iter40 = ((typeof ρσ_Iter40[Symbol.iterator] === "function") ? (ρσ_Iter40 instanceof Map ? ρσ_Iter40.keys() : ρσ_Iter40) : Object.keys(ρσ_Iter40));
for (var ρσ_Index40 of ρσ_Iter40) {
ρσ_unpack = ρσ_Index40;
d = ρσ_unpack[0];
r = ρσ_unpack[1];
while (num >= d) {
result.append(r);
num -= d;
}
}
return result.join("");
};
if (!roman.__argnames__) Object.defineProperties(roman, {
__argnames__ : {value: ["num"]},
__module__ : {value: "utils"}
});
function fmt_sidx() {
var val = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
var fmt = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? fmt_sidx.__defaults__.fmt : arguments[1];
var use_roman = (arguments[2] === undefined || ( 2 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? fmt_sidx.__defaults__.use_roman : arguments[2];
var ρσ_kwargs_obj = arguments[arguments.length-1];
if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "fmt")){
fmt = ρσ_kwargs_obj.fmt;
}
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "use_roman")){
use_roman = ρσ_kwargs_obj.use_roman;
}
if (val === undefined || val === null || val === "") {
return "1";
}
if (int(val) === float(val)) {
if (use_roman) {
return roman(val);
}
return int(val) + "";
}
return fmt.format(float(val));
};
if (!fmt_sidx.__defaults__) Object.defineProperties(fmt_sidx, {
__defaults__ : {value: {fmt:"{:.2f}", use_roman:true}},
__handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["val", "fmt", "use_roman"]},
__module__ : {value: "utils"}
});
function human_readable() {
var size = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
var sep = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? human_readable.__defaults__.sep : arguments[1];
var ρσ_kwargs_obj = arguments[arguments.length-1];
if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "sep")){
sep = ρσ_kwargs_obj.sep;
}
var i, suffix;
if (size <= 0) {
return "0" + ρσ_str.format("{}", sep) + "B";
}
i = Math.floor(Math.log(size) / Math.log(1024));
size = (size / Math.pow(1024, i)).toFixed(1);
if (size.endswith(".0")) {
size = size.slice(0, -2);
}
suffix = (ρσ_expr_temp = [ "B", "KB", "MB", "GB", "TB", "PB", "EB" ])[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i];
return size + sep + suffix;
};
if (!human_readable.__defaults__) Object.defineProperties(human_readable, {
__defaults__ : {value: {sep:" "}},
__handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["size", "sep"]},
__module__ : {value: "utils"}
});
function document_height() {
var html;
html = document.documentElement;
return max(document.body.scrollHeight, document.body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
};
if (!document_height.__module__) Object.defineProperties(document_height, {
__module__ : {value: "utils"}
});
function document_width() {
var html;
html = document.documentElement;
return max(document.body.scrollWidth, document.body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
};
if (!document_width.__module__) Object.defineProperties(document_width, {
__module__ : {value: "utils"}
});
_data_ns = null;
function data_ns(name) {
var rand;
if (_data_ns === null) {
rand = new Uint8Array(12);
window.crypto.getRandomValues(rand);
_data_ns = "data-" + hexlify(rand) + "-";
}
return _data_ns + name;
};
if (!data_ns.__argnames__) Object.defineProperties(data_ns, {
__argnames__ : {value: ["name"]},
__module__ : {value: "utils"}
});
function get_elem_data(elem, name, defval) {
var ans;
ans = elem.getAttribute(data_ns(name));
if (ans === null) {
return (typeof defval !== "undefined" && defval !== null ? defval : null);
}
return JSON.parse(ans);
};
if (!get_elem_data.__argnames__) Object.defineProperties(get_elem_data, {
__argnames__ : {value: ["elem", "name", "defval"]},
__module__ : {value: "utils"}
});
function set_elem_data(elem, name, val) {
elem.setAttribute(data_ns(name), JSON.stringify(val));
};
if (!set_elem_data.__argnames__) Object.defineProperties(set_elem_data, {
__argnames__ : {value: ["elem", "name", "val"]},
__module__ : {value: "utils"}
});
function username_key(username) {
return ((username) ? "u" : "n") + username;
};
if (!username_key.__argnames__) Object.defineProperties(username_key, {
__argnames__ : {value: ["username"]},
__module__ : {value: "utils"}
});
function html_escape(text) {
var repl;
repl = (function(){
var ρσ_d = Object.create(null);
ρσ_d["&"] = "&";
ρσ_d["\""] = """;
ρσ_d["<"] = "<";
ρσ_d[">"] = ">";
return ρσ_d;
}).call(this);
return String.prototype.replace.call(text, /[&"<>]/g, (function() {
var ρσ_anonfunc = function (c) {
return repl[(typeof c === "number" && c < 0) ? repl.length + c : c];
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["c"]},
__module__ : {value: "utils"}
});
return ρσ_anonfunc;
})());
};
if (!html_escape.__argnames__) Object.defineProperties(html_escape, {
__argnames__ : {value: ["text"]},
__module__ : {value: "utils"}
});
function uniq(vals) {
var ans, seen, x;
ans = [];
seen = Object.create(null);
var ρσ_Iter41 = vals;
ρσ_Iter41 = ((typeof ρσ_Iter41[Symbol.iterator] === "function") ? (ρσ_Iter41 instanceof Map ? ρσ_Iter41.keys() : ρσ_Iter41) : Object.keys(ρσ_Iter41));
for (var ρσ_Index41 of ρσ_Iter41) {
x = ρσ_Index41;
if (!seen[(typeof x === "number" && x < 0) ? seen.length + x : x]) {
seen[(typeof x === "number" && x < 0) ? seen.length + x : x] = true;
ans.push(x);
}
}
return ans;
};
if (!uniq.__argnames__) Object.defineProperties(uniq, {
__argnames__ : {value: ["vals"]},
__module__ : {value: "utils"}
});
function simple_markup(html) {
var div;
html = (html || "").replace(/\uffff/g, "").replace(/<\s*(\/?[a-zA-Z1-6]+)[^>]*>/g, (function() {
var ρσ_anonfunc = function (match, tag) {
var is_closing;
tag = tag.toLowerCase();
is_closing = (tag[0] === "/") ? "/" : "";
if (is_closing) {
tag = tag.slice(1);
}
if (simple_markup.allowed_tags.indexOf(tag) < 0) {
tag = "span";
}
return "\uffff" + ρσ_str.format("{}", is_closing) + "" + ρσ_str.format("{}", tag) + "\uffff";
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["match", "tag"]},
__module__ : {value: "utils"}
});
return ρσ_anonfunc;
})());
div = document.createElement("b");
div.textContent = html;
html = div.innerHTML;
return html.replace(/\uffff(\/?[a-z1-6]+)\uffff/g, "<$1>");
};
if (!simple_markup.__argnames__) Object.defineProperties(simple_markup, {
__argnames__ : {value: ["html"]},
__module__ : {value: "utils"}
});
simple_markup.allowed_tags = 'a|b|i|br|hr|h1|h2|h3|h4|h5|h6|div|em|strong|span'.split('|');
function safe_set_inner_html(elem, html) {
elem.innerHTML = simple_markup(html);
return elem;
};
if (!safe_set_inner_html.__argnames__) Object.defineProperties(safe_set_inner_html, {
__argnames__ : {value: ["elem", "html"]},
__module__ : {value: "utils"}
});
function sandboxed_html(html, style, sandbox) {
var ans, css, final_html;
ans = document.createElement("iframe");
ans.setAttribute("sandbox", sandbox || "");
ans.setAttribute("seamless", "");
ans.style.width = "100%";
html = html || "";
css = "html, body { margin: 0; padding: 0; font-family: __FONT__ } p:first-child { margin-top: 0; padding-top: 0; -webkit-margin-before: 0 }".replace("__FONT__", get_font_family());
css += style || "";
final_html = "