'use strict';var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(c,l,g){c!=Array.prototype&&c!=Object.prototype&&(c[l]=g.value)};$jscomp.getGlobal=function(c){return"undefined"!=typeof window&&window===c?c:"undefined"!=typeof global&&null!=global?global:c};$jscomp.global=$jscomp.getGlobal(this); $jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(c){return $jscomp.SYMBOL_PREFIX+(c||"")+$jscomp.symbolCounter_++}; $jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var c=$jscomp.global.Symbol.iterator;c||(c=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[c]&&$jscomp.defineProperty(Array.prototype,c,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(c){var l=0;return $jscomp.iteratorPrototype(function(){return l=b||0>e&&a<=b)return[];for(var c=[];0b;a+=e)c.push(a);return c}function u(a){if(null==a||"object"== typeof a)return a;var b={},e;for(e in obj)a.hasOwnProperty(e)&&(b[e]=a[e]);return b}function r(a){if(null==a||"object"==typeof a)return a;var b={},e;for(e in obj)a.hasOwnProperty(e)&&(b[e]=r(a[e]));return b}function n(a){return a?Array.from(a):[]}function f(a){a=a?[].slice.apply(a):[];a.__class__=f;return a}function m(a){var b=[];if(a)for(var e=0;eb(e)?1:-1}):a.sort();e&&a.reverse()},z=p("__Terminal__",[D],{get __init__(){return h(this,function(a){a.buffer="";try{a.element=document.getElementById("__terminal__")}catch(ja){a.element= null}a.element&&(a.element.style.overflowX="auto",a.element.style.boxSizing="border-box",a.element.style.padding="5px",a.element.innerHTML="_")})},get print(){return h(this,function(a){var b=" ";var e="\n";if(arguments.length){var c=arguments.length-1;if(arguments[c]&&arguments[c].hasOwnProperty("__kwargtrans__")){var d=arguments[c--],q;for(q in d)switch(q){case "self":a=d[q];break;case "sep":b=d[q];break;case "end":e=d[q]}}var y=f([].slice.apply(arguments).slice(1,c+1))}else y=f();a.buffer="{}{}{}".format(a.buffer, b.join(function(){for(var a=[],b=$jscomp.makeIterator(y),e=b.next();!e.done;e=b.next())a.append(v(e.value));return a}()),e).__getslice__(-4096,null,1);a.element?(a.element.innerHTML=a.buffer.py_replace("\n","
"),a.element.scrollTop=a.element.scrollHeight):console.log(b.join(function(){for(var a=[],b=$jscomp.makeIterator(y),e=b.next();!e.done;e=b.next())a.append(v(e.value));return a}()))})},get input(){return h(this,function(a,b){if(arguments.length){var e=arguments.length-1;if(arguments[e]&&arguments[e].hasOwnProperty("__kwargtrans__")){e= arguments[e--];for(var c in e)switch(c){case "self":a=e[c];break;case "question":b=e[c]}}}a.print("{}".format(b),A({end:""}));c=window.prompt("\n".join(a.buffer.py_split("\n").__getslice__(-16,null,1)));a.print(c);return c})}}),B=z();a.AssertionError=g;a.AttributeError=m;a.DeprecationWarning=r;a.Exception=b;a.IndexError=k;a.IterableError=e;a.KeyError=q;a.NotImplementedError=H;a.RuntimeWarning=t;a.StopIteration=c;a.UserWarning=n;a.ValueError=d;a.Warning=l;a.__Terminal__=z;a.__sort__=x;a.__terminal__= B;a.filter=function(a,b){null==a&&(a=E);var e=[];b=$jscomp.makeIterator(b);for(var c=b.next();!c.done;c=b.next())c=c.value,a(c)&&e.append(c);return e};a.map=function(a,b){var e=[];b=$jscomp.makeIterator(b);for(var c=b.next();!c.done;c=b.next())e.append(a(c.value));return e};a.sorted=function(a,b,e){if("undefined"==typeof b||null!=b&&b.hasOwnProperty("__kwargtrans__"))b=null;if("undefined"==typeof e||null!=e&&e.hasOwnProperty("__kwargtrans__"))e=!1;if(arguments.length){var c=arguments.length-1;if(arguments[c]&& arguments[c].hasOwnProperty("__kwargtrans__"))for(d in c=arguments[c--],c)switch(d){case "iterable":a=c[d];break;case "key":b=c[d];break;case "reverse":e=c[d]}}var d=K(a)==w?u(a.py_keys()):u(a);x(d,b,e);return d}}}});d.__call__=function(){var a=[].slice.apply(arguments);return"object"==typeof a[0]&&"__call__"in a[0]?a[0].__call__.apply(a[1],a.slice(2)):a[0].apply(a[1],a.slice(2))};x(d,"",z(d.org.transcrypt.__base__));B=d.__envir__;x(d,"",z(d.org.transcrypt.__standard__));var da=d.Exception,ea=d.StopIteration, J=d.ValueError,P=d.KeyError,fa=d.AssertionError,ha=d.__sort__;d.print=d.__terminal__.print;d.input=d.__terminal__.input;B.executor_name=B.transpiler_name;d.main={__file__:""};d.__except__=null;var A=function(a){a.__kwargtrans__=null;a.constructor=Object;return a};d.__kwargtrans__=A;d.__globals__=function(a){return G(a,w)?a:w(a)};var L=function(a,b){a=$jscomp.makeIterator(a.__bases__);for(var e=a.next();!e.done;e=a.next())if(e=e.value,b in e)return e[b];throw new da("Superclass method not found"); };d.__super__=L;d.property=function(a,b){b||(b=function(){});return{get:function(){return a(this)},set:function(a){b(this,a)},enumerable:!0}};var t=function(a,b,e){a.hasOwnProperty(b)||Object.defineProperty(a,b,e)};d.__setProperty__=t;d.assert=function(a,b){if(!a)throw fa(b,Error());};d.__merge__=function(a,b){var e={},c;for(c in a)e[c]=a[c];for(c in b)e[c]=b[c];return e};d.dir=function(a){var b=[],e;for(e in a)b.push(e);b.sort();return b};d.setattr=function(a,b,e){a[b]=e};d.getattr=function(a,b){return a[b]}; d.hasattr=function(a,b){try{return b in a}catch(e){return!1}};d.delattr=function(a,b){delete a[b]};d.__in__=function(a,b){return K(b)==w?b.hasOwnProperty(a):b.indexOf?-1"}}}};d.repr=I;d.chr=function(a){return String.fromCharCode(a)};d.ord=function(a){return a.charCodeAt(0)};var Q=Math.max;d.max=Q;d.min=Math.min;d.abs=Math.abs;d.round=function(a,b){if(b){var c=Math.pow(10,b);a*=c}var d=Math.round(a); .5==d-a&&d%2&&--d;b&&(d/=c);return d};l.prototype.__next__=function(){if(this.indexa&&(a=this.length+a);null==b?b=this.length:0>b?b=this.length+b:b>this.length&&(b=this.length);for(var e=n([]);aa&&(a=this.length+a);null==b?b=this.length:0>b&&(b=this.length+b);if(null==c)Array.prototype.splice.apply(this, [a,b-a].concat(d));else for(var e=0;aa)c=d-1;else return d}return-1};Array.prototype.add=function(a){-1==this.indexOf(a)&&this.push(a)};Array.prototype.discard=function(a){a=this.indexOf(a);-1!=a&&this.splice(a, 1)};Array.prototype.isdisjoint=function(a){this.sort();for(var b=0;ba&&(a=this.length+a);null==b?b=this.length:0>b&&(b=this.length+b);var e="";if(1==c)e=this.substring(a,b);else for(;a>b};d.__or__=function(a,b){return"object"==typeof a&&"__or__"in a?a.__or__(b):"object"==typeof b&&"__ror__"in b?b.__ror__(a):a|b};d.__xor__=function(a,b){return"object"==typeof a&&"__xor__"in a?a.__xor__(b):"object"==typeof b&&"__rxor__"in b?b.__rxor__(a):a^b};d.__and__=function(a,b){return"object"==typeof a&&"__and__"in a?a.__and__(b):"object"==typeof b&& "__rand__"in b?b.__rand__(a):a&b};d.__eq__=function(a,b){return"object"==typeof a&&"__eq__"in a?a.__eq__(b):a==b};d.__ne__=function(a,b){return"object"==typeof a&&"__ne__"in a?a.__ne__(b):a!=b};d.__lt__=function(a,b){return"object"==typeof a&&"__lt__"in a?a.__lt__(b):ab};d.__ge__=function(a,b){return"object"==typeof a&&"__ge__"in a?a.__ge__(b): a>=b};d.__imatmul__=function(a,b){return"__imatmul__"in a?a.__imatmul__(b):a.__matmul__(b)};d.ipow=function(a,b){return"object"==typeof a&&"__pow__"in a?a.__ipow__(b):"object"==typeof a&&"__ipow__"in a?a.__pow__(b):"object"==typeof b&&"__rpow__"in b?b.__rpow__(a):Math.pow(a,b)};d.ijsmod__=function(a,b){return"object"==typeof a&&"__imod__"in a?a.__ismod__(b):"object"==typeof a&&"__mod__"in a?a.__mod__(b):"object"==typeof b&&"__rpow__"in b?b.__rmod__(a):a%b};d.imod=function(a,b){return"object"==typeof a&& "__imod__"in a?a.__imod__(b):"object"==typeof a&&"__mod__"in a?a.__mod__(b):"object"==typeof b&&"__rpow__"in b?b.__rmod__(a):(a%b+b)%b};d.__imul__=function(a,b){return"object"==typeof a&&"__imul__"in a?a.__imul__(b):"object"==typeof a&&"__mul__"in a?a.__mul__(b):"object"==typeof b&&"__rmul__"in b?b.__rmul__(a):"string"==typeof a?a.__mul__(b):"string"==typeof b?b.__rmul__(a):a*b};d.__idiv__=function(a,b){return"object"==typeof a&&"__idiv__"in a?a.__idiv__(b):"object"==typeof a&&"__div__"in a?a.__div__(b): "object"==typeof b&&"__rdiv__"in b?b.__rdiv__(a):a/b};d.__iadd__=function(a,b){return"object"==typeof a&&"__iadd__"in a?a.__iadd__(b):"object"==typeof a&&"__add__"in a?a.__add__(b):"object"==typeof b&&"__radd__"in b?b.__radd__(a):a+b};d.__isub__=function(a,b){return"object"==typeof a&&"__isub__"in a?a.__isub__(b):"object"==typeof a&&"__sub__"in a?a.__sub__(b):"object"==typeof b&&"__rsub__"in b?b.__rsub__(a):a-b};d.__ilshift__=function(a,b){return"object"==typeof a&&"__ilshift__"in a?a.__ilshift__(b): "object"==typeof a&&"__lshift__"in a?a.__lshift__(b):"object"==typeof b&&"__rlshift__"in b?b.__rlshift__(a):a<>b};d.__ior__=function(a,b){return"object"==typeof a&&"__ior__"in a?a.__ior__(b):"object"==typeof a&&"__or__"in a?a.__or__(b):"object"==typeof b&&"__ror__"in b?b.__ror__(a):a|b};d.__ixor__= function(a,b){return"object"==typeof a&&"__ixor__"in a?a.__ixor__(b):"object"==typeof a&&"__xor__"in a?a.__xor__(b):"object"==typeof b&&"__rxor__"in b?b.__rxor__(a):a^b};d.__iand__=function(a,b){return"object"==typeof a&&"__iand__"in a?a.__iand__(b):"object"==typeof a&&"__and__"in a?a.__and__(b):"object"==typeof b&&"__rand__"in b?b.__rand__(a):a&b};d.__getitem__=function(a,b){return"object"==typeof a&&"__getitem__"in a?a.__getitem__(b):a[b]};d.__setitem__=function(a,b,c){"object"==typeof a&&"__setitem__"in a?a.__setitem__(b,c):a[b]=c};d.__getslice__=function(a,b,c,d){return"object"==typeof a&&"__getitem__"in a?a.__getitem__([b,c,d]):a.__getslice__(b,c,d)};d.__setslice__=function(a,b,c,d,f){"object"==typeof a&&"__setitem__"in a?a.__setitem__([b,c,d],f):a.__setslice__(b,c,d,f)};x(d,"storage",{__all__:{__inited__:!1,__init__:function(a){var b=new WeakMap,c=function(a){b.has(a)||b.set(a,new Map);return b.get(a)};a.TIMERS=b;a._tstore=c;a.get_timer=function(a,b){a=c(a).get(b);return void 0!==a?a:null};a.get_timers= function(a,b){var d=n([]);a=c(a);for(var e=$jscomp.makeIterator(a.keys()),f=e.next();!f.done;f=e.next())f=f.value,null!==b&&void 0!==b&&b!=f||d.append(a.get(f));return d};a.remove_timer=function(a,d){var e=c(a);e.delete(d);0==e.length&&b.delete(a)};a.store_timer=function(a,b,d){c(a).set(b,d)}}}});x(d,"timer_array",{__all__:{__inited__:!1,__init__:function(a){var b=p("TimerArray",[D],{get __init__(){return h(this,function(a,b){a.timers=b})},get cancel(){return h(this,function(a){for(var b=$jscomp.makeIterator(a.timers), c=b.next();!c.done;c=b.next())c.value.cancel();return a})},get do(){return h(this,function(a,b){for(var c=$jscomp.makeIterator(a.timers),d=c.next();!d.done;d=c.next())d.value.do(b);return a})},get catch(){return h(this,function(a,b){for(var c=$jscomp.makeIterator(a.timers),d=c.next();!d.done;d=c.next())d.value.catch(b);return a})},get then(){return h(this,function(a,b){for(var c=$jscomp.makeIterator(a.timers),d=c.next();!d.done;d=c.next())d.value.then(b);return a})}});a.TimerArray=b}}});x(d,"timer_base", {__all__:{__inited__:!1,__init__:function(a){var b=z(d.storage).get_timers,c=z(d.storage).store_timer,f=z(d.storage).remove_timer,g=p("BaseTimer",[D],{get __init__(){return h(this,function(a,d){a.elem=d.elem;a.millis=d.millis;a.maxRuns=d.maxRuns;a.tname=d.name;a.timerId=null;a.timerStart=null;a.runIndex=0;a.finished=!1;d=$jscomp.makeIterator(b(a.elem,a.tname));for(var e=d.next();!e.done;e=d.next())e=e.value,e!==a&&e.cancel();c(a.elem,a.tname,a);a.observers=w({"do":n([]),then:n([]),"catch":n([])}); a._renewTimer()})},get cancel(){return h(this,function(a){a._notifyObservers("then",n([a]));a._finalizeTimer()})},get _finalizeTimer(){return h(this,function(a){f(a.elem,a.tname);a.timerId&&(window.clearTimeout(a.timerId),a.timerId=null);a.observers=null})},get _renewTimer(){return h(this,function(a){a._shouldRunAgain()?(a.timerStart=(new Date).getTime(),a.timerId=window.setTimeout(a._onTimeout,a._nextMillis())):(a._notifyObservers("then",n([a])),a._finalizeTimer())})},get _nextMillis(){return h(this, function(a){return a.millis})},get _onTimeout(){return h(this,function(a){if(a._shouldRunAgain()){a.runIndex++;try{a._notifyObservers("do",n([a]))}catch(H){if(G(H,Error)){var b=H;if(null===a.observers)throw b.__cause__=null,b;a._notifyObservers("catch",n([a,b]));a._finalizeTimer();return}throw H;}a._renewTimer()}else a._notifyObservers("then",n([a])),a._finalizeTimer()})},get _shouldRunAgain(){return h(this,function(a){return null!==a.elem&&(document==a.elem||document.contains(a.elem))&&null!==a.observers&& 0<=a.millis&&(0>=a.maxRuns||a.runIndex