diff --git a/bin/todo.rb b/bin/todo.rb index e2802dc..883728e 100644 --- a/bin/todo.rb +++ b/bin/todo.rb @@ -306,7 +306,12 @@ def list(tasks = nil, patterns = nil) patterns ||= [] patterns += [':active'] if (patterns & [':active', ':done', ':blocked', ':started', ':new', ':all']).empty? items = filter_tasks(tasks, patterns).sort_by do |num, task| - [task[:priority] && task[:state] != 'done' ? 0 : 1, ORDER[task[:state] || 'default'], task[:due] || 'n/a', num] + [ + task[:priority] && task[:state] != 'done' ? 0 : 1, + ORDER[task[:state] || 'default'], + task[:state] != 'done' ? task[:due] || 'n/a' : task[:modified], + num + ] end items.each do |num, task| state = task[:state] || 'default' diff --git a/node/package.json b/node/package.json index 509ce62..98dc1c1 100644 --- a/node/package.json +++ b/node/package.json @@ -1,6 +1,6 @@ { "name": "todo-jsonl", - "version": "1.0.2", + "version": "1.0.3", "description": "todo list manager on the command-line inspired by todo.txt using the jsonl format", "main": "todo.js", "bin": { diff --git a/node/todo.js b/node/todo.js index 4e9603c..09ffac0 100644 --- a/node/todo.js +++ b/node/todo.js @@ -68,7 +68,7 @@ this.$raise(w(da,ma,b,f));return f},u.$$arity=-4);a.defs(G,"$coerce_to?",c=funct "String"),"to_str");d(/^@[a-zA-Z_][a-zA-Z0-9_]*?$/.test(da))||this.$raise(t(l,"NameError").$new("'"+da+"' is not allowed as an instance variable name",da));return da},L.$$arity=1);a.defs(G,"$class_variable_name!",D=function(da){da=t(l,"Opal")["$coerce_to!"](da,t(l,"String"),"to_str");d(3>da.length||"@@"!==da.slice(0,2))&&this.$raise(t(l,"NameError").$new("`"+da+"' is not allowed as a class variable name",da));return da},D.$$arity=1);a.defs(G,"$const_name!",R=function(da){da=t(l,"Opal")["$coerce_to!"](da, t(l,"String"),"to_str");d(da["$[]"](0)["$!="](da["$[]"](0).$upcase()))&&this.$raise(t(l,"NameError"),"wrong constant name "+da);return da},R.$$arity=1);a.defs(G,"$pristine",ja=function(da,ma){var b=a.slice.call(arguments,1,arguments.length);for(var h,f=b.length-1;0<=f;f--)h=b[f],(h=da.$$prototype["$"+h])&&!h.$$stub&&(h.$$pristine=!0);return J},ja.$$arity=-2)}(y[0],y)}; Opal.modules["corelib/module"]=function(a){function y(k,I){return"number"===typeof k&&"number"===typeof I?k $nil? $attr_reader $attr_writer $warn $attr_accessor $class_variable_name! $new $const_name! $=~ $inject $split $const_get $== $!~ $start_with? $bind $call $class $append_features $included $name $cover? $size $merge $compile $proc $any? $prepend_features $prepended $to_s $__id__ $constants $include? $copy_class_variables $copy_constants".split(" ")); -return function(k,$super,e){k=G(k,$super,"Module");var n=[k].concat(e),L,D,R,ja,da,ma,b,h,f,q,A,E,F,M,ba,ua,Pa,va,Da,Ma,na,S,sa,ya,pa,ha,H,V,ka,wa,ia,xa,Ha,Ia,Ra,Ta,Ja,jb,kb,W,za,Ca,Aa,bb,db,ab,Wa,Ba,ta,Na,Sa,Ya,Fa,Y,Q,Z,T,ea,la;a.defs(k,"$allocate",L=function(){var g=a.allocate_module(t,function(){});this!==a.Module&&Object.setPrototypeOf(g,this.$$prototype);return g},L.$$arity=0);a.def(k,"$initialize",D=function(){var g=D.$$p,C=g||t;g&&(D.$$p=null);g&&(D.$$p=null);return C!==t?x(this,"module_eval", +return function(k,$super,e){k=G(k,$super,"Module");var n=[k].concat(e),L,D,R,ja,da,ma,b,h,f,q,A,E,F,M,ba,ua,Pa,va,Da,Ma,na,S,sa,ya,pa,ha,H,V,ka,wa,ia,xa,Ia,Ha,Ra,Ta,Ja,jb,kb,W,za,Ca,Aa,bb,db,ab,Wa,Ba,ta,Na,Sa,Ya,Fa,Y,Q,Z,T,ea,la;a.defs(k,"$allocate",L=function(){var g=a.allocate_module(t,function(){});this!==a.Module&&Object.setPrototypeOf(g,this.$$prototype);return g},L.$$arity=0);a.def(k,"$initialize",D=function(){var g=D.$$p,C=g||t;g&&(D.$$p=null);g&&(D.$$p=null);return C!==t?x(this,"module_eval", [],C.$to_proc()):t},D.$$arity=0);a.def(k,"$===",R=function(g){return p(null==g)?!1:a.is_a(g,this)},R.$$arity=1);a.def(k,"$<",ja=function(g){p(z(n,"Module")["$==="](g))||this.$raise(z(n,"TypeError"),"compared with non class/module");var C;if(this===g)return!1;var N=0;var aa=a.ancestors(this);for(C=aa.length;N",ma=function(g){p(z(n,"Module")["$==="](g))||this.$raise(z(n,"TypeError"),"compared with non class/module");return y(g,this)},ma.$$arity=1);a.def(k,"$>=",b=function(g){var C;return p(C=this["$equal?"](g))?C:"number"===typeof this&&"number"===typeof g?this>g:this["$>"](g)},b.$$arity=1);a.def(k,"$<=>",h=function(g){if(this===g)return 0;if(!p(z(n,"Module")["$==="](g)))return t;g=y(this,g);return p(g["$nil?"]())?t:p(g)?-1:1},h.$$arity=1);a.def(k,"$alias_method",f= function(g,C){g=d(g,z(n,"String"),"to_str");C=d(C,z(n,"String"),"to_str");a.alias(this,g,C);return this},f.$$arity=2);a.def(k,"$alias_native",q=function(g,C){null==C&&(C=g);a.alias_native(this,g,C);return this},q.$$arity=-2);a.def(k,"$ancestors",A=function(){return a.ancestors(this)},A.$$arity=0);a.def(k,"$append_features",E=function(g){a.append_features(this,g);return this},E.$$arity=1);a.def(k,"$attr_accessor",F=function(g){var C=a.slice.call(arguments,0,arguments.length);x(this,"attr_reader",a.to_a(C)); @@ -81,8 +81,8 @@ ha=function(g,C){null==C&&(C=!0);g=z(n,"Opal")["$const_name!"](g);p(g["$=~"](w(z "::"!==g&&(g=g.slice(2));if(p(-1!=g.indexOf("::")&&"::"!=g))return x(g.$split("::"),"inject",[this],(N=function(aa,v){null==aa&&(aa=t);null==v&&(v=t);return aa.$const_get(v)},N.$$s=this,N.$$arity=2,N));p(g["$=~"](w(z(n,"Opal"),"CONST_NAME_REGEXP")))||this.$raise(z(n,"NameError").$new("wrong constant name "+g,g));return C?z([this],g):a.const_get_local(this,g)},H.$$arity=-2);a.def(k,"$const_missing",V=function(g){var C;if(this.$$autoload&&(C=this.$$autoload[g]))return this.$require(C),this.$const_get(g); C=this["$=="](z(n,"Object"))?g:""+this+"::"+g;return this.$raise(z(n,"NameError").$new("uninitialized constant "+C,g))},V.$$arity=1);a.def(k,"$const_set",ka=function(g,C){var N=t;g=z(n,"Opal")["$const_name!"](g);p(p(N=g["$!~"](w(z(n,"Opal"),"CONST_NAME_REGEXP")))?N:g["$start_with?"]("::"))&&this.$raise(z(n,"NameError").$new("wrong constant name "+g,g));a.const_set(this,g,C);return C},ka.$$arity=2);a.def(k,"$public_constant",wa=function(){return t},wa.$$arity=1);a.def(k,"$define_method",ia=function(g, C){var N=ia.$$p,aa=N||t,v,U=this,oa=t,La=t;N&&(ia.$$p=null);N&&(ia.$$p=null);p(void 0===C&&aa===t)&&U.$raise(z(n,"ArgumentError"),"tried to create a Proc object without a block");aa=function(){return p(oa=aa)?oa:function(){La=C;return z(n,"Proc")["$==="](La)?C:z(n,"Method")["$==="](La)?C.$to_proc().$$unbound:z(n,"UnboundMethod")["$==="](La)?m((v=function(ib){var ob=null==v.$$s?this:v.$$s;var mb=a.slice.call(arguments,0,arguments.length);ob=C.$bind(ob);return x(ob,"call",a.to_a(mb))},v.$$s=U,v.$$arity= --1,v)):U.$raise(z(n,"TypeError"),"wrong argument type "+aa.$class()+" (expected Proc/Method)")}()}();aa.$$jsid=g;aa.$$s=null;aa.$$def=aa;aa.$$define_meth=!0;a.defn(U,"$"+g,aa);return g},ia.$$arity=-2);a.def(k,"$remove_method",xa=function(g){var C=a.slice.call(arguments,0,arguments.length);for(var N=0,aa=C.length;N",R=function(v){this.$$comparable=!0;return(v=this["$=="](v))&&v!==t?0:t},R.$$arity=1);a.def(c,"$method",ja=function(v){var U=this["$"+v];U&&!U.$$stub||this.$raise(z(I,"NameError").$new("undefined method `"+v+"' for class `"+this.$class()+"'",v));return z(I,"Method").$new(this,U.$$owner||this.$class(), U,v)},ja.$$arity=1);a.def(c,"$methods",da=function(v){null==v&&(v=!0);return p(v)?a.methods(this):a.own_methods(this)},da.$$arity=-1);a.def(c,"$public_methods",ma=function(v){null==v&&(v=!0);return p(v)?a.methods(this):a.receiver_methods(this)},ma.$$arity=-1);a.def(c,"$Array",b=function(v){if(v===t)return[];if(v.$$is_array)return v;var U=z(I,"Opal")["$coerce_to?"](v,z(I,"Array"),"to_ary");if(U!==t)return U;U=z(I,"Opal")["$coerce_to?"](v,z(I,"Array"),"to_a");return U!==t?U:[v]},b.$$arity=1);a.def(c, "$at_exit",h=function(){var v=h.$$p,U=v||t,oa=t;null==x.__at_exit__&&(x.__at_exit__=t);v&&(h.$$p=null);v&&(h.$$p=null);x.__at_exit__=p(oa=x.__at_exit__)?oa:[];x.__at_exit__["$<<"](U);return U},h.$$arity=0);a.def(c,"$caller",f=function(v,U){null==U&&(U=t);v=(Error().stack||"").split("\n");var oa=[];for(var La=3,ib=v.length;LaU||36=U?U-1:"9a-"+String.fromCharCode(97+(U-11)));(new RegExp("^\\s*[+-]?["+ib+"]+\\s*$")).test(La)||oa.$raise(z(I,"ArgumentError"),'invalid value for Integer(): "'+v+'"');La=parseInt(La,U);isNaN(La)&&oa.$raise(z(I,"ArgumentError"),'invalid value for Integer(): "'+ v+'"');return La},ia.$$arity=-2);a.def(c,"$Float",xa=function(v){v===t&&this.$raise(z(I,"TypeError"),"can't convert nil into Float");if(v.$$is_string){var U=v.toString();U=U.replace(/(\d)_(?=\d)/g,"$1");if(/^\s*[-+]?0[xX][0-9a-fA-F]+\s*$/.test(U))return this.$Integer(U);/^\s*[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\s*$/.test(U)||this.$raise(z(I,"ArgumentError"),'invalid value for Float(): "'+v+'"');return parseFloat(U)}return z(I,"Opal")["$coerce_to!"](v,z(I,"Float"),"to_f")},xa.$$arity=1);a.def(c, -"$Hash",Ha=function(v){var U=t;return p(p(U=v["$nil?"]())?U:v["$=="]([]))?l([],{}):p(z(I,"Hash")["$==="](v))?v:z(I,"Opal")["$coerce_to!"](v,z(I,"Hash"),"to_hash")},Ha.$$arity=1);a.def(c,"$is_a?",Ia=function(v){v.$$is_class||v.$$is_module||this.$raise(z(I,"TypeError"),"class or module required");return a.is_a(this,v)},Ia.$$arity=1);a.def(c,"$itself",Ra=function(){return this},Ra.$$arity=0);a.alias(c,"kind_of?","is_a?");a.def(c,"$lambda",Ta=function(){var v=Ta.$$p,U=v||t;v&&(Ta.$$p=null);v&&(Ta.$$p= +"$Hash",Ia=function(v){var U=t;return p(p(U=v["$nil?"]())?U:v["$=="]([]))?l([],{}):p(z(I,"Hash")["$==="](v))?v:z(I,"Opal")["$coerce_to!"](v,z(I,"Hash"),"to_hash")},Ia.$$arity=1);a.def(c,"$is_a?",Ha=function(v){v.$$is_class||v.$$is_module||this.$raise(z(I,"TypeError"),"class or module required");return a.is_a(this,v)},Ha.$$arity=1);a.def(c,"$itself",Ra=function(){return this},Ra.$$arity=0);a.alias(c,"kind_of?","is_a?");a.def(c,"$lambda",Ta=function(){var v=Ta.$$p,U=v||t;v&&(Ta.$$p=null);v&&(Ta.$$p= null);return a.lambda(U)},Ta.$$arity=0);a.def(c,"$load",Ja=function(v){v=z(I,"Opal")["$coerce_to!"](v,z(I,"String"),"to_str");return a.load(v)},Ja.$$arity=1);a.def(c,"$loop",jb=function(){var v,U=jb.$$p,oa=U||t,La=t;U&&(jb.$$p=null);if(oa===t)return m(this,"enum_for",["loop"],(v=function(){return w(z(I,"Float"),"INFINITY")},v.$$s=this,v.$$arity=0,v));for(;p(!0);)try{a.yieldX(oa,[])}catch(ib){if(a.rescue(ib,[z(I,"StopIteration")])){La=ib;try{return La.$result()}finally{a.pop_exception()}}else throw ib; }return this},jb.$$arity=0);a.def(c,"$nil?",kb=function(){return!1},kb.$$arity=0);a.alias(c,"object_id","__id__");a.def(c,"$printf",W=function(v){var U=a.slice.call(arguments,0,arguments.length);p(U["$any?"]())&&this.$print(m(this,"format",a.to_a(U)));return t},W.$$arity=-1);a.def(c,"$proc",za=function(){var v=za.$$p,U=v||t;v&&(za.$$p=null);v&&(za.$$p=null);p(U)||this.$raise(z(I,"ArgumentError"),"tried to create Proc object without a block");U.$$is_lambda=!1;return U},za.$$arity=0);a.def(c,"$puts", Ca=function(v){null==x.stdout&&(x.stdout=t);var U=a.slice.call(arguments,0,arguments.length);return m(x.stdout,"puts",a.to_a(U))},Ca.$$arity=-1);a.def(c,"$p",Aa=function(v){var U;var oa=a.slice.call(arguments,0,arguments.length);m(oa,"each",[],(U=function(La){null==x.stdout&&(x.stdout=t);null==La&&(La=t);return x.stdout.$puts(La.$inspect())},U.$$s=this,U.$$arity=1,U));return p(y(oa.$length(),1))?oa["$[]"](0):oa},Aa.$$arity=-1);a.def(c,"$print",bb=function(v){null==x.stdout&&(x.stdout=t);var U=a.slice.call(arguments, @@ -179,7 +179,7 @@ q=1,A=this.matches.length;q $== $=~ $new $force_encoding $casecmp $empty? $ljust $ceil $/ $+ $rjust $floor $to_a $each_char $to_proc $coerce_to! $copy_singleton_methods $initialize_clone $initialize_dup $enum_for $size $chomp $[] $to_i $each_line $encoding $class $match $match? $captures $proc $succ $escape $include? $upcase $unicode_normalize".split(" ")); t.$require("corelib/comparable");t.$require("corelib/regexp");(function(k,$super,e){function n(B){function O(Ua){var Xa="",gb,qb=Ua.length;for(gb=0;gbnb&&L.$raise(d(D,"ArgumentError"),'invalid range "'+pb+"-"+nb+'" in string transliteration');for(pb+=1;pbB&&this.$raise(d(D,"ArgumentError"),"negative argument");if(0===B)return this.$$cast("");var O="",ra=this.toString();for(268435456<=ra.length*B&&this.$raise(d(D,"RangeError"),"multiply count must not overflow maximum string size");;){1===(B&1)&&(O+=ra);B>>>=1;if(0===B)break;ra+=ra}return this.$$cast(O)},h.$$arity=1);a.def(L,"$+",f=function(B){B=G(B,d(D,"String"), "to_str");return this+B.$to_s()},f.$$arity=1);a.def(L,"$<=>",q=function(B){if(m(B["$respond_to?"]("to_str")))return B=B.$to_str().$to_s(),this>B?1:this"](this);return B===z?z:0B?1:0},q.$$arity=1);a.def(L,"$==",A=function(B){return B.$$is_string?this.toString()===B.toString():x(B,"$to_str")?B["$=="](this):!1},A.$$arity=1);a.alias(L,"eql?","==");a.alias(L,"===","==");a.def(L,"$=~",E=function(B){B.$$is_string&&this.$raise(d(D,"TypeError"),"type mismatch: String given");return B["$=~"](this)}, @@ -192,10 +192,10 @@ B-1);return this.$$cast(B)},na.$$arity=0);a.def(L,"$chr",S=function(){return thi O=n(O);return null===O?0:this.length-this.replace(new RegExp(O,"g"),"").length},pa.$$arity=-1);a.def(L,"$delete",ha=function(B){var O=a.slice.call(arguments,0,arguments.length);0===O.length&&this.$raise(d(D,"ArgumentError"),"ArgumentError: wrong number of arguments (0 for 1+)");O=n(O);return null===O?this:this.$$cast(this.replace(new RegExp(O,"g"),""))},ha.$$arity=-1);a.def(L,"$delete_prefix",H=function(B){B.$$is_string||(B=G(B,d(D,"String"),"to_str"));return this.slice(0,B.length)===B?this.$$cast(this.slice(B.length)): this},H.$$arity=1);a.def(L,"$delete_suffix",V=function(B){B.$$is_string||(B=G(B,d(D,"String"),"to_str"));return this.slice(this.length-B.length)===B?this.$$cast(this.slice(0,this.length-B.length)):this},V.$$arity=1);a.def(L,"$downcase",ka=function(){return this.$$cast(this.toLowerCase())},ka.$$arity=0);a.def(L,"$each_char",wa=function(){var B=wa.$$p,O=B||z,ra;B&&(wa.$$p=null);B&&(wa.$$p=null);if(O===z)return u(this,"enum_for",["each_char"],(ra=function(){return(null==ra.$$s?this:ra.$$s).$size()}, ra.$$s=this,ra.$$arity=0,ra));B=0;for(var Ga=this.length;B=Ea.length&&this.substr(this.length- -Ea.length,Ea.length)==Ea)return!0}return!1},Ha.$$arity=-1);a.alias(L,"equal?","===");a.def(L,"$gsub",Ia=function(B,O){var ra=Ia.$$p,Ga=ra||z,Ea=this;ra&&(Ia.$$p=null);ra&&(Ia.$$p=null);if(void 0===O&&Ga===z)return Ea.$enum_for("gsub",B);ra="";var Ka=z,Va=0;B.$$is_regexp?B=a.global_multiline_regexp(B):(B=G(B,d(D,"String"),"to_str"),B=new RegExp(B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gm"));for(var hb;;){var eb=B.exec(Ea);if(null===eb){c["~"]=z;ra+=Ea.slice(Va);break}Ka=d(D,"MatchData").$new(B,eb); +"")+(B[O+1]||"")));return this}O=this.$chomp(B);Ga=this.length!=O.length;var Ka=O.split(B);O=0;for(Ea=Ka.length;O=Ea.length&&this.substr(this.length- +Ea.length,Ea.length)==Ea)return!0}return!1},Ia.$$arity=-1);a.alias(L,"equal?","===");a.def(L,"$gsub",Ha=function(B,O){var ra=Ha.$$p,Ga=ra||z,Ea=this;ra&&(Ha.$$p=null);ra&&(Ha.$$p=null);if(void 0===O&&Ga===z)return Ea.$enum_for("gsub",B);ra="";var Ka=z,Va=0;B.$$is_regexp?B=a.global_multiline_regexp(B):(B=G(B,d(D,"String"),"to_str"),B=new RegExp(B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gm"));for(var hb;;){var eb=B.exec(Ea);if(null===eb){c["~"]=z;ra+=Ea.slice(Va);break}Ka=d(D,"MatchData").$new(B,eb); if(void 0===O){hb=B.lastIndex;var Ua=Ga(eb[0]);B.lastIndex=hb}else O.$$is_hash?Ua=O["$[]"](eb[0]).$to_s():(O.$$is_string||(O=G(O,d(D,"String"),"to_str")),Ua=O.replace(/([\\]+)([0-9+&`'])/g,function(Xa,gb,qb){if(0===gb.length%2)return Xa;switch(qb){case "+":for(Xa=eb.length-1;0O&&(O+=this.length,0>O))return z;if(B.$$is_regexp)for(ra=a.global_multiline_regexp(B);;){B=ra.exec(this);if(null===B){c["~"]=z;O=-1;break}if(B.index>=O){c["~"]=d(D,"MatchData").$new(ra,B);O=B.index;break}ra.lastIndex=B.index+1}else B=G(B,d(D,"String"),"to_str"),O=0===B.length&&O>this.length?-1:this.indexOf(B,O);return-1===O?z:O},jb.$$arity=-2);a.def(L,"$inspect",kb=function(){var B={"\u0007":"\\a","\u001b":"\\e","\b":"\\b","\t":"\\t", "\n":"\\n","\f":"\\f","\r":"\\r","\x0B":"\\v",'"':'\\"',"\\":"\\\\"};return'"'+this.replace(/[\\"\x00-\x1f\u007F-\u009F\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(O){return B[O]||"\\u"+("0000"+O.charCodeAt(0).toString(16).toUpperCase()).slice(-4)}).replace(/#[\$@\{]/g,"\\$&")+'"'},kb.$$arity=0);a.def(L,"$intern",W=function(){return this.toString()},W.$$arity=0);a.def(L,"$lines",za=function(B){var O=za.$$p,ra=O||z;null==c["/"]&&(c["/"]=z);O&& (za.$$p=null);O&&(za.$$p=null);null==B&&(B=c["/"]);B=u(this,"each_line",[B],ra.$to_proc());return m(ra)?this:B.$to_a()},za.$$arity=-1);a.def(L,"$length",Ca=function(){return this.length},Ca.$$arity=0);a.def(L,"$ljust",Aa=function(B,O){null==O&&(O=" ");B=G(B,d(D,"Integer"),"to_int");O=G(O,d(D,"String"),"to_str").$to_s();m(O["$empty?"]())&&this.$raise(d(D,"ArgumentError"),"zero width padding");if(m(B<=this.length))return this;var ra=-1,Ga="";for(B-=this.length;++ran:e["$>"](n)}function J(e,n){return"number"===typeof e&&"number"===typeof n?e+n:e["$+"](n)}function t(e,n){return"number"===typeof e&&"number"===typeof n?e-n:e["$-"](n)}function w(e,n){return"number"===typeof e&&"number"===typeof n?e<=n:e["$<="](n)}var z=[],p=a.nil,d=a.$$$,G=a.$$,x=a.falsy,l=a.truthy,m=a.coerce_to,u=a.module,c=a.send,k=a.hash2,I=a.lambda;a.add_stubs("$each $public_send $destructure $to_enum $enumerator_size $new $yield $raise $slice_when $! $enum_for $flatten $map $warn $proc $== $nil? $respond_to? $coerce_to! $> $* $try_convert $< $+ $- $ceil $/ $size $select $to_proc $__send__ $length $<= $[] $push $<< $[]= $=== $inspect $<=> $first $reverse $sort $take $sort_by $compare $call $dup $to_a $sort! $map! $key? $values $transform_values $group_by $to_h $coerce_to? $class $zip".split(" ")); -return function(e,n){function L(Y){0===Y.length&&(Y=[p]);1"](ea),la===p&&T.$raise(G(D,"ArgumentError"),"comparison failed"),0"](la)&&(ea=g,la=C)};this.$each();return void 0===ea?p:ea},xa.$$arity=-1);a.alias(e,"member?","include?");a.def(e,"$min",Ha=function(Y){var Q=Ha.$$p,Z=Q||p,T,ea=this;Q&&(Ha.$$p= -null);Q&&(Ha.$$p=null);null==Y&&(Y=p);if(!l(Y["$nil?"]()))return Z!==p?c(ea,"sort",[],(T=function(g,C){null==g&&(g=p);null==C&&(C=p);return a.yieldX(Z,[g,C])},T.$$s=ea,T.$$arity=2,T)).$take(Y):ea.$sort().$take(Y);var la;ea.$each.$$p=Z!==p?function(){var g=G(D,"Opal").$destructure(arguments);if(void 0===la)la=g;else{var C=Z(g,la);C===p&&ea.$raise(G(D,"ArgumentError"),"comparison failed");0>C&&(la=g)}}:function(){var g=G(D,"Opal").$destructure(arguments);void 0===la?la=g:0>G(D,"Opal").$compare(g,la)&& -(la=g)};ea.$each();return void 0===la?p:la},Ha.$$arity=-1);a.def(e,"$min_by",Ia=function(Y){var Q=Ia.$$p,Z=Q||p,T;Q&&(Ia.$$p=null);Q&&(Ia.$$p=null);null==Y&&(Y=p);if(!l(Z))return c(this,"enum_for",["min_by",Y],(T=function(){return(null==T.$$s?this:T.$$s).$enumerator_size()},T.$$s=this,T.$$arity=0,T));if(!l(Y["$nil?"]()))return c(this,"sort_by",[],Z.$to_proc()).$take(Y);var ea,la;this.$each.$$p=function(){var g=G(D,"Opal").$destructure(arguments),C=a.yield1(Z,g);void 0===ea?(ea=g,la=C):0>C["$<=>"](la)&& -(ea=g,la=C)};this.$each();return void 0===ea?p:ea},Ia.$$arity=-1);a.def(e,"$minmax",Ra=function(){var Y=Ra.$$p,Q=Y||p,Z,T=this,ea=p;Y&&(Ra.$$p=null);Y&&(Ra.$$p=null);Q=function(){return l(ea=Q)?ea:c(T,"proc",[],(Z=function(N,aa){null==N&&(N=p);null==aa&&(aa=p);return N["$<=>"](aa)},Z.$$s=T,Z.$$arity=2,Z))}();var la=p,g=p,C=!0;T.$each.$$p=function(){var N=G(D,"Opal").$destructure(arguments);if(C)la=g=N,C=!1;else{var aa=Q.$call(la,N);aa===p?T.$raise(G(D,"ArgumentError"),"comparison failed"):0"](la)&&(ea=g,la=C)};this.$each();return void 0===ea?p:ea},xa.$$arity=-1);a.alias(e,"member?","include?");a.def(e,"$min",Ia=function(Y){var Q=Ia.$$p,Z=Q||p,T,ea=this;Q&&(Ia.$$p= +null);Q&&(Ia.$$p=null);null==Y&&(Y=p);if(!l(Y["$nil?"]()))return Z!==p?c(ea,"sort",[],(T=function(g,C){null==g&&(g=p);null==C&&(C=p);return a.yieldX(Z,[g,C])},T.$$s=ea,T.$$arity=2,T)).$take(Y):ea.$sort().$take(Y);var la;ea.$each.$$p=Z!==p?function(){var g=G(D,"Opal").$destructure(arguments);if(void 0===la)la=g;else{var C=Z(g,la);C===p&&ea.$raise(G(D,"ArgumentError"),"comparison failed");0>C&&(la=g)}}:function(){var g=G(D,"Opal").$destructure(arguments);void 0===la?la=g:0>G(D,"Opal").$compare(g,la)&& +(la=g)};ea.$each();return void 0===la?p:la},Ia.$$arity=-1);a.def(e,"$min_by",Ha=function(Y){var Q=Ha.$$p,Z=Q||p,T;Q&&(Ha.$$p=null);Q&&(Ha.$$p=null);null==Y&&(Y=p);if(!l(Z))return c(this,"enum_for",["min_by",Y],(T=function(){return(null==T.$$s?this:T.$$s).$enumerator_size()},T.$$s=this,T.$$arity=0,T));if(!l(Y["$nil?"]()))return c(this,"sort_by",[],Z.$to_proc()).$take(Y);var ea,la;this.$each.$$p=function(){var g=G(D,"Opal").$destructure(arguments),C=a.yield1(Z,g);void 0===ea?(ea=g,la=C):0>C["$<=>"](la)&& +(ea=g,la=C)};this.$each();return void 0===ea?p:ea},Ha.$$arity=-1);a.def(e,"$minmax",Ra=function(){var Y=Ra.$$p,Q=Y||p,Z,T=this,ea=p;Y&&(Ra.$$p=null);Y&&(Ra.$$p=null);Q=function(){return l(ea=Q)?ea:c(T,"proc",[],(Z=function(N,aa){null==N&&(N=p);null==aa&&(aa=p);return N["$<=>"](aa)},Z.$$s=T,Z.$$arity=2,Z))}();var la=p,g=p,C=!0;T.$each.$$p=function(){var N=G(D,"Opal").$destructure(arguments);if(C)la=g=N,C=!1;else{var aa=Q.$call(la,N);aa===p?T.$raise(G(D,"ArgumentError"),"comparison failed"):0aa&&(g=N)}};T.$each();return[la,g]},Ra.$$arity=0);a.def(e,"$minmax_by",Ta=function(){var Y=Ta.$$p,Q=Y||p,Z;Y&&(Ta.$$p=null);Y&&(Ta.$$p=null);if(!l(Q))return c(this,"enum_for",["minmax_by"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()},Z.$$s=this,Z.$$arity=0,Z));var T=p,ea=p,la,g;this.$each.$$p=function(){var C=G(D,"Opal").$destructure(arguments),N=a.yield1(Q,C);if(void 0===la||0>N["$<=>"](la))T=C,la= N;if(void 0===g||0"](g))ea=C,g=N};this.$each();return[T,ea]},Ta.$$arity=0);a.def(e,"$none?",Ja=function(Y){try{var Q=Ja.$$p,Z=Q||p,T,ea,la;Q&&(Ja.$$p=null);Q&&(Ja.$$p=null);l(void 0!==Y)?c(this,"each",[],(T=function(g){var C=a.slice.call(arguments,0,arguments.length);C=L(C);if(l(c(Y,"public_send",["==="].concat(a.to_a(C)))))a.ret(!1);else return p},T.$$s=this,T.$$arity=-1,T)):Z!==p?c(this,"each",[],(ea=function(g){var C=a.slice.call(arguments,0,arguments.length);if(l(a.yieldX(Z,a.to_a(C))))a.ret(!1); else return p},ea.$$s=this,ea.$$arity=-1,ea)):c(this,"each",[],(la=function(g){var C=a.slice.call(arguments,0,arguments.length);C=G(D,"Opal").$destructure(C);if(l(C))a.ret(!1);else return p},la.$$s=this,la.$$arity=-1,la));return!0}catch(g){if(g===a.returner)return g.$v;throw g;}},Ja.$$arity=-1);a.def(e,"$one?",jb=function(Y){try{var Q=jb.$$p,Z=Q||p,T,ea,la,g=p;Q&&(jb.$$p=null);Q&&(jb.$$p=null);g=0;l(void 0!==Y)?c(this,"each",[],(T=function(C){var N=a.slice.call(arguments,0,arguments.length);N=L(N); @@ -284,31 +284,31 @@ a.def(I,"$each_with_index",b=function(){var f=b.$$p,q=f||z,A,E=z,F=z,M=z;f&&(b.$ ":"+this.method;l(this.args["$any?"]())&&(f=y(f,"("+this.args.$inspect()["$[]"](p(L,"Range").$new(1,-2))+")"));return y(f,">")},h.$$arity=0);(function(f,$super,A){f=u(f,$super,"Generator");var E=[f].concat(A),F,M;f.$$prototype.block=z;f.$include(p(E,"Enumerable"));a.def(f,"$initialize",F=function(){var ba=F.$$p,ua=ba||z;ba&&(F.$$p=null);ba&&(F.$$p=null);l(ua)||this.$raise(p(E,"LocalJumpError"),"no block given");return this.block=ua},F.$$arity=0);return(a.def(f,"$each",M=function(ba){var ua=M.$$p, Pa=ua||z;ua&&(M.$$p=null);ua&&(M.$$p=null);ua=a.slice.call(arguments,0,arguments.length);Pa=c(p(E,"Yielder"),"new",[],Pa.$to_proc());try{ua.unshift(Pa),a.yieldX(this.block,ua)}catch(va){if(va===d)return d.$v;throw va;}return this},M.$$arity=-1),z)&&"each"})(L[0],null,L);(function(f,$super,A){f=u(f,$super,"Yielder");[f].concat(A);var E,F,M;f.$$prototype.block=z;a.def(f,"$initialize",E=function(){var ba=E.$$p,ua=ba||z;ba&&(E.$$p=null);ba&&(E.$$p=null);return this.block=ua},E.$$arity=0);a.def(f,"$yield", F=function(ba){var ua=a.slice.call(arguments,0,arguments.length);ua=a.yieldX(this.block,ua);if(ua===d)throw d;return ua},F.$$arity=-1);return(a.def(f,"$<<",M=function(ba){var ua=a.slice.call(arguments,0,arguments.length);c(this,"yield",a.to_a(ua));return this},M.$$arity=-1),z)&&"<<"})(L[0],null,L);(function(f,$super,A){f=u(f,$super,"Lazy");var E=[f].concat(A),F,M,ba,ua,Pa,va,Da,Ma,na,S,sa,ya,pa;f.$$prototype.enumerator=z;(function(ha,$super,V){[u(ha,$super,"StopLazyError")].concat(V);return z})(E[0], -p(E,"Exception"),E);a.def(f,"$initialize",F=function(ha,H){var V=F.$$p,ka=V||z,wa;V&&(F.$$p=null);V&&(F.$$p=null);null==H&&(H=z);ka===z&&this.$raise(p(E,"ArgumentError"),"tried to call lazy new without a block");this.enumerator=ha;return k(this,a.find_super_dispatcher(this,"initialize",F,!1,!0),"initialize",[H],(wa=function(ia,xa){var Ha=null==wa.$$s?this:wa.$$s,Ia;null==ia&&(ia=z);var Ra=a.slice.call(arguments,1,arguments.length);try{return c(ha,"each",a.to_a(Ra),(Ia=function(Ta){var Ja=a.slice.call(arguments, -0,arguments.length);Ja.unshift(ia);a.yieldX(ka,Ja)},Ia.$$s=Ha,Ia.$$arity=-1,Ia))}catch(Ta){if(a.rescue(Ta,[p(E,"Exception")]))try{return z}finally{a.pop_exception()}else throw Ta;}},wa.$$s=this,wa.$$arity=-2,wa))},F.$$arity=-2);a.alias(f,"force","to_a");a.def(f,"$lazy",M=function(){return this},M.$$arity=0);a.def(f,"$collect",ba=function(){var ha=ba.$$p,H=ha||z,V;ha&&(ba.$$p=null);ha&&(ba.$$p=null);l(H)||this.$raise(p(E,"ArgumentError"),"tried to call lazy map without a block");return c(p(E,"Lazy"), -"new",[this,this.$enumerator_size()],(V=function(ka,wa){null==ka&&(ka=z);var ia=a.slice.call(arguments,1,arguments.length);ia=a.yieldX(H,ia);ka.$yield(ia)},V.$$s=this,V.$$arity=-2,V))},ba.$$arity=0);a.def(f,"$collect_concat",ua=function(){var ha=ua.$$p,H=ha||z,V;ha&&(ua.$$p=null);ha&&(ua.$$p=null);l(H)||this.$raise(p(E,"ArgumentError"),"tried to call lazy map without a block");return c(p(E,"Lazy"),"new",[this,z],(V=function(ka,wa){var ia=null==V.$$s?this:V.$$s,xa,Ha;null==ka&&(ka=z);var Ia=a.slice.call(arguments, -1,arguments.length);Ia=a.yieldX(H,Ia);Ia["$respond_to?"]("force")&&Ia["$respond_to?"]("each")?c(Ia,"each",[],(xa=function(Ra){null==Ra&&(Ra=z);return ka.$yield(Ra)},xa.$$s=ia,xa.$$arity=1,xa)):p(E,"Opal").$try_convert(Ia,p(E,"Array"),"to_ary")===z?ka.$yield(Ia):c(Ia,"each",[],(Ha=function(Ra){null==Ra&&(Ra=z);return ka.$yield(Ra)},Ha.$$s=ia,Ha.$$arity=1,Ha))},V.$$s=this,V.$$arity=-2,V))},ua.$$arity=0);a.def(f,"$drop",Pa=function(ha){var H,V=z,ka=V=z;ha=m(ha,p(E,"Integer"),"to_int");l(J(ha,0))&&this.$raise(p(E, +p(E,"Exception"),E);a.def(f,"$initialize",F=function(ha,H){var V=F.$$p,ka=V||z,wa;V&&(F.$$p=null);V&&(F.$$p=null);null==H&&(H=z);ka===z&&this.$raise(p(E,"ArgumentError"),"tried to call lazy new without a block");this.enumerator=ha;return k(this,a.find_super_dispatcher(this,"initialize",F,!1,!0),"initialize",[H],(wa=function(ia,xa){var Ia=null==wa.$$s?this:wa.$$s,Ha;null==ia&&(ia=z);var Ra=a.slice.call(arguments,1,arguments.length);try{return c(ha,"each",a.to_a(Ra),(Ha=function(Ta){var Ja=a.slice.call(arguments, +0,arguments.length);Ja.unshift(ia);a.yieldX(ka,Ja)},Ha.$$s=Ia,Ha.$$arity=-1,Ha))}catch(Ta){if(a.rescue(Ta,[p(E,"Exception")]))try{return z}finally{a.pop_exception()}else throw Ta;}},wa.$$s=this,wa.$$arity=-2,wa))},F.$$arity=-2);a.alias(f,"force","to_a");a.def(f,"$lazy",M=function(){return this},M.$$arity=0);a.def(f,"$collect",ba=function(){var ha=ba.$$p,H=ha||z,V;ha&&(ba.$$p=null);ha&&(ba.$$p=null);l(H)||this.$raise(p(E,"ArgumentError"),"tried to call lazy map without a block");return c(p(E,"Lazy"), +"new",[this,this.$enumerator_size()],(V=function(ka,wa){null==ka&&(ka=z);var ia=a.slice.call(arguments,1,arguments.length);ia=a.yieldX(H,ia);ka.$yield(ia)},V.$$s=this,V.$$arity=-2,V))},ba.$$arity=0);a.def(f,"$collect_concat",ua=function(){var ha=ua.$$p,H=ha||z,V;ha&&(ua.$$p=null);ha&&(ua.$$p=null);l(H)||this.$raise(p(E,"ArgumentError"),"tried to call lazy map without a block");return c(p(E,"Lazy"),"new",[this,z],(V=function(ka,wa){var ia=null==V.$$s?this:V.$$s,xa,Ia;null==ka&&(ka=z);var Ha=a.slice.call(arguments, +1,arguments.length);Ha=a.yieldX(H,Ha);Ha["$respond_to?"]("force")&&Ha["$respond_to?"]("each")?c(Ha,"each",[],(xa=function(Ra){null==Ra&&(Ra=z);return ka.$yield(Ra)},xa.$$s=ia,xa.$$arity=1,xa)):p(E,"Opal").$try_convert(Ha,p(E,"Array"),"to_ary")===z?ka.$yield(Ha):c(Ha,"each",[],(Ia=function(Ra){null==Ra&&(Ra=z);return ka.$yield(Ra)},Ia.$$s=ia,Ia.$$arity=1,Ia))},V.$$s=this,V.$$arity=-2,V))},ua.$$arity=0);a.def(f,"$drop",Pa=function(ha){var H,V=z,ka=V=z;ha=m(ha,p(E,"Integer"),"to_int");l(J(ha,0))&&this.$raise(p(E, "ArgumentError"),"attempt to drop negative size");V=this.$enumerator_size();V=l(p(E,"Integer")["$==="](V))?l(J(ha,V))?ha:V:V;ka=0;return c(p(E,"Lazy"),"new",[this,V],(H=function(wa,ia){null==wa&&(wa=z);var xa=a.slice.call(arguments,1,arguments.length);return l(J(ka,ha))?ka=y(ka,1):c(wa,"yield",a.to_a(xa))},H.$$s=this,H.$$arity=-2,H))},Pa.$$arity=1);a.def(f,"$drop_while",va=function(){var ha=va.$$p,H=ha||z,V,ka=z;ha&&(va.$$p=null);ha&&(va.$$p=null);l(H)||this.$raise(p(E,"ArgumentError"),"tried to call lazy drop_while without a block"); -ka=!0;return c(p(E,"Lazy"),"new",[this,z],(V=function(wa,ia){null==wa&&(wa=z);var xa=a.slice.call(arguments,1,arguments.length);if(l(ka)){var Ha=a.yieldX(H,xa);x(Ha)&&(ka=!1,c(wa,"yield",a.to_a(xa)))}else return c(wa,"yield",a.to_a(xa))},V.$$s=this,V.$$arity=-2,V))},va.$$arity=0);a.def(f,"$enum_for",Da=function(ha,H){var V=Da.$$p,ka=V||z;V&&(Da.$$p=null);V&&(Da.$$p=null);V=a.slice.call(arguments,0,arguments.length);if(0"},pa.$$arity=0),z)&&"inspect"})(L[0],I,L);return function(f,$super,A){[u(f,$super,"ArithmeticSequence")].concat(A);return z}(L[0],I,L)}(w[0],null,w)}; Opal.modules["corelib/numeric"]=function(a){function y(c,k){return"number"===typeof c&&"number"===typeof k?c-k:c["$-"](k)}function J(c,k){return"number"===typeof c&&"number"===typeof k?c*k:c["$*"](k)}function t(c,k){return"number"===typeof c&&"number"===typeof k?c".split(" ")); -z.$require("corelib/comparable");return function(c,$super,I){c=l(c,$super,"Numeric");var e=[c].concat(I),n,L,D,R,ja,da,ma,b,h,f,q,A,E,F,M,ba,ua,Pa,va,Da,Ma,na,S,sa,ya,pa,ha,H,V,ka,wa,ia,xa,Ha,Ia,Ra,Ta;c.$include(x(e,"Comparable"));a.def(c,"$coerce",n=function(Ja){return m(Ja["$instance_of?"](this.$class()))?[Ja,this]:[this.$Float(Ja),this.$Float(this)]},n.$$arity=1);a.def(c,"$__coerced__",L=function(Ja,jb){if(m(jb["$respond_to?"]("coerce"))){jb=jb.$coerce(this);var kb=a.to_ary(jb);var W=null==kb[0]? +z.$require("corelib/comparable");return function(c,$super,I){c=l(c,$super,"Numeric");var e=[c].concat(I),n,L,D,R,ja,da,ma,b,h,f,q,A,E,F,M,ba,ua,Pa,va,Da,Ma,na,S,sa,ya,pa,ha,H,V,ka,wa,ia,xa,Ia,Ha,Ra,Ta;c.$include(x(e,"Comparable"));a.def(c,"$coerce",n=function(Ja){return m(Ja["$instance_of?"](this.$class()))?[Ja,this]:[this.$Float(Ja),this.$Float(this)]},n.$$arity=1);a.def(c,"$__coerced__",L=function(Ja,jb){if(m(jb["$respond_to?"]("coerce"))){jb=jb.$coerce(this);var kb=a.to_ary(jb);var W=null==kb[0]? d:kb[0];kb=null==kb[1]?d:kb[1];jb;return W.$__send__(Ja,kb)}return"+"["$==="](Ja)||"-"["$==="](Ja)||"*"["$==="](Ja)||"/"["$==="](Ja)||"%"["$==="](Ja)||"&"["$==="](Ja)||"|"["$==="](Ja)||"^"["$==="](Ja)||"**"["$==="](Ja)?this.$raise(x(e,"TypeError"),""+jb.$class()+" can't be coerced into Numeric"):">"["$==="](Ja)||">="["$==="](Ja)||"<"["$==="](Ja)||"<="["$==="](Ja)||"<=>"["$==="](Ja)?this.$raise(x(e,"ArgumentError"),"comparison of "+this.$class()+" with "+jb.$class()+" failed"):d},L.$$arity=2);a.def(c, "$<=>",D=function(Ja){return m(this["$equal?"](Ja))?0:d},D.$$arity=1);a.def(c,"$+@",R=function(){return this},R.$$arity=0);a.def(c,"$-@",ja=function(){return y(0,this)},ja.$$arity=0);a.def(c,"$%",da=function(Ja){return y(this,J(Ja,this.$div(Ja)))},da.$$arity=1);a.def(c,"$abs",ma=function(){return t(this,0)?this["$-@"]():this},ma.$$arity=0);a.def(c,"$abs2",b=function(){return J(this,this)},b.$$arity=0);a.def(c,"$angle",h=function(){return t(this,0)?G(x(e,"Math"),"PI"):0},h.$$arity=0);a.alias(c,"arg", "angle");a.def(c,"$ceil",f=function(Ja){null==Ja&&(Ja=0);return this.$to_f().$ceil(Ja)},f.$$arity=-1);a.def(c,"$conj",q=function(){return this},q.$$arity=0);a.alias(c,"conjugate","conj");a.def(c,"$denominator",A=function(){return this.$to_r().$denominator()},A.$$arity=0);a.def(c,"$div",E=function(Ja){Ja["$=="](0)&&this.$raise(x(e,"ZeroDivisionError"),"divided by o");return w(this,Ja).$floor()},E.$$arity=1);a.def(c,"$divmod",F=function(Ja){return[this.$div(Ja),this["$%"](Ja)]},F.$$arity=1);a.def(c, "$fdiv",M=function(Ja){return w(this.$to_f(),Ja)},M.$$arity=1);a.def(c,"$floor",ba=function(Ja){null==Ja&&(Ja=0);return this.$to_f().$floor(Ja)},ba.$$arity=-1);a.def(c,"$i",ua=function(){return this.$Complex(0,this)},ua.$$arity=0);a.def(c,"$imag",Pa=function(){return 0},Pa.$$arity=0);a.alias(c,"imaginary","imag");a.def(c,"$integer?",va=function(){return!1},va.$$arity=0);a.alias(c,"magnitude","abs");a.alias(c,"modulo","%");a.def(c,"$nonzero?",Da=function(){return m(this["$zero?"]())?d:this},Da.$$arity= 0);a.def(c,"$numerator",Ma=function(){return this.$to_r().$numerator()},Ma.$$arity=0);a.alias(c,"phase","arg");a.def(c,"$polar",na=function(){return[this.$abs(),this.$arg()]},na.$$arity=0);a.def(c,"$quo",S=function(Ja){return w(x(e,"Opal")["$coerce_to!"](this,x(e,"Rational"),"to_r"),Ja)},S.$$arity=1);a.def(c,"$real",sa=function(){return this},sa.$$arity=0);a.def(c,"$real?",ya=function(){return!0},ya.$$arity=0);a.def(c,"$rect",pa=function(){return[this,0]},pa.$$arity=0);a.alias(c,"rectangular","rect"); a.def(c,"$round",ha=function(Ja){return this.$to_f().$round(Ja)},ha.$$arity=-1);a.def(c,"$to_c",H=function(){return this.$Complex(this,0)},H.$$arity=0);a.def(c,"$to_int",V=function(){return this.$to_i()},V.$$arity=0);a.def(c,"$truncate",ka=function(Ja){null==Ja&&(Ja=0);return this.$to_f().$truncate(Ja)},ka.$$arity=-1);a.def(c,"$zero?",wa=function(){return this["$=="](0)},wa.$$arity=0);a.def(c,"$positive?",ia=function(){return"number"===typeof this?0"](0)},ia.$$arity=0);a.def(c,"$negative?", -xa=function(){return t(this,0)},xa.$$arity=0);a.def(c,"$dup",Ha=function(){return this},Ha.$$arity=0);a.def(c,"$clone",Ia=function(Ja){if(null==Ja)u([],{});else if(!Ja.$$is_hash)throw a.ArgumentError.$new("expected kwargs");return this},Ia.$$arity=-1);a.def(c,"$finite?",Ra=function(){return!0},Ra.$$arity=0);return(a.def(c,"$infinite?",Ta=function(){return d},Ta.$$arity=0),d)&&"infinite?"}(p[0],null,p)}; +xa=function(){return t(this,0)},xa.$$arity=0);a.def(c,"$dup",Ia=function(){return this},Ia.$$arity=0);a.def(c,"$clone",Ha=function(Ja){if(null==Ja)u([],{});else if(!Ja.$$is_hash)throw a.ArgumentError.$new("expected kwargs");return this},Ha.$$arity=-1);a.def(c,"$finite?",Ra=function(){return!0},Ra.$$arity=0);return(a.def(c,"$infinite?",Ta=function(){return d},Ta.$$arity=0),d)&&"infinite?"}(p[0],null,p)}; Opal.modules["corelib/array"]=function(a){function y(ja,da){return"number"===typeof ja&&"number"===typeof da?ja>da:ja["$>"](da)}var J=a.top,t=[],w=a.nil,z=a.$$$,p=a.$$,d=a.truthy,G=a.falsy,x=a.hash_ids,l=a.yield1,m=a.hash_get,u=a.hash_put,c=a.hash_delete,k=a.coerce_to,I=a.respond_to,e=a.klass,n=a.hash2,L=a.send2,D=a.send,R=a.gvars;a.add_stubs("$require $include $to_a $warn $raise $replace $respond_to? $to_ary $coerce_to? $=== $join $to_str $class $hash $<=> $== $object_id $inspect $enum_for $bsearch_index $to_proc $nil? $coerce_to! $> $* $enumerator_size $empty? $size $map $equal? $dup $each $[] $dig $eql? $length $exclude_end? $flatten $__id__ $to_s $new $max $min $! $>= $** $delete_if $reverse $rotate $rand $at $keep_if $shuffle! $< $sort $sort_by $!= $times $[]= $- $<< $values $is_a? $last $first $upto $reject $pristine $singleton_class".split(" ")); J.$require("corelib/enumerable");J.$require("corelib/numeric");return function(ja,$super,ma){function b(r,K){return K.$$name===a.Array?r:K.$allocate().$replace(r.$to_a())}function h(r,K,P){for(var ca,fa=null,qa=Array(r.length),Qa=0,fb=0,Za=r.length;Qafa&&(fa+=P,0>fa)||fa>P)return w;if(0>K&&(K+=P,0>K))return[];ca||(K+=1);P=r.slice(fa,K);return b(P,r.$class())}function q(r,K,P){var ca=r.length;K=k(K,a.Integer,"to_int");if(0>K&&(K+=ca,0>K))return w;if(void 0===P)return K>=ca||0>K?w:r[K];P=k(P,a.Integer,"to_int");if(0>P||K>ca||0>K)return w;K=r.slice(K,K+P);return b(K,r.$class())}function A(r,K){return r===K||0===K?1:0K?A(r-1,K-1)+A(r-1,K):0}var E=e(ja,$super,"Array"),F=[E].concat(ma),M,ba,ua,Pa,va,Da,Ma,na, -S,sa,ya,pa,ha,H,V,ka,wa,ia,xa,Ha,Ia,Ra,Ta,Ja,jb,kb,W,za,Ca,Aa,bb,db,ab,Wa,Ba,ta,Na,Sa,Ya,Fa,Y,Q,Z,T,ea,la,g,C,N,aa,v,U,oa,La,ib,ob,mb,sb,tb,wb,xb,ub,X,Oa,cb,B,O,ra,Ga,Ea,Ka,Va,hb,eb,Ua,Xa,gb,qb,nb,pb,Gb,Ab,Jb,Bb,Kb,Cb,Db,Lb,Mb,Eb,Nb,Fb,Ob;E.$include(p(F,"Enumerable"));a.defineProperty(E.$$prototype,"$$is_array",!0);a.defs(E,"$[]",M=function(r){var K=a.slice.call(arguments,0,arguments.length);return b(K,this)},M.$$arity=-1);a.def(E,"$initialize",ba=function(r,K){var P=ba.$$p,ca=P||w;P&&(ba.$$p=null); +S,sa,ya,pa,ha,H,V,ka,wa,ia,xa,Ia,Ha,Ra,Ta,Ja,jb,kb,W,za,Ca,Aa,bb,db,ab,Wa,Ba,ta,Na,Sa,Ya,Fa,Y,Q,Z,T,ea,la,g,C,N,aa,v,U,oa,La,ib,ob,mb,sb,tb,wb,xb,ub,X,Oa,cb,B,O,ra,Ga,Ea,Ka,Va,hb,eb,Ua,Xa,gb,qb,nb,pb,Gb,Ab,Jb,Bb,Kb,Cb,Db,Lb,Mb,Eb,Nb,Fb,Ob;E.$include(p(F,"Enumerable"));a.defineProperty(E.$$prototype,"$$is_array",!0);a.defs(E,"$[]",M=function(r){var K=a.slice.call(arguments,0,arguments.length);return b(K,this)},M.$$arity=-1);a.def(E,"$initialize",ba=function(r,K){var P=ba.$$p,ca=P||w;P&&(ba.$$p=null); P&&(ba.$$p=null);null==r&&(r=w);null==K&&(K=w);K!==w&&ca!==w&&this.$warn("warning: block supersedes default value argument");r>z(p(F,"Integer"),"MAX")&&this.$raise(p(F,"ArgumentError"),"array size too big");2r&&this.$raise(p(F,"ArgumentError"),"negative array size");this.splice(0,this.length);if(ca===w)for(P=0;Pr)&&this.$raise(p(F, @@ -321,7 +321,7 @@ if(r>fa)for(;far&&(r+=this.length);return 0>r||r>=this.length?w:this[r]},ka.$$arity=1);a.def(E,"$bsearch_index",wa=function(){var r=wa.$$p,K=r||w;r&&(wa.$$p=null);r&&(wa.$$p=null);if(K===w)return this.$enum_for("bsearch_index");r=0;for(var P=this.length,ca,fa,qa=!1,Qa=w;rfa}else this.$raise(p(F, "TypeError"),"wrong argument type "+fa.$class()+" (must be numeric, true, false or nil)");qa?P=ca:r=ca+1}return Qa},wa.$$arity=0);a.def(E,"$bsearch",ia=function(){var r=ia.$$p,K=r||w;r&&(ia.$$p=null);r&&(ia.$$p=null);if(K===w)return this.$enum_for("bsearch");r=D(this,"bsearch_index",[],K.$to_proc());return null!=r&&r.$$is_number?this[r]:r},ia.$$arity=0);a.def(E,"$cycle",xa=function(r){var K=xa.$$p,P=K||w,ca,fa=w;K&&(xa.$$p=null);K&&(xa.$$p=null);null==r&&(r=w);if(P===w)return D(this,"enum_for",["cycle", r],(ca=function(){var qa=null==ca.$$s?this:ca.$$s;if(d(r["$nil?"]()))return z(p(F,"Float"),"INFINITY");r=p(F,"Opal")["$coerce_to!"](r,p(F,"Integer"),"to_int");return d(y(r,0))?(qa=qa.$enumerator_size(),"number"===typeof qa&&"number"===typeof r?qa*r:qa["$*"](r)):0},ca.$$s=this,ca.$$arity=0,ca));if(d(d(fa=this["$empty?"]())?fa:r["$=="](0)))return w;if(r===w)for(;;)for(K=0,fa=this.length;K=r)return this;for(;0=m:l["$>="](m)}var J=a.top,t=[],w=a.nil,z=a.$$,p=a.klass,d=a.send,G=a.hash2,x=a.truthy;a.add_stubs("$require $include $coerce_to? $[] $merge! $allocate $raise $coerce_to! $each $fetch $>= $> $== $compare_by_identity $lambda? $abs $arity $enum_for $size $respond_to? $class $dig $new $inspect $map $to_proc $flatten $eql? $default $dup $default_proc $default_proc= $- $default= $to_h $proc".split(" "));J.$require("corelib/enumerable"); -return function(l,$super,u){l=p(l,$super,"Hash");var c=[l].concat(u),k,I,e,n,L,D,R,ja,da,ma,b,h,f,q,A,E,F,M,ba,ua,Pa,va,Da,Ma,na,S,sa,ya,pa,ha,H,V,ka,wa,ia,xa,Ha,Ia,Ra,Ta,Ja,jb,kb,W,za,Ca,Aa,bb,db,ab,Wa,Ba,ta,Na,Sa,Ya,Fa,Y,Q,Z,T,ea;l.$include(z(c,"Enumerable"));l.$$prototype.$$is_hash=!0;a.defs(l,"$[]",k=function(g){var C=a.slice.call(arguments,0,arguments.length);var N=C.length,aa;if(1===N){var v=z(c,"Opal")["$coerce_to?"](C["$[]"](0),z(c,"Hash"),"to_hash");if(v!==w)return this.$allocate()["$merge!"](v); +return function(l,$super,u){l=p(l,$super,"Hash");var c=[l].concat(u),k,I,e,n,L,D,R,ja,da,ma,b,h,f,q,A,E,F,M,ba,ua,Pa,va,Da,Ma,na,S,sa,ya,pa,ha,H,V,ka,wa,ia,xa,Ia,Ha,Ra,Ta,Ja,jb,kb,W,za,Ca,Aa,bb,db,ab,Wa,Ba,ta,Na,Sa,Ya,Fa,Y,Q,Z,T,ea;l.$include(z(c,"Enumerable"));l.$$prototype.$$is_hash=!0;a.defs(l,"$[]",k=function(g){var C=a.slice.call(arguments,0,arguments.length);var N=C.length,aa;if(1===N){var v=z(c,"Opal")["$coerce_to?"](C["$[]"](0),z(c,"Hash"),"to_hash");if(v!==w)return this.$allocate()["$merge!"](v); C=z(c,"Opal")["$coerce_to?"](C["$[]"](0),z(c,"Array"),"to_ary");C===w&&this.$raise(z(c,"ArgumentError"),"odd number of arguments for Hash");N=C.length;v=this.$allocate();for(aa=0;aa=",D=function(g){var C,N=w;g=z(c,"Opal")["$coerce_to!"](g,z(c,"Hash"),"to_hash");if(this.$$keys.length"+oa.$inspect());return"{"+N.join(", ")+"}"}finally{g&&(la=void 0)}},Ia.$$arity=0);a.def(l,"$invert",Ra=function(){for(var g=a.hash(),C=0,N=this.$$keys,aa=N.length,v,U;C"+oa.$inspect());return"{"+N.join(", ")+"}"}finally{g&&(la=void 0)}},Ha.$$arity=0);a.def(l,"$invert",Ra=function(){for(var g=a.hash(),C=0,N=this.$$keys,aa=N.length,v,U;CL:n["$>"](L)}function J(n,L){return"number"===typeof n&&"number"===typeof L?n $** $new $< $to_f $== $nan? $infinite? $enum_for $+ $- $gcd $lcm $% $/ $frexp $to_i $ldexp $rationalize $* $<< $to_r $truncate $-@ $size $<= $>= $<=> $compare $any?".split(" "));d.$require("corelib/numeric");(function(n,$super,D){n=u(n,$super,"Number");var R=[n].concat(D),ja,da,ma,b,h,f,q,A,E,F,M,ba,ua,Pa, -va,Da,Ma,na,S,sa,ya,pa,ha,H,V,ka,wa,ia,xa,Ha,Ia,Ra,Ta,Ja,jb,kb,W,za,Ca,Aa,bb,db,ab,Wa,Ba,ta,Na,Sa,Ya,Fa,Y,Q,Z,T,ea,la,g,C,N,aa,v,U,oa,La,ib,ob,mb,sb,tb,wb,xb,ub;m(R,"Opal").$bridge(Number,n);a.defineProperty(n.$$prototype,"$$is_number",!0);n.$$is_number_class=!0;(function(X,Oa){var cb=[X].concat(Oa),B;a.def(X,"$allocate",B=function(){return this.$raise(m(cb,"TypeError"),"allocator undefined for "+this.$name())},B.$$arity=0);a.udef(X,"$new");return x})(a.get_singleton_class(n),R);a.def(n,"$coerce", +va,Da,Ma,na,S,sa,ya,pa,ha,H,V,ka,wa,ia,xa,Ia,Ha,Ra,Ta,Ja,jb,kb,W,za,Ca,Aa,bb,db,ab,Wa,Ba,ta,Na,Sa,Ya,Fa,Y,Q,Z,T,ea,la,g,C,N,aa,v,U,oa,La,ib,ob,mb,sb,tb,wb,xb,ub;m(R,"Opal").$bridge(Number,n);a.defineProperty(n.$$prototype,"$$is_number",!0);n.$$is_number_class=!0;(function(X,Oa){var cb=[X].concat(Oa),B;a.def(X,"$allocate",B=function(){return this.$raise(m(cb,"TypeError"),"allocator undefined for "+this.$name())},B.$$arity=0);a.udef(X,"$new");return x})(a.get_singleton_class(n),R);a.def(n,"$coerce", ja=function(X){if(X!==x){if(X.$$is_string)return[this.$Float(X),this];if(X["$respond_to?"]("to_f"))return[m(R,"Opal")["$coerce_to!"](X,m(R,"Float"),"to_f"),this];if(X.$$is_number)return[X,this]}this.$raise(m(R,"TypeError"),"can't convert "+X.$class()+" into Float")},ja.$$arity=1);a.def(n,"$__id__",da=function(){return 2*this+1},da.$$arity=0);a.alias(n,"object_id","__id__");a.def(n,"$+",ma=function(X){return X.$$is_number?this+X:this.$__coerced__("+",X)},ma.$$arity=1);a.def(n,"$-",b=function(X){return X.$$is_number? this-X:this.$__coerced__("-",X)},b.$$arity=1);a.def(n,"$*",h=function(X){return X.$$is_number?this*X:this.$__coerced__("*",X)},h.$$arity=1);a.def(n,"$/",f=function(X){return X.$$is_number?this/X:this.$__coerced__("/",X)},f.$$arity=1);a.alias(n,"fdiv","/");a.def(n,"$%",q=function(X){if(X.$$is_number){if(-Infinity==X)return X;if(0==X)this.$raise(m(R,"ZeroDivisionError"),"divided by 0");else return 0>X||0>this?(this%X+X)%X:this%X}else return this.$__coerced__("%",X)},q.$$arity=1);a.def(n,"$&",A=function(X){return X.$$is_number? this&X:this.$__coerced__("&",X)},A.$$arity=1);a.def(n,"$|",E=function(X){return X.$$is_number?this|X:this.$__coerced__("|",X)},E.$$arity=1);a.def(n,"$^",F=function(X){return X.$$is_number?this^X:this.$__coerced__("^",X)},F.$$arity=1);a.def(n,"$<",M=function(X){return X.$$is_number?this",ua=function(X){return X.$$is_number?this>X:this.$__coerced__(">", @@ -417,8 +417,8 @@ X)},ua.$$arity=1);a.def(n,"$>=",Pa=function(X){return X.$$is_number?this>=X:this Ma=function(X){X=m(R,"Opal")["$coerce_to!"](X,m(R,"Integer"),"to_int");return 0>X:this<<-X},Ma.$$arity=1);a.def(n,"$[]",na=function(X){X=m(R,"Opal")["$coerce_to!"](X,m(R,"Integer"),"to_int");return 0>X?0:32<=X?0>this?1:0:this>>X&1},na.$$arity=1);a.def(n,"$+@",S=function(){return+this},S.$$arity=0);a.def(n,"$-@",sa=function(){return-this},sa.$$arity=0);a.def(n,"$~",ya=function(){return~this},ya.$$arity=0);a.def(n,"$**",pa=function(X){var Oa=x,cb=x,B=x;return c(m(R,"Integer")["$==="](X))?c(c(Oa= m(R,"Integer")["$==="](this)["$!"]())?Oa:y(X,0))?Math.pow(this,X):m(R,"Rational").$new(this,1)["$**"](X):c(c(cb=J(this,0))?c(B=m(R,"Float")["$==="](X))?B:m(R,"Rational")["$==="](X):cb)?m(R,"Complex").$new(this,0)["$**"](X.$to_f()):c(null!=X.$$is_number)?Math.pow(this,X):this.$__coerced__("**",X)},pa.$$arity=1);a.def(n,"$===",ha=function(X){return X.$$is_number?this.valueOf()===X.valueOf():X["$respond_to?"]("==")?X["$=="](this):!1},ha.$$arity=1);a.def(n,"$==",H=function(X){return X.$$is_number?this.valueOf()=== X.valueOf():X["$respond_to?"]("==")?X["$=="](this):!1},H.$$arity=1);a.def(n,"$abs",V=function(){return Math.abs(this)},V.$$arity=0);a.def(n,"$abs2",ka=function(){return Math.abs(this*this)},ka.$$arity=0);a.def(n,"$allbits?",wa=function(X){X=m(R,"Opal")["$coerce_to!"](X,m(R,"Integer"),"to_int");return(this&X)==X},wa.$$arity=1);a.def(n,"$anybits?",ia=function(X){X=m(R,"Opal")["$coerce_to!"](X,m(R,"Integer"),"to_int");return 0!==(this&X)},ia.$$arity=1);a.def(n,"$angle",xa=function(){return c(this["$nan?"]())? -this:0==this?0<1/this?0:Math.PI:0>this?Math.PI:0},xa.$$arity=0);a.alias(n,"arg","angle");a.alias(n,"phase","angle");a.def(n,"$bit_length",Ha=function(){c(m(R,"Integer")["$==="](this))||this.$raise(m(R,"NoMethodError").$new("undefined method `bit_length` for "+this+":Float","bit_length"));if(0===this||-1===this)return 0;for(var X=0,Oa=0>this?~this:this;0!=Oa;)X+=1,Oa>>>=1;return X},Ha.$$arity=0);a.def(n,"$ceil",Ia=function(X){null==X&&(X=0);var Oa=this.$to_f();if(0===Oa%1&&0<=X)return Oa;X=Math.pow(10, -X);X=Math.ceil(Oa*X)/X;0===Oa%1&&(X=Math.round(X));return X},Ia.$$arity=-1);a.def(n,"$chr",Ra=function(){return String.fromCharCode(this)},Ra.$$arity=-1);a.def(n,"$denominator",Ta=function(){var X=Ta.$$p,Oa=x,cb;X&&(Ta.$$p=null);var B=0;var O=arguments.length;for(cb=Array(O);Bthis?Math.PI:0},xa.$$arity=0);a.alias(n,"arg","angle");a.alias(n,"phase","angle");a.def(n,"$bit_length",Ia=function(){c(m(R,"Integer")["$==="](this))||this.$raise(m(R,"NoMethodError").$new("undefined method `bit_length` for "+this+":Float","bit_length"));if(0===this||-1===this)return 0;for(var X=0,Oa=0>this?~this:this;0!=Oa;)X+=1,Oa>>>=1;return X},Ia.$$arity=0);a.def(n,"$ceil",Ha=function(X){null==X&&(X=0);var Oa=this.$to_f();if(0===Oa%1&&0<=X)return Oa;X=Math.pow(10, +X);X=Math.ceil(Oa*X)/X;0===Oa%1&&(X=Math.round(X));return X},Ha.$$arity=-1);a.def(n,"$chr",Ra=function(){return String.fromCharCode(this)},Ra.$$arity=-1);a.def(n,"$denominator",Ta=function(){var X=Ta.$$p,Oa=x,cb;X&&(Ta.$$p=null);var B=0;var O=arguments.length;for(cb=Array(O);B=X;Oa--)cb(Oa);return this},Ja.$$arity=1);a.alias(n,"eql?","=="); a.def(n,"$equal?",jb=function(X){var Oa;return c(Oa=this["$=="](X))?Oa:isNaN(this)&&isNaN(X)},jb.$$arity=1);a.def(n,"$even?",kb=function(){return 0===this%2},kb.$$arity=0);a.def(n,"$floor",W=function(X){null==X&&(X=0);var Oa=this.$to_f();if(0===Oa%1&&0<=X)return Oa;X=Math.pow(10,X);X=Math.floor(Oa*X)/X;0===Oa%1&&(X=Math.round(X));return X},W.$$arity=-1);a.def(n,"$gcd",za=function(X){c(m(R,"Integer")["$==="](X))||this.$raise(m(R,"TypeError"),"not an integer");var Oa=Math.abs(this);for(X=Math.abs(X);0< Oa;){var cb=Oa;Oa=X%Oa;X=cb}return X},za.$$arity=1);a.def(n,"$gcdlcm",Ca=function(X){return[this.$gcd(X),this.$lcm(X)]},Ca.$$arity=1);a.def(n,"$integer?",Aa=function(){return 0===this%1},Aa.$$arity=0);a.def(n,"$is_a?",bb=function(X){var Oa=bb.$$p,cb=x,B=x,O=x,ra;Oa&&(bb.$$p=null);var Ga=0;var Ea=arguments.length;for(ra=Array(Ea);Ga $!= $divmod $** $hypot $atan2 $lcm $denominator $finite? $infinite? $numerator $abs $arg $rationalize $to_f $to_i $to_r $inspect $positive? $zero? $Rational".split(" ")); -z.$require("corelib/numeric");(function(c,$super,I){c=l(c,$super,"Complex");var e=[c].concat(I),n,L,D,R,ja,da,ma,b,h,f,q,A,E,F,M,ba,ua,Pa,va,Da,Ma,na,S,sa,ya,pa,ha,H,V,ka,wa;c.$$prototype.real=c.$$prototype.imag=d;a.defs(c,"$rect",n=function(ia,xa){var Ha=d,Ia=d,Ra=d;null==xa&&(xa=0);m(m(Ha=m(Ia=m(Ra=x(e,"Numeric")["$==="](ia))?ia["$real?"]():Ra)?x(e,"Numeric")["$==="](xa):Ia)?xa["$real?"]():Ha)||this.$raise(x(e,"TypeError"),"not a real");return this.$new(ia,xa)},n.$$arity=-2);(function(ia,xa){[ia].concat(xa); -return a.alias(ia,"rectangular","rect")})(a.get_singleton_class(c),e);a.defs(c,"$polar",L=function(ia,xa){var Ha=d,Ia=d,Ra=d;null==xa&&(xa=0);m(m(Ha=m(Ia=m(Ra=x(e,"Numeric")["$==="](ia))?ia["$real?"]():Ra)?x(e,"Numeric")["$==="](xa):Ia)?xa["$real?"]():Ha)||this.$raise(x(e,"TypeError"),"not a real");return this.$new(y(ia,x(e,"Math").$cos(xa)),y(ia,x(e,"Math").$sin(xa)))},L.$$arity=-2);c.$attr_reader("real","imag");a.def(c,"$initialize",D=function(ia,xa){null==xa&&(xa=0);this.real=ia;return this.imag= -xa},D.$$arity=-2);a.def(c,"$coerce",R=function(ia){var xa=d;return m(x(e,"Complex")["$==="](ia))?[ia,this]:m(m(xa=x(e,"Numeric")["$==="](ia))?ia["$real?"]():xa)?[x(e,"Complex").$new(ia,0),this]:this.$raise(x(e,"TypeError"),""+ia.$class()+" can't be coerced into Complex")},R.$$arity=1);a.def(c,"$==",ja=function(ia){var xa=d,Ha=d,Ia=d;return m(x(e,"Complex")["$==="](ia))?m(xa=this.real["$=="](ia.$real()))?this.imag["$=="](ia.$imag()):xa:m(m(Ha=x(e,"Numeric")["$==="](ia))?ia["$real?"]():Ha)?m(Ia=this.real["$=="](ia))? -this.imag["$=="](0):Ia:ia["$=="](this)},ja.$$arity=1);a.def(c,"$-@",da=function(){return this.$Complex(this.real["$-@"](),this.imag["$-@"]())},da.$$arity=0);a.def(c,"$+",ma=function(ia){var xa=d;return m(x(e,"Complex")["$==="](ia))?this.$Complex(J(this.real,ia.$real()),J(this.imag,ia.$imag())):m(m(xa=x(e,"Numeric")["$==="](ia))?ia["$real?"]():xa)?this.$Complex(J(this.real,ia),this.imag):this.$__coerced__("+",ia)},ma.$$arity=1);a.def(c,"$-",b=function(ia){var xa=d;return m(x(e,"Complex")["$==="](ia))? +z.$require("corelib/numeric");(function(c,$super,I){c=l(c,$super,"Complex");var e=[c].concat(I),n,L,D,R,ja,da,ma,b,h,f,q,A,E,F,M,ba,ua,Pa,va,Da,Ma,na,S,sa,ya,pa,ha,H,V,ka,wa;c.$$prototype.real=c.$$prototype.imag=d;a.defs(c,"$rect",n=function(ia,xa){var Ia=d,Ha=d,Ra=d;null==xa&&(xa=0);m(m(Ia=m(Ha=m(Ra=x(e,"Numeric")["$==="](ia))?ia["$real?"]():Ra)?x(e,"Numeric")["$==="](xa):Ha)?xa["$real?"]():Ia)||this.$raise(x(e,"TypeError"),"not a real");return this.$new(ia,xa)},n.$$arity=-2);(function(ia,xa){[ia].concat(xa); +return a.alias(ia,"rectangular","rect")})(a.get_singleton_class(c),e);a.defs(c,"$polar",L=function(ia,xa){var Ia=d,Ha=d,Ra=d;null==xa&&(xa=0);m(m(Ia=m(Ha=m(Ra=x(e,"Numeric")["$==="](ia))?ia["$real?"]():Ra)?x(e,"Numeric")["$==="](xa):Ha)?xa["$real?"]():Ia)||this.$raise(x(e,"TypeError"),"not a real");return this.$new(y(ia,x(e,"Math").$cos(xa)),y(ia,x(e,"Math").$sin(xa)))},L.$$arity=-2);c.$attr_reader("real","imag");a.def(c,"$initialize",D=function(ia,xa){null==xa&&(xa=0);this.real=ia;return this.imag= +xa},D.$$arity=-2);a.def(c,"$coerce",R=function(ia){var xa=d;return m(x(e,"Complex")["$==="](ia))?[ia,this]:m(m(xa=x(e,"Numeric")["$==="](ia))?ia["$real?"]():xa)?[x(e,"Complex").$new(ia,0),this]:this.$raise(x(e,"TypeError"),""+ia.$class()+" can't be coerced into Complex")},R.$$arity=1);a.def(c,"$==",ja=function(ia){var xa=d,Ia=d,Ha=d;return m(x(e,"Complex")["$==="](ia))?m(xa=this.real["$=="](ia.$real()))?this.imag["$=="](ia.$imag()):xa:m(m(Ia=x(e,"Numeric")["$==="](ia))?ia["$real?"]():Ia)?m(Ha=this.real["$=="](ia))? +this.imag["$=="](0):Ha:ia["$=="](this)},ja.$$arity=1);a.def(c,"$-@",da=function(){return this.$Complex(this.real["$-@"](),this.imag["$-@"]())},da.$$arity=0);a.def(c,"$+",ma=function(ia){var xa=d;return m(x(e,"Complex")["$==="](ia))?this.$Complex(J(this.real,ia.$real()),J(this.imag,ia.$imag())):m(m(xa=x(e,"Numeric")["$==="](ia))?ia["$real?"]():xa)?this.$Complex(J(this.real,ia),this.imag):this.$__coerced__("+",ia)},ma.$$arity=1);a.def(c,"$-",b=function(ia){var xa=d;return m(x(e,"Complex")["$==="](ia))? this.$Complex(t(this.real,ia.$real()),t(this.imag,ia.$imag())):m(m(xa=x(e,"Numeric")["$==="](ia))?ia["$real?"]():xa)?this.$Complex(t(this.real,ia),this.imag):this.$__coerced__("-",ia)},b.$$arity=1);a.def(c,"$*",h=function(ia){var xa=d;return m(x(e,"Complex")["$==="](ia))?this.$Complex(t(y(this.real,ia.$real()),y(this.imag,ia.$imag())),J(y(this.real,ia.$imag()),y(this.imag,ia.$real()))):m(m(xa=x(e,"Numeric")["$==="](ia))?ia["$real?"]():xa)?this.$Complex(y(this.real,ia),y(this.imag,ia)):this.$__coerced__("*", -ia)},h.$$arity=1);a.def(c,"$/",f=function(ia){var xa=d,Ha=d,Ia=d,Ra=d,Ta=d,Ja=d,jb=d,kb=d;return m(x(e,"Complex")["$==="](ia))?m(m(xa=m(Ha=m(Ia=m(Ra=x(e,"Number")["$==="](this.real))?this.real["$nan?"]():Ra)?Ia:m(Ta=x(e,"Number")["$==="](this.imag))?this.imag["$nan?"]():Ta)?Ha:m(Ja=x(e,"Number")["$==="](ia.$real()))?ia.$real()["$nan?"]():Ja)?xa:m(jb=x(e,"Number")["$==="](ia.$imag()))?ia.$imag()["$nan?"]():jb)?x(e,"Complex").$new(G(x(e,"Float"),"NAN"),G(x(e,"Float"),"NAN")):w(y(this,ia.$conj()),ia.$abs2()): -m(m(kb=x(e,"Numeric")["$==="](ia))?ia["$real?"]():kb)?this.$Complex(this.real.$quo(ia),this.imag.$quo(ia)):this.$__coerced__("/",ia)},f.$$arity=1);a.def(c,"$**",q=function(ia){var xa=d;if(ia["$=="](0))return x(e,"Complex").$new(1,0);if(m(x(e,"Complex")["$==="](ia))){xa=this.$polar();var Ha=a.to_ary(xa);var Ia=null==Ha[0]?d:Ha[0];Ha=null==Ha[1]?d:Ha[1];xa;xa=ia.$real();var Ra=ia.$imag();ia=x(e,"Math").$exp(t(y(xa,x(e,"Math").$log(Ia)),y(Ra,Ha)));xa=J(y(Ha,xa),y(Ra,x(e,"Math").$log(Ia)));return x(e, -"Complex").$polar(ia,xa)}if(m(x(e,"Integer")["$==="](ia))){if(m("number"===typeof ia?0"](0))){Ha=Ia=this;for(Ra=t(ia,1);m(Ra["$!="](0));){ia=Ra.$divmod(2);xa=a.to_ary(ia);var Ta=null==xa[0]?d:xa[0];var Ja=null==xa[1]?d:xa[1];for(ia;Ja["$=="](0);)Ia=this.$Complex(t(y(Ia.$real(),Ia.$real()),y(Ia.$imag(),Ia.$imag())),y(y(2,Ia.$real()),Ia.$imag())),Ra=Ta,xa=Ra.$divmod(2),ia=a.to_ary(xa),Ta=null==ia[0]?d:ia[0],Ja=null==ia[1]?d:ia[1],xa;Ha=y(Ha,Ia);Ra=t(Ra,1)}return Ha}return w(x(e,"Rational").$new(1, -1),this)["$**"](ia["$-@"]())}return m(m(xa=x(e,"Float")["$==="](ia))?xa:x(e,"Rational")["$==="](ia))?(xa=this.$polar(),Ha=a.to_ary(xa),Ia=null==Ha[0]?d:Ha[0],Ha=null==Ha[1]?d:Ha[1],xa,x(e,"Complex").$polar(Ia["$**"](ia),y(Ha,ia))):this.$__coerced__("**",ia)},q.$$arity=1);a.def(c,"$abs",A=function(){return x(e,"Math").$hypot(this.real,this.imag)},A.$$arity=0);a.def(c,"$abs2",E=function(){return J(y(this.real,this.real),y(this.imag,this.imag))},E.$$arity=0);a.def(c,"$angle",F=function(){return x(e, -"Math").$atan2(this.imag,this.real)},F.$$arity=0);a.alias(c,"arg","angle");a.def(c,"$conj",M=function(){return this.$Complex(this.real,this.imag["$-@"]())},M.$$arity=0);a.alias(c,"conjugate","conj");a.def(c,"$denominator",ba=function(){return this.real.$denominator().$lcm(this.imag.$denominator())},ba.$$arity=0);a.alias(c,"divide","/");a.def(c,"$eql?",ua=function(ia){var xa=d,Ha=d;return m(xa=m(Ha=x(e,"Complex")["$==="](ia))?this.real.$class()["$=="](this.imag.$class()):Ha)?this["$=="](ia):xa},ua.$$arity= +ia)},h.$$arity=1);a.def(c,"$/",f=function(ia){var xa=d,Ia=d,Ha=d,Ra=d,Ta=d,Ja=d,jb=d,kb=d;return m(x(e,"Complex")["$==="](ia))?m(m(xa=m(Ia=m(Ha=m(Ra=x(e,"Number")["$==="](this.real))?this.real["$nan?"]():Ra)?Ha:m(Ta=x(e,"Number")["$==="](this.imag))?this.imag["$nan?"]():Ta)?Ia:m(Ja=x(e,"Number")["$==="](ia.$real()))?ia.$real()["$nan?"]():Ja)?xa:m(jb=x(e,"Number")["$==="](ia.$imag()))?ia.$imag()["$nan?"]():jb)?x(e,"Complex").$new(G(x(e,"Float"),"NAN"),G(x(e,"Float"),"NAN")):w(y(this,ia.$conj()),ia.$abs2()): +m(m(kb=x(e,"Numeric")["$==="](ia))?ia["$real?"]():kb)?this.$Complex(this.real.$quo(ia),this.imag.$quo(ia)):this.$__coerced__("/",ia)},f.$$arity=1);a.def(c,"$**",q=function(ia){var xa=d;if(ia["$=="](0))return x(e,"Complex").$new(1,0);if(m(x(e,"Complex")["$==="](ia))){xa=this.$polar();var Ia=a.to_ary(xa);var Ha=null==Ia[0]?d:Ia[0];Ia=null==Ia[1]?d:Ia[1];xa;xa=ia.$real();var Ra=ia.$imag();ia=x(e,"Math").$exp(t(y(xa,x(e,"Math").$log(Ha)),y(Ra,Ia)));xa=J(y(Ia,xa),y(Ra,x(e,"Math").$log(Ha)));return x(e, +"Complex").$polar(ia,xa)}if(m(x(e,"Integer")["$==="](ia))){if(m("number"===typeof ia?0"](0))){Ia=Ha=this;for(Ra=t(ia,1);m(Ra["$!="](0));){ia=Ra.$divmod(2);xa=a.to_ary(ia);var Ta=null==xa[0]?d:xa[0];var Ja=null==xa[1]?d:xa[1];for(ia;Ja["$=="](0);)Ha=this.$Complex(t(y(Ha.$real(),Ha.$real()),y(Ha.$imag(),Ha.$imag())),y(y(2,Ha.$real()),Ha.$imag())),Ra=Ta,xa=Ra.$divmod(2),ia=a.to_ary(xa),Ta=null==ia[0]?d:ia[0],Ja=null==ia[1]?d:ia[1],xa;Ia=y(Ia,Ha);Ra=t(Ra,1)}return Ia}return w(x(e,"Rational").$new(1, +1),this)["$**"](ia["$-@"]())}return m(m(xa=x(e,"Float")["$==="](ia))?xa:x(e,"Rational")["$==="](ia))?(xa=this.$polar(),Ia=a.to_ary(xa),Ha=null==Ia[0]?d:Ia[0],Ia=null==Ia[1]?d:Ia[1],xa,x(e,"Complex").$polar(Ha["$**"](ia),y(Ia,ia))):this.$__coerced__("**",ia)},q.$$arity=1);a.def(c,"$abs",A=function(){return x(e,"Math").$hypot(this.real,this.imag)},A.$$arity=0);a.def(c,"$abs2",E=function(){return J(y(this.real,this.real),y(this.imag,this.imag))},E.$$arity=0);a.def(c,"$angle",F=function(){return x(e, +"Math").$atan2(this.imag,this.real)},F.$$arity=0);a.alias(c,"arg","angle");a.def(c,"$conj",M=function(){return this.$Complex(this.real,this.imag["$-@"]())},M.$$arity=0);a.alias(c,"conjugate","conj");a.def(c,"$denominator",ba=function(){return this.real.$denominator().$lcm(this.imag.$denominator())},ba.$$arity=0);a.alias(c,"divide","/");a.def(c,"$eql?",ua=function(ia){var xa=d,Ia=d;return m(xa=m(Ia=x(e,"Complex")["$==="](ia))?this.real.$class()["$=="](this.imag.$class()):Ia)?this["$=="](ia):xa},ua.$$arity= 1);a.def(c,"$fdiv",Pa=function(ia){m(x(e,"Numeric")["$==="](ia))||this.$raise(x(e,"TypeError"),""+ia.$class()+" can't be coerced into Complex");return w(this,ia)},Pa.$$arity=1);a.def(c,"$finite?",va=function(){var ia;return m(ia=this.real["$finite?"]())?this.imag["$finite?"]():ia},va.$$arity=0);a.def(c,"$hash",Da=function(){return"Complex:"+this.real+":"+this.imag},Da.$$arity=0);a.alias(c,"imaginary","imag");a.def(c,"$infinite?",Ma=function(){var ia;return m(ia=this.real["$infinite?"]())?ia:this.imag["$infinite?"]()}, Ma.$$arity=0);a.def(c,"$inspect",na=function(){return"("+this+")"},na.$$arity=0);a.alias(c,"magnitude","abs");a.udef(c,"$negative?");a.def(c,"$numerator",S=function(){var ia=this.$denominator();return this.$Complex(y(this.real.$numerator(),w(ia,this.real.$denominator())),y(this.imag.$numerator(),w(ia,this.imag.$denominator())))},S.$$arity=0);a.alias(c,"phase","arg");a.def(c,"$polar",sa=function(){return[this.$abs(),this.$arg()]},sa.$$arity=0);a.udef(c,"$positive?");a.alias(c,"quo","/");a.def(c,"$rationalize", ya=function(ia){1 $- $* $__coerced__ $+ $Rational $> $** $abs $ceil $with_precision $floor $<= $truncate $send $convert".split(" "));p.$require("corelib/numeric");(function(k,$super,e){k=m(k,$super,"Rational");var n=[k].concat(e),L,D,R,ja,da,ma,b,h,f,q,A,E,F,M,ba,ua,Pa,va,Da,Ma,na,S,sa,ya,pa,ha;k.$$prototype.num=k.$$prototype.den=G;a.defs(k,"$reduce",L=function(H,V){H=H.$to_i(); -V=V.$to_i();if(V["$=="](0))this.$raise(l(n,"ZeroDivisionError"),"divided by 0");else if(u(y(V,0)))H=H["$-@"](),V=V["$-@"]();else if(V["$=="](1))return this.$new(H,V);var ka=H.$gcd(V);return this.$new(J(H,ka),J(V,ka))},L.$$arity=2);a.defs(k,"$convert",D=function(H,V){var ka=G,wa=G,ia=G,xa=G,Ha=G,Ia=G,Ra=G,Ta=G;u(u(ka=H["$nil?"]())?ka:V["$nil?"]())&&this.$raise(l(n,"TypeError"),"cannot convert nil into Rational");if(u(u(wa=l(n,"Integer")["$==="](H))?l(n,"Integer")["$==="](V):wa))return this.$reduce(H, -V);u(u(ia=u(xa=l(n,"Float")["$==="](H))?xa:l(n,"String")["$==="](H))?ia:l(n,"Complex")["$==="](H))&&(H=H.$to_r());u(u(Ha=u(Ia=l(n,"Float")["$==="](V))?Ia:l(n,"String")["$==="](V))?Ha:l(n,"Complex")["$==="](V))&&(V=V.$to_r());return u(u(Ra=V["$equal?"](1))?l(n,"Integer")["$==="](H)["$!"]():Ra)?l(n,"Opal")["$coerce_to!"](H,l(n,"Rational"),"to_r"):u(u(Ta=l(n,"Numeric")["$==="](H))?l(n,"Numeric")["$==="](V):Ta)?J(H,V):this.$reduce(H,V)},D.$$arity=2);a.def(k,"$initialize",R=function(H,V){this.num=H;return this.den= +V=V.$to_i();if(V["$=="](0))this.$raise(l(n,"ZeroDivisionError"),"divided by 0");else if(u(y(V,0)))H=H["$-@"](),V=V["$-@"]();else if(V["$=="](1))return this.$new(H,V);var ka=H.$gcd(V);return this.$new(J(H,ka),J(V,ka))},L.$$arity=2);a.defs(k,"$convert",D=function(H,V){var ka=G,wa=G,ia=G,xa=G,Ia=G,Ha=G,Ra=G,Ta=G;u(u(ka=H["$nil?"]())?ka:V["$nil?"]())&&this.$raise(l(n,"TypeError"),"cannot convert nil into Rational");if(u(u(wa=l(n,"Integer")["$==="](H))?l(n,"Integer")["$==="](V):wa))return this.$reduce(H, +V);u(u(ia=u(xa=l(n,"Float")["$==="](H))?xa:l(n,"String")["$==="](H))?ia:l(n,"Complex")["$==="](H))&&(H=H.$to_r());u(u(Ia=u(Ha=l(n,"Float")["$==="](V))?Ha:l(n,"String")["$==="](V))?Ia:l(n,"Complex")["$==="](V))&&(V=V.$to_r());return u(u(Ra=V["$equal?"](1))?l(n,"Integer")["$==="](H)["$!"]():Ra)?l(n,"Opal")["$coerce_to!"](H,l(n,"Rational"),"to_r"):u(u(Ta=l(n,"Numeric")["$==="](H))?l(n,"Numeric")["$==="](V):Ta)?J(H,V):this.$reduce(H,V)},D.$$arity=2);a.def(k,"$initialize",R=function(H,V){this.num=H;return this.den= V},R.$$arity=2);a.def(k,"$numerator",ja=function(){return this.num},ja.$$arity=0);a.def(k,"$denominator",da=function(){return this.den},da.$$arity=0);a.def(k,"$coerce",ma=function(H){return l(n,"Rational")["$==="](H)?[H,this]:l(n,"Integer")["$==="](H)?[H.$to_r(),this]:l(n,"Float")["$==="](H)?[H,this.$to_f()]:G},ma.$$arity=1);a.def(k,"$==",b=function(H){var V=G,ka=G;return l(n,"Rational")["$==="](H)?u(V=this.num["$=="](H.$numerator()))?this.den["$=="](H.$denominator()):V:l(n,"Integer")["$==="](H)? u(ka=this.num["$=="](H))?this.den["$=="](1):ka:l(n,"Float")["$==="](H)?this.$to_f()["$=="](H):H["$=="](this)},b.$$arity=1);a.def(k,"$<=>",h=function(H){return l(n,"Rational")["$==="](H)?t(w(this.num,H.$denominator()),w(this.den,H.$numerator()))["$<=>"](0):l(n,"Integer")["$==="](H)?t(this.num,w(this.den,H))["$<=>"](0):l(n,"Float")["$==="](H)?this.$to_f()["$<=>"](H):this.$__coerced__("<=>",H)},h.$$arity=1);a.def(k,"$+",f=function(H){if(l(n,"Rational")["$==="](H)){var V=z(w(this.num,H.$denominator()), w(this.den,H.$numerator()));H=w(this.den,H.$denominator());V=this.$Rational(V,H)}else V=l(n,"Integer")["$==="](H)?this.$Rational(z(this.num,w(H,this.den)),this.den):l(n,"Float")["$==="](H)?z(this.$to_f(),H):this.$__coerced__("+",H);return V},f.$$arity=1);a.def(k,"$-",q=function(H){if(l(n,"Rational")["$==="](H)){var V=t(w(this.num,H.$denominator()),w(this.den,H.$numerator()));H=w(this.den,H.$denominator());V=this.$Rational(V,H)}else V=l(n,"Integer")["$==="](H)?this.$Rational(t(this.num,w(H,this.den)), @@ -555,8 +555,8 @@ this.den):l(n,"Float")["$==="](H)?t(this.$to_f(),H):this.$__coerced__("-",H);ret w(this.den,H.$numerator());V=this.$Rational(V,H)}else V=l(n,"Integer")["$==="](H)?H["$=="](0)?J(this.$to_f(),0):this.$Rational(this.num,w(this.den,H)):l(n,"Float")["$==="](H)?J(this.$to_f(),H):this.$__coerced__("/",H);return V},E.$$arity=1);a.def(k,"$**",F=function(H){var V=G,ka=G;return l(n,"Integer")["$==="](H)?u(u(V=this["$=="](0))?y(H,0):V)?x(l(n,"Float"),"INFINITY"):u("number"===typeof H?0"](0))?this.$Rational(this.num["$**"](H),this.den["$**"](H)):u(y(H,0))?this.$Rational(this.den["$**"](H["$-@"]()), this.num["$**"](H["$-@"]())):this.$Rational(1,1):l(n,"Float")["$==="](H)?this.$to_f()["$**"](H):l(n,"Rational")["$==="](H)?H["$=="](0)?this.$Rational(1,1):H.$denominator()["$=="](1)?u(y(H,0))?this.$Rational(this.den["$**"](H.$numerator().$abs()),this.num["$**"](H.$numerator().$abs())):this.$Rational(this.num["$**"](H.$numerator()),this.den["$**"](H.$numerator())):u(u(ka=this["$=="](0))?y(H,0):ka)?this.$raise(l(n,"ZeroDivisionError"),"divided by 0"):this.$to_f()["$**"](H):this.$__coerced__("**",H)}, F.$$arity=1);a.def(k,"$abs",M=function(){return this.$Rational(this.num.$abs(),this.den.$abs())},M.$$arity=0);a.def(k,"$ceil",ba=function(H){null==H&&(H=0);return H["$=="](0)?J(this.num["$-@"](),this.den)["$-@"]().$ceil():this.$with_precision("ceil",H)},ba.$$arity=-1);a.alias(k,"divide","/");a.def(k,"$floor",ua=function(H){null==H&&(H=0);return H["$=="](0)?J(this.num["$-@"](),this.den)["$-@"]().$floor():this.$with_precision("floor",H)},ua.$$arity=-1);a.def(k,"$hash",Pa=function(){return"Rational:"+ -this.num+":"+this.den},Pa.$$arity=0);a.def(k,"$inspect",va=function(){return"("+this+")"},va.$$arity=0);a.alias(k,"quo","/");a.def(k,"$rationalize",Da=function(H){1ta||12Na||31Sa||24Ya||59Fa||60Ba&&ta.setFullYear(Ba);return ta},R.$$arity=-1);a.defs(n,"$local",ja=function(Ba,ta,Na,Sa,Ya,Fa,Y,Q,Z,T){null==ta&&(ta=d);null==Na&&(Na=d);null==Sa&&(Sa=d);null==Ya&&(Ya=d);null==Fa&&(Fa=d);null==Y&&(Y=d);null==Q&&(Q=d);null==Z&&(Z=d);null==T&&(T=d);if(10===arguments.length){var ea= x.call(arguments);Ba=ea[5];ta=ea[4];Na=ea[3];Sa=ea[2];Ya=ea[1];Fa=ea[0]}ea=e(Ba,ta,Na,Sa,Ya,Fa);Ba=ea[0];ta=ea[1];Na=ea[2];Sa=ea[3];Ya=ea[4];Fa=ea[5];ea=new Date(Ba,ta,Na,Sa,Ya,0,1E3*Fa);100>Ba&&ea.setFullYear(Ba);return ea},ja.$$arity=-2);a.defs(n,"$gm",da=function(Ba,ta,Na,Sa,Ya,Fa,Y,Q,Z,T){null==ta&&(ta=d);null==Na&&(Na=d);null==Sa&&(Sa=d);null==Ya&&(Ya=d);null==Fa&&(Fa=d);null==Y&&(Y=d);null==Q&&(Q=d);null==Z&&(Z=d);null==T&&(T=d);if(10===arguments.length){var ea=x.call(arguments);Ba=ea[5];ta= @@ -575,20 +575,20 @@ G(L,"Time").$new(this.$year()).$to_i();var ta=G(L,"Time").$new(this.$year(),this return Ba},ba.$$arity=0);a.def(n,"$eql?",ua=function(Ba){var ta;return m(ta=Ba["$is_a?"](G(L,"Time")))?this["$<=>"](Ba)["$zero?"]():ta},ua.$$arity=1);a.def(n,"$friday?",Pa=function(){return 5==this.$wday()},Pa.$$arity=0);a.def(n,"$hash",va=function(){return"Time:"+this.getTime()},va.$$arity=0);a.def(n,"$hour",Da=function(){return this.is_utc?this.getUTCHours():this.getHours()},Da.$$arity=0);a.def(n,"$inspect",Ma=function(){return m(this["$utc?"]())?this.$strftime("%Y-%m-%d %H:%M:%S UTC"):this.$strftime("%Y-%m-%d %H:%M:%S %z")}, Ma.$$arity=0);a.alias(n,"mday","day");a.def(n,"$min",na=function(){return this.is_utc?this.getUTCMinutes():this.getMinutes()},na.$$arity=0);a.def(n,"$mon",S=function(){return(this.is_utc?this.getUTCMonth():this.getMonth())+1},S.$$arity=0);a.def(n,"$monday?",sa=function(){return 1==this.$wday()},sa.$$arity=0);a.alias(n,"month","mon");a.def(n,"$saturday?",ya=function(){return 6==this.$wday()},ya.$$arity=0);a.def(n,"$sec",pa=function(){return this.is_utc?this.getUTCSeconds():this.getSeconds()},pa.$$arity= 0);a.def(n,"$succ",ha=function(){var Ba=new Date(this.getTime()+1E3);Ba.is_utc=this.is_utc;return Ba},ha.$$arity=0);a.def(n,"$usec",H=function(){return 1E3*this.getMilliseconds()},H.$$arity=0);a.def(n,"$zone",V=function(){var Ba=this.toString();var ta=-1==Ba.indexOf("(")?Ba.match(/[A-Z]{3,4}/)[0]:Ba.match(/\((.+)\)(?:\s|$)/)[1];return"GMT"==ta&&/(GMT\W*\d{4})/.test(Ba)?RegExp.$1:ta},V.$$arity=0);a.def(n,"$getgm",ka=function(){var Ba=new Date(this.getTime());Ba.is_utc=!0;return Ba},ka.$$arity=0);a.alias(n, -"getutc","getgm");a.def(n,"$gmtime",wa=function(){this.is_utc=!0;return this},wa.$$arity=0);a.alias(n,"utc","gmtime");a.def(n,"$gmt?",ia=function(){return!0===this.is_utc},ia.$$arity=0);a.def(n,"$gmt_offset",xa=function(){return this.is_utc?0:60*-this.getTimezoneOffset()},xa.$$arity=0);a.def(n,"$strftime",Ha=function(Ba){var ta=this;return Ba.replace(/%([\-_#^0]*:{0,2})(\d+)?([EO]*)(.)/g,function(Na,Sa,Ya,Fa,Y){Fa="";var Q=-1!==Sa.indexOf("0"),Z=-1===Sa.indexOf("-"),T=-1!==Sa.indexOf("_"),ea=-1!== +"getutc","getgm");a.def(n,"$gmtime",wa=function(){this.is_utc=!0;return this},wa.$$arity=0);a.alias(n,"utc","gmtime");a.def(n,"$gmt?",ia=function(){return!0===this.is_utc},ia.$$arity=0);a.def(n,"$gmt_offset",xa=function(){return this.is_utc?0:60*-this.getTimezoneOffset()},xa.$$arity=0);a.def(n,"$strftime",Ia=function(Ba){var ta=this;return Ba.replace(/%([\-_#^0]*:{0,2})(\d+)?([EO]*)(.)/g,function(Na,Sa,Ya,Fa,Y){Fa="";var Q=-1!==Sa.indexOf("0"),Z=-1===Sa.indexOf("-"),T=-1!==Sa.indexOf("_"),ea=-1!== Sa.indexOf("^"),la=-1!==Sa.indexOf("#"),g=(Sa.match(":")||[]).length;Ya=parseInt(Ya,10);Q&&T&&(Sa.indexOf("0")Na?"+":"-")+(10>Sa?"0":"")+Sa;0Y?"0":"";Fa+=Y;1I:k["$>"](I)}function J(k,I){return"number"===typeof k&&"number"===typeof I?k-I:k["$-"](I)}function t(k,I){return"number"===typeof k&&"number"===typeof I?k=I:k["$>="](I)}function z(k,I){return"number"===typeof k&&"number"===typeof I?k+I:k["$+"](I)}var p=a.top,d=[],G=a.nil,x=a.$$,l=a.klass,m=a.hash2,u=a.truthy,c=a.send; a.add_stubs("$require $include $const_name! $unshift $map $coerce_to! $new $each $define_struct_attribute $allocate $initialize $alias_method $module_eval $to_proc $const_set $== $raise $<< $members $define_method $instance_eval $class $last $> $length $- $keys $any? $join $[] $[]= $each_with_index $hash $=== $< $-@ $size $>= $include? $to_sym $instance_of? $__id__ $eql? $enum_for $name $+ $each_pair $inspect $to_h $args $each_with_object $flatten $to_a $respond_to? $dig".split(" "));p.$require("corelib/enumerable"); return function(k,$super,e){k=l(k,$super,"Struct");var n=[k].concat(e),L,D,R,ja,da,ma,b,h,f,q,A,E,F,M,ba,ua,Pa,va,Da,Ma;k.$include(x(n,"Enumerable"));a.defs(k,"$new",L=function(na,S,sa){var ya=L.$$p,pa=ya||G,ha,H;var V=G;ya&&(L.$$p=null);ya&&(L.$$p=null);var ka=a.slice.call(arguments,1,arguments.length);V=a.extract_kwargs(ka);if(null==V)V=m([],{});else if(!V.$$is_hash)throw a.ArgumentError.$new("expected kwargs");ya=V.$$smap.keyword_init;null==ya&&(ya=!1);if(u(na))try{na=x(n,"Opal")["$const_name!"](na)}catch(wa){if(a.rescue(wa, -[x(n,"TypeError"),x(n,"NameError")]))try{ka.$unshift(na),na=G}finally{a.pop_exception()}else throw wa;}c(ka,"map",[],(ha=function(wa){null==wa&&(wa=G);return x(n,"Opal")["$coerce_to!"](wa,x(n,"String"),"to_str")},ha.$$s=this,ha.$$arity=1,ha));V=c(x(n,"Class"),"new",[this],(H=function(){var wa=null==H.$$s?this:H.$$s,ia;c(ka,"each",[],(ia=function(xa){var Ha=null==ia.$$s?this:ia.$$s;null==xa&&(xa=G);return Ha.$define_struct_attribute(xa)},ia.$$s=wa,ia.$$arity=1,ia));return function(xa,Ha){[xa].concat(Ha); -var Ia;a.def(xa,"$new",Ia=function(Ra){var Ta=a.slice.call(arguments,0,arguments.length);var Ja=this.$allocate();Ja.$$data={};c(Ja,"initialize",a.to_a(Ta));return Ja},Ia.$$arity=-1);return xa.$alias_method("[]","new")}(a.get_singleton_class(wa),n)},H.$$s=this,H.$$arity=0,H));u(pa)&&c(V,"module_eval",[],pa.$to_proc());V.$$keyword_init=ya;u(na)&&x(n,"Struct").$const_set(na,V);return V},L.$$arity=-2);a.defs(k,"$define_struct_attribute",D=function(na){var S,sa;this["$=="](x(n,"Struct"))&&this.$raise(x(n, +[x(n,"TypeError"),x(n,"NameError")]))try{ka.$unshift(na),na=G}finally{a.pop_exception()}else throw wa;}c(ka,"map",[],(ha=function(wa){null==wa&&(wa=G);return x(n,"Opal")["$coerce_to!"](wa,x(n,"String"),"to_str")},ha.$$s=this,ha.$$arity=1,ha));V=c(x(n,"Class"),"new",[this],(H=function(){var wa=null==H.$$s?this:H.$$s,ia;c(ka,"each",[],(ia=function(xa){var Ia=null==ia.$$s?this:ia.$$s;null==xa&&(xa=G);return Ia.$define_struct_attribute(xa)},ia.$$s=wa,ia.$$arity=1,ia));return function(xa,Ia){[xa].concat(Ia); +var Ha;a.def(xa,"$new",Ha=function(Ra){var Ta=a.slice.call(arguments,0,arguments.length);var Ja=this.$allocate();Ja.$$data={};c(Ja,"initialize",a.to_a(Ta));return Ja},Ha.$$arity=-1);return xa.$alias_method("[]","new")}(a.get_singleton_class(wa),n)},H.$$s=this,H.$$arity=0,H));u(pa)&&c(V,"module_eval",[],pa.$to_proc());V.$$keyword_init=ya;u(na)&&x(n,"Struct").$const_set(na,V);return V},L.$$arity=-2);a.defs(k,"$define_struct_attribute",D=function(na){var S,sa;this["$=="](x(n,"Struct"))&&this.$raise(x(n, "ArgumentError"),"you cannot define attributes to the Struct class");this.$members()["$<<"](na);c(this,"define_method",[na],(S=function(){return(null==S.$$s?this:S.$$s).$$data[na]},S.$$s=this,S.$$arity=0,S));return c(this,"define_method",[""+na+"="],(sa=function(ya){var pa=null==sa.$$s?this:sa.$$s;null==ya&&(ya=G);return pa.$$data[na]=ya},sa.$$s=this,sa.$$arity=1,sa))},D.$$arity=1);a.defs(k,"$members",R=function(){var na=G;null==this.members&&(this.members=G);this["$=="](x(n,"Struct"))&&this.$raise(x(n, "ArgumentError"),"the Struct class has no members");return this.members=u(na=this.members)?na:[]},R.$$arity=0);a.defs(k,"$inherited",ja=function(na){var S,sa=G;null==this.members&&(this.members=G);sa=this.members;return c(na,"instance_eval",[],(S=function(){return(null==S.$$s?this:S.$$s).members=sa},S.$$s=this,S.$$arity=0,S))},ja.$$arity=1);a.def(k,"$initialize",da=function(na){var S,sa,ya=G,pa=G,ha=G,H=G;var V=a.slice.call(arguments,0,arguments.length);if(u(this.$class().$$keyword_init))return ya= u(pa=V.$last())?pa:m([],{}),u(u(ha=y(V.$length(),1))?ha:1===V.length&&!ya.$$is_hash)&&this.$raise(x(n,"ArgumentError"),"wrong number of arguments (given "+V.$length()+", expected 0)"),H=J(ya.$keys(),this.$class().$members()),u(H["$any?"]())&&this.$raise(x(n,"ArgumentError"),"unknown keywords: "+H.$join(", ")),c(this.$class().$members(),"each",[],(S=function(ka){var wa=null==S.$$s?this:S.$$s;null==ka&&(ka=G);ka=[ka,ya["$[]"](ka)];c(wa,"[]=",a.to_a(ka));return ka[J(ka.length,1)]},S.$$s=this,S.$$arity= @@ -647,7 +647,7 @@ null,z);(function(m,u){m=x(m,"Kernel");[m].concat(u);var c;a.def(m,"$private_met (d(c,"RUBY_ENGINE_VERSION")+"/docs/opal_parser.md for details."))},k.$$arity=-1)})(z[0],z);a.defs(w,"$public",J=function(m){a.slice.call(arguments,0,arguments.length);return p},J.$$arity=-1);return(a.defs(w,"$private",t=function(m){a.slice.call(arguments,0,arguments.length);return p},t.$$arity=-1),p)&&"private"};var rb=Opal.top;Opal.add_stubs(["$require"]);rb.$require("opal/base");rb.$require("opal/mini");rb.$require("corelib/kernel/format");rb.$require("corelib/string/encoding");rb.$require("corelib/math"); rb.$require("corelib/complex");rb.$require("corelib/rational");rb.$require("corelib/time");rb.$require("corelib/struct");rb.$require("corelib/io");rb.$require("corelib/main");rb.$require("corelib/dir");rb.$require("corelib/file");rb.$require("corelib/process");rb.$require("corelib/random");rb.$require("corelib/random/mersenne_twister");rb.$require("corelib/unsupported"); (function(a){function y(u,c){return"number"===typeof u&&"number"===typeof c?u+c:u["$+"](c)}function J(u,c){return"number"===typeof u&&"number"===typeof c?u-c:u["$-"](c)}function t(u,c){return"number"===typeof u&&"number"===typeof c?u $attr_reader $nonzero? $d $zero? $new $class $-@ $+@ $=== $coerce $== $> $+ $allocate $join $compact $map $to_proc $downcase $wrap $raise $clone $jd $>> $wday $year $month $day $- $to_s $to_i $< $* $reverse $step $abs $each".split(" ")); -return function(u,$super,k){function I(W,za){return[31,0===W%4&&0!==W%100||0===W%400?29:28,31,30,31,30,31,31,30,31,30,31][za]}u=G(u,$super,"Date");var e=[u].concat(k),n,L,D,R,ja,da,ma,b,h,f,q,A,E,F,M,ba,ua,Pa,va,Da,Ma,na,S,sa,ya,pa,ha,H,V,ka,wa,ia,xa,Ha,Ia,Ra,Ta,Ja,jb,kb;u.$$prototype.date=z;u.$include(d(e,"Comparable"));(function(W,$super,Ca){W=G(W,$super,"Infinity");var Aa=[W].concat(Ca),bb,db,ab,Wa,Ba,ta,Na,Sa,Ya,Fa,Y;W.$$prototype.d=z;W.$include(d(Aa,"Comparable"));a.def(W,"$initialize",bb=function(Q){null== +return function(u,$super,k){function I(W,za){return[31,0===W%4&&0!==W%100||0===W%400?29:28,31,30,31,30,31,31,30,31,30,31][za]}u=G(u,$super,"Date");var e=[u].concat(k),n,L,D,R,ja,da,ma,b,h,f,q,A,E,F,M,ba,ua,Pa,va,Da,Ma,na,S,sa,ya,pa,ha,H,V,ka,wa,ia,xa,Ia,Ha,Ra,Ta,Ja,jb,kb;u.$$prototype.date=z;u.$include(d(e,"Comparable"));(function(W,$super,Ca){W=G(W,$super,"Infinity");var Aa=[W].concat(Ca),bb,db,ab,Wa,Ba,ta,Na,Sa,Ya,Fa,Y;W.$$prototype.d=z;W.$include(d(Aa,"Comparable"));a.def(W,"$initialize",bb=function(Q){null== Q&&(Q=1);return this.d=Q["$<=>"](0)},bb.$$arity=-1);W.$attr_reader("d");a.def(W,"$zero?",db=function(){return!1},db.$$arity=0);a.def(W,"$finite?",ab=function(){return!1},ab.$$arity=0);a.def(W,"$infinite?",Wa=function(){return this.$d()["$nonzero?"]()},Wa.$$arity=0);a.def(W,"$nan?",Ba=function(){return this.$d()["$zero?"]()},Ba.$$arity=0);a.def(W,"$abs",ta=function(){return this.$class().$new()},ta.$$arity=0);a.def(W,"$-@",Na=function(){return this.$class().$new(this.$d()["$-@"]())},Na.$$arity=0); a.def(W,"$+@",Sa=function(){return this.$class().$new(this.$d()["$+@"]())},Sa.$$arity=0);a.def(W,"$<=>",Ya=function(Q){var Z,T,ea=this,la=z,g=z,C=z;return function(){la=Q;if(d(Aa,"Infinity")["$==="](la))return ea.$d()["$<=>"](Q.$d());if(d(Aa,"Numeric")["$==="](la))return ea.$d();try{return T=Q.$coerce(ea),Z=a.to_ary(T),g=null==Z[0]?z:Z[0],C=null==Z[1]?z:Z[1],T,g["$<=>"](C)}catch(N){if(a.rescue(N,[d(Aa,"NoMethodError")]))try{return z}finally{a.pop_exception()}else throw N;}}()},Ya.$$arity=1);a.def(W, "$coerce",Fa=function(Q){var Z=Fa.$$p,T;Z&&(Fa.$$p=null);var ea=0;var la=arguments.length;for(T=Array(la);ea"](0);return l(Q)?p(d(Aa,"Float"),"INFINITY"):p(d(Aa,"Float"),"INFINITY")["$-@"]()},Y.$$arity=0),z)&&"to_f"})(e[0], @@ -668,7 +668,7 @@ Ca.setDate(1);Ca.setMonth(Ca.getMonth()+W);Ca.setDate(Math.min(Aa,I(Ca.getFullYe I(Ca.getFullYear(),Ca.getMonth())));return za},S.$$arity=-1);a.def(u,"$prev_year",sa=function(W){null==W&&(W=1);return this.$class().$new(J(this.$year(),W),this.$month(),this.$day())},sa.$$arity=-1);a.def(u,"$saturday?",ya=function(){return this.$wday()["$=="](6)},ya.$$arity=0);a.def(u,"$strftime",pa=function(W){null==W&&(W="");return""==W?this.$to_s():this.date.$strftime(W)},pa.$$arity=-1);a.alias(u,"succ","next");a.def(u,"$sunday?",ha=function(){return this.$wday()["$=="](0)},ha.$$arity=0);a.def(u, "$thursday?",H=function(){return this.$wday()["$=="](4)},H.$$arity=0);a.def(u,"$to_s",V=function(){var W=this.date,za=W.getFullYear(),Ca=W.getMonth()+1;W=W.getDate();10>Ca&&(Ca="0"+Ca);10>W&&(W="0"+W);return za+"-"+Ca+"-"+W},V.$$arity=0);a.def(u,"$to_time",ka=function(){return d(e,"Time").$new(this.$year(),this.$month(),this.$day())},ka.$$arity=0);a.def(u,"$to_n",wa=function(){return this.date},wa.$$arity=0);a.def(u,"$tuesday?",ia=function(){return this.$wday()["$=="](2)},ia.$$arity=0);a.def(u,"$step", xa=function(W,za){var Ca=xa.$$p,Aa=Ca||z,bb,db,ab=z;ab=ab=z;Ca&&(xa.$$p=null);Ca&&(xa.$$p=null);null==za&&(za=1);ab=J(W,this).$to_i();ab=l(t("number"===typeof ab&&"number"===typeof za?ab*za:ab["$*"](za),0))?[]:l(t(ab,0))?m(a.Range.$new(0,ab["$-@"](),!1).$step(za.$abs()),"map",[],"-@".$to_proc()).$reverse():a.Range.$new(0,ab,!1).$step(za.$abs());ab=m(ab,"map",[],(bb=function(Wa){var Ba=null==bb.$$s?this:bb.$$s;null==Wa&&(Wa=z);return y(Ba,Wa)},bb.$$s=this,bb.$$arity=1,bb));return Aa!==z?(m(ab,"each", -[],(db=function(Wa){null==Wa&&(Wa=z);return a.yield1(Aa,Wa)},db.$$s=this,db.$$arity=1,db)),this):ab},xa.$$arity=-2);a.def(u,"$upto",Ha=function(W){var za=Ha.$$p,Ca=za||z;za&&(Ha.$$p=null);za&&(Ha.$$p=null);return m(this,"step",[W,1],Ca.$to_proc())},Ha.$$arity=1);a.def(u,"$downto",Ia=function(W){var za=Ia.$$p,Ca=za||z;za&&(Ia.$$p=null);za&&(Ia.$$p=null);return m(this,"step",[W,-1],Ca.$to_proc())},Ia.$$arity=1);a.def(u,"$wday",Ra=function(){return this.date.getDay()},Ra.$$arity=0);a.def(u,"$wednesday?", +[],(db=function(Wa){null==Wa&&(Wa=z);return a.yield1(Aa,Wa)},db.$$s=this,db.$$arity=1,db)),this):ab},xa.$$arity=-2);a.def(u,"$upto",Ia=function(W){var za=Ia.$$p,Ca=za||z;za&&(Ia.$$p=null);za&&(Ia.$$p=null);return m(this,"step",[W,1],Ca.$to_proc())},Ia.$$arity=1);a.def(u,"$downto",Ha=function(W){var za=Ha.$$p,Ca=za||z;za&&(Ha.$$p=null);za&&(Ha.$$p=null);return m(this,"step",[W,-1],Ca.$to_proc())},Ha.$$arity=1);a.def(u,"$wday",Ra=function(){return this.date.getDay()},Ra.$$arity=0);a.def(u,"$wednesday?", Ta=function(){return this.$wday()["$=="](3)},Ta.$$arity=0);a.def(u,"$year",Ja=function(){return this.date.getFullYear()},Ja.$$arity=0);a.def(u,"$cwday",jb=function(){return this.date.getDay()||7},jb.$$arity=0);a.def(u,"$cweek",kb=function(){var W=new Date(this.date);W.setHours(0,0,0);W.setDate(W.getDate()+4-(W.getDay()||7));return Math.ceil(((W-new Date(W.getFullYear(),0,1))/864E5+1)/7)},kb.$$arity=0)}(w[0],null,w)})(Opal); (function(a){function y(m,u){return"number"===typeof m&&"number"===typeof u?m-u:m["$-"](u)}var J=[],t=a.nil,w=a.$$$,z=a.$$,p=a.module,d=a.klass,G=a.send,x=a.hash2,l=a.truthy;a.add_stubs("$raise $new $push $[]= $- $[] $create_id $json_create $const_get $attr_accessor $create_id= $=== $parse $generate $from_object $merge $to_json $responds_to? $to_io $write $to_s $to_a $strftime".split(" "));(function(m,u){function c(f){try{return JSON.parse(f)}catch(q){I.$raise(w(z(e,"JSON"),"ParserError"),q.message)}} function k(f,q){var A;switch(typeof f){case "string":return f;case "number":return f;case "boolean":return!!f;case "null":return t;case "object":if(!f)return t;if(f.$$is_array){var E=q.array_class.$new();var F=0;for(A=f.length;F $attr_reader $nonzero? $d $zero? $new $class $-@ $+@ $=== $coerce $== $> $+ $allocate $join $compact $map $to_proc $downcase $wrap $raise $clone $jd $>> $wday $year $month $day $- $to_s $to_i $< $* $reverse $step $abs $each".split(" ")); -return function(u,$super,k){function I(W,za){return[31,0===W%4&&0!==W%100||0===W%400?29:28,31,30,31,30,31,31,30,31,30,31][za]}u=G(u,$super,"Date");var e=[u].concat(k),n,L,D,R,ja,da,ma,b,h,f,q,A,E,F,M,ba,ua,Pa,va,Da,Ma,na,S,sa,ya,pa,ha,H,V,ka,wa,ia,xa,Ha,Ia,Ra,Ta,Ja,jb,kb;u.$$prototype.date=z;u.$include(d(e,"Comparable"));(function(W,$super,Ca){W=G(W,$super,"Infinity");var Aa=[W].concat(Ca),bb,db,ab,Wa,Ba,ta,Na,Sa,Ya,Fa,Y;W.$$prototype.d=z;W.$include(d(Aa,"Comparable"));a.def(W,"$initialize",bb=function(Q){null== +return function(u,$super,k){function I(W,za){return[31,0===W%4&&0!==W%100||0===W%400?29:28,31,30,31,30,31,31,30,31,30,31][za]}u=G(u,$super,"Date");var e=[u].concat(k),n,L,D,R,ja,da,ma,b,h,f,q,A,E,F,M,ba,ua,Pa,va,Da,Ma,na,S,sa,ya,pa,ha,H,V,ka,wa,ia,xa,Ia,Ha,Ra,Ta,Ja,jb,kb;u.$$prototype.date=z;u.$include(d(e,"Comparable"));(function(W,$super,Ca){W=G(W,$super,"Infinity");var Aa=[W].concat(Ca),bb,db,ab,Wa,Ba,ta,Na,Sa,Ya,Fa,Y;W.$$prototype.d=z;W.$include(d(Aa,"Comparable"));a.def(W,"$initialize",bb=function(Q){null== Q&&(Q=1);return this.d=Q["$<=>"](0)},bb.$$arity=-1);W.$attr_reader("d");a.def(W,"$zero?",db=function(){return!1},db.$$arity=0);a.def(W,"$finite?",ab=function(){return!1},ab.$$arity=0);a.def(W,"$infinite?",Wa=function(){return this.$d()["$nonzero?"]()},Wa.$$arity=0);a.def(W,"$nan?",Ba=function(){return this.$d()["$zero?"]()},Ba.$$arity=0);a.def(W,"$abs",ta=function(){return this.$class().$new()},ta.$$arity=0);a.def(W,"$-@",Na=function(){return this.$class().$new(this.$d()["$-@"]())},Na.$$arity=0); a.def(W,"$+@",Sa=function(){return this.$class().$new(this.$d()["$+@"]())},Sa.$$arity=0);a.def(W,"$<=>",Ya=function(Q){var Z,T,ea=this,la=z,g=z,C=z;return function(){la=Q;if(d(Aa,"Infinity")["$==="](la))return ea.$d()["$<=>"](Q.$d());if(d(Aa,"Numeric")["$==="](la))return ea.$d();try{return T=Q.$coerce(ea),Z=a.to_ary(T),g=null==Z[0]?z:Z[0],C=null==Z[1]?z:Z[1],T,g["$<=>"](C)}catch(N){if(a.rescue(N,[d(Aa,"NoMethodError")]))try{return z}finally{a.pop_exception()}else throw N;}}()},Ya.$$arity=1);a.def(W, "$coerce",Fa=function(Q){var Z=Fa.$$p,T;Z&&(Fa.$$p=null);var ea=0;var la=arguments.length;for(T=Array(la);ea"](0);return l(Q)?p(d(Aa,"Float"),"INFINITY"):p(d(Aa,"Float"),"INFINITY")["$-@"]()},Y.$$arity=0),z)&&"to_f"})(e[0], @@ -710,23 +710,23 @@ Ca.setDate(1);Ca.setMonth(Ca.getMonth()+W);Ca.setDate(Math.min(Aa,I(Ca.getFullYe I(Ca.getFullYear(),Ca.getMonth())));return za},S.$$arity=-1);a.def(u,"$prev_year",sa=function(W){null==W&&(W=1);return this.$class().$new(J(this.$year(),W),this.$month(),this.$day())},sa.$$arity=-1);a.def(u,"$saturday?",ya=function(){return this.$wday()["$=="](6)},ya.$$arity=0);a.def(u,"$strftime",pa=function(W){null==W&&(W="");return""==W?this.$to_s():this.date.$strftime(W)},pa.$$arity=-1);a.alias(u,"succ","next");a.def(u,"$sunday?",ha=function(){return this.$wday()["$=="](0)},ha.$$arity=0);a.def(u, "$thursday?",H=function(){return this.$wday()["$=="](4)},H.$$arity=0);a.def(u,"$to_s",V=function(){var W=this.date,za=W.getFullYear(),Ca=W.getMonth()+1;W=W.getDate();10>Ca&&(Ca="0"+Ca);10>W&&(W="0"+W);return za+"-"+Ca+"-"+W},V.$$arity=0);a.def(u,"$to_time",ka=function(){return d(e,"Time").$new(this.$year(),this.$month(),this.$day())},ka.$$arity=0);a.def(u,"$to_n",wa=function(){return this.date},wa.$$arity=0);a.def(u,"$tuesday?",ia=function(){return this.$wday()["$=="](2)},ia.$$arity=0);a.def(u,"$step", xa=function(W,za){var Ca=xa.$$p,Aa=Ca||z,bb,db,ab=z;ab=ab=z;Ca&&(xa.$$p=null);Ca&&(xa.$$p=null);null==za&&(za=1);ab=J(W,this).$to_i();ab=l(t("number"===typeof ab&&"number"===typeof za?ab*za:ab["$*"](za),0))?[]:l(t(ab,0))?m(a.Range.$new(0,ab["$-@"](),!1).$step(za.$abs()),"map",[],"-@".$to_proc()).$reverse():a.Range.$new(0,ab,!1).$step(za.$abs());ab=m(ab,"map",[],(bb=function(Wa){var Ba=null==bb.$$s?this:bb.$$s;null==Wa&&(Wa=z);return y(Ba,Wa)},bb.$$s=this,bb.$$arity=1,bb));return Aa!==z?(m(ab,"each", -[],(db=function(Wa){null==Wa&&(Wa=z);return a.yield1(Aa,Wa)},db.$$s=this,db.$$arity=1,db)),this):ab},xa.$$arity=-2);a.def(u,"$upto",Ha=function(W){var za=Ha.$$p,Ca=za||z;za&&(Ha.$$p=null);za&&(Ha.$$p=null);return m(this,"step",[W,1],Ca.$to_proc())},Ha.$$arity=1);a.def(u,"$downto",Ia=function(W){var za=Ia.$$p,Ca=za||z;za&&(Ia.$$p=null);za&&(Ia.$$p=null);return m(this,"step",[W,-1],Ca.$to_proc())},Ia.$$arity=1);a.def(u,"$wday",Ra=function(){return this.date.getDay()},Ra.$$arity=0);a.def(u,"$wednesday?", +[],(db=function(Wa){null==Wa&&(Wa=z);return a.yield1(Aa,Wa)},db.$$s=this,db.$$arity=1,db)),this):ab},xa.$$arity=-2);a.def(u,"$upto",Ia=function(W){var za=Ia.$$p,Ca=za||z;za&&(Ia.$$p=null);za&&(Ia.$$p=null);return m(this,"step",[W,1],Ca.$to_proc())},Ia.$$arity=1);a.def(u,"$downto",Ha=function(W){var za=Ha.$$p,Ca=za||z;za&&(Ha.$$p=null);za&&(Ha.$$p=null);return m(this,"step",[W,-1],Ca.$to_proc())},Ha.$$arity=1);a.def(u,"$wday",Ra=function(){return this.date.getDay()},Ra.$$arity=0);a.def(u,"$wednesday?", Ta=function(){return this.$wday()["$=="](3)},Ta.$$arity=0);a.def(u,"$year",Ja=function(){return this.date.getFullYear()},Ja.$$arity=0);a.def(u,"$cwday",jb=function(){return this.date.getDay()||7},jb.$$arity=0);a.def(u,"$cweek",kb=function(){var W=new Date(this.date);W.setHours(0,0,0);W.setDate(W.getDate()+4-(W.getDay()||7));return Math.ceil(((W-new Date(W.getFullYear(),0,1))/864E5+1)/7)},kb.$$arity=0)}(w[0],null,w)}; (function(a){function y(I,e){return"number"===typeof I&&"number"===typeof e?I+e:I["$+"](e)}function J(I,e){return"number"===typeof I&&"number"===typeof e?I>e:I["$>"](e)}function t(I,e){return"number"===typeof I&&"number"===typeof e?I $length $change_state $to_i $list $< $set_priority $due_date $append $rename $!= $delete $add_note $delete_note $show $puts $usage $start_repl $cleanup $colorize $private $map $each_with_index $keys $== $select $parse $strftime $today $downcase $lambda $match $! $each $split $strip $chomp $[]= $- $has_key? $sort $generate $gsub $convert_due_date $postprocess_tags $load_tasks $call $write_tasks $update_task $push $max $size $to_s $& $sort_by $filter_tasks $start_with? $abs $rjust $kind_of? $execute $to_a $each_key $uniq $all? $index $new".split(" ")); z.$require("json");z.$require("date");(function(I,$super,n){I=l(I,$super,"Todo");var L=[I].concat(n),D,R,ja,da,ma,b,h,f,q,A,E,F,M,ba,ua,Pa,va,Da,Ma,na,S,sa,ya;I.$$prototype.queries=I.$$prototype.today=I.$$prototype.due_date_days=d;a.const_set(L[0],"COLOR_CODES",m("black red green yellow blue magenta cyan white".split(" "),{black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37}));a.const_set(L[0],"STATES",m(["new","done","started","blocked","default"],{"new":"[ ]",done:"[x]",started:"[>]", blocked:"[!]","default":"[?]"}));a.const_set(L[0],"ORDER",m(["new","done","started","blocked","default"],{"new":3,done:4,started:2,blocked:1,"default":100}));a.const_set(L[0],"COLORS",m(["new","done","started","blocked","default"],{"new":"white",done:"blue",started:"green",blocked:"yellow","default":"magenta"}));a.const_set(L[0],"DATE_FORMAT","%Y-%m-%d");a.const_set(L[0],"DATE_PATTERN",/^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/);a.const_set(L[0],"DUE_DATE_DAYS_SIMPLE",["today","tomorrow"]); -a.const_set(L[0],"DUE_DATE_TAG_PATTERN",/(^| )due:([a-zA-Z0-9-]+)/);a.const_set(L[0],"CONTEXT_TAG_PATTERN",/(^| )[@+][\w-]+/);a.const_set(L[0],"PRIORITY_FLAG","*");a.const_set(L[0],"TODO_FILE",require("path").join(require("os").homedir(),"todo.jsonl"));a.def(I,"$execute",D=function(pa){var ha=d,H=d,V=d,ka=d,wa=d,ia=d,xa=d,Ha=d,Ia=d,Ra=d,Ta=d,Ja=d;try{this.$setup(),ha=pa.$first(),H=u(V=pa["$[]"](c(1,-1,!1)))?V:[],ka=ha,"add"["$==="](ka)?(u(u(wa=H["$nil?"]())?wa:H["$empty?"]())&&this.$raise(y(ha," command requires at least one parameter")), -this.$add(H.$join(" "))):"start"["$==="](ka)?u(J(H.$length(),0))?this.$change_state(H.$first().$to_i(),"started",(u(ia=H["$[]"](c(1,-1,!1)))?ia:[]).$join(" ")):this.$list(d,[":started"]):"done"["$==="](ka)?u(J(H.$length(),0))?this.$change_state(H.$first().$to_i(),"done",(u(xa=H["$[]"](c(1,-1,!1)))?xa:[]).$join(" ")):this.$list(d,[":done"]):"block"["$==="](ka)?u(J(H.$length(),0))?this.$change_state(H.$first().$to_i(),"blocked",(u(Ha=H["$[]"](c(1,-1,!1)))?Ha:[]).$join(" ")):this.$list(d,[":blocked"]): -"reset"["$==="](ka)?u(J(H.$length(),0))?this.$change_state(H.$first().$to_i(),"new",(u(Ia=H["$[]"](c(1,-1,!1)))?Ia:[]).$join(" ")):this.$list(d,[":new"]):"prio"["$==="](ka)?(u(t(H.$length(),1))&&this.$raise(y(ha," command requires at least one parameter")),this.$set_priority(H.$first().$to_i(),(u(Ra=H["$[]"](c(1,-1,!1)))?Ra:[]).$join(" "))):"due"["$==="](ka)?(u(t(H.$length(),1))&&this.$raise(y(ha," command requires at least one parameter")),this.$due_date(H.$first().$to_i(),(u(Ta=H["$[]"](c(1,-1, +a.const_set(L[0],"DUE_DATE_TAG_PATTERN",/(^| )due:([a-zA-Z0-9-]+)/);a.const_set(L[0],"CONTEXT_TAG_PATTERN",/(^| )[@+][\w-]+/);a.const_set(L[0],"PRIORITY_FLAG","*");a.const_set(L[0],"TODO_FILE",require("path").join(require("os").homedir(),"todo.jsonl"));a.def(I,"$execute",D=function(pa){var ha=d,H=d,V=d,ka=d,wa=d,ia=d,xa=d,Ia=d,Ha=d,Ra=d,Ta=d,Ja=d;try{this.$setup(),ha=pa.$first(),H=u(V=pa["$[]"](c(1,-1,!1)))?V:[],ka=ha,"add"["$==="](ka)?(u(u(wa=H["$nil?"]())?wa:H["$empty?"]())&&this.$raise(y(ha," command requires at least one parameter")), +this.$add(H.$join(" "))):"start"["$==="](ka)?u(J(H.$length(),0))?this.$change_state(H.$first().$to_i(),"started",(u(ia=H["$[]"](c(1,-1,!1)))?ia:[]).$join(" ")):this.$list(d,[":started"]):"done"["$==="](ka)?u(J(H.$length(),0))?this.$change_state(H.$first().$to_i(),"done",(u(xa=H["$[]"](c(1,-1,!1)))?xa:[]).$join(" ")):this.$list(d,[":done"]):"block"["$==="](ka)?u(J(H.$length(),0))?this.$change_state(H.$first().$to_i(),"blocked",(u(Ia=H["$[]"](c(1,-1,!1)))?Ia:[]).$join(" ")):this.$list(d,[":blocked"]): +"reset"["$==="](ka)?u(J(H.$length(),0))?this.$change_state(H.$first().$to_i(),"new",(u(Ha=H["$[]"](c(1,-1,!1)))?Ha:[]).$join(" ")):this.$list(d,[":new"]):"prio"["$==="](ka)?(u(t(H.$length(),1))&&this.$raise(y(ha," command requires at least one parameter")),this.$set_priority(H.$first().$to_i(),(u(Ra=H["$[]"](c(1,-1,!1)))?Ra:[]).$join(" "))):"due"["$==="](ka)?(u(t(H.$length(),1))&&this.$raise(y(ha," command requires at least one parameter")),this.$due_date(H.$first().$to_i(),(u(Ta=H["$[]"](c(1,-1, !1)))?Ta:[]).$join(" "))):"append"["$==="](ka)?(u(t(H.$length(),2))&&this.$raise(y(ha," command requires at least two parameters")),this.$append(H.$first().$to_i(),H["$[]"](c(1,-1,!1)).$join(" "))):"rename"["$==="](ka)?(u(t(H.$length(),2))&&this.$raise(y(ha," command requires at least two parameters")),this.$rename(H.$first().$to_i(),H["$[]"](c(1,-1,!1)).$join(" "))):"del"["$==="](ka)?(u(H.$length()["$!="](1))&&this.$raise(y(ha," command requires exactly one parameter")),this.$delete(H.$first().$to_i())): "note"["$==="](ka)?(u(t(H.$length(),2))&&this.$raise(y(ha," command requires at least two parameters")),this.$add_note(H.$first().$to_i(),H["$[]"](c(1,-1,!1)).$join(" "))):"delnote"["$==="](ka)?(u(H.$length()["$!="](1))&&this.$raise(y(ha," command requires exactly one parameter")),this.$delete_note(H.$first().$to_i())):"list"["$==="](ka)?this.$list(d,H):"show"["$==="](ka)?(u(H.$length()["$!="](1))&&this.$raise(y(ha," command requires exactly one parameter")),this.$show(H.$first().$to_i())):"help"["$==="](ka)? (u(J(H.$length(),0))&&this.$raise(y(ha," command has no parameters")),this.$puts(this.$usage())):"repl"["$==="](ka)?(u(J(H.$length(),0))&&this.$raise(y(ha," command has no parameters")),this.$start_repl()):"cleanup"["$==="](ka)?(u(u(Ja=H["$nil?"]())?Ja:H["$empty?"]())&&this.$raise(y(ha," command requires at least one parameter")),this.$cleanup(H)):this.$list(d,pa)}catch(jb){if(a.rescue(jb,[G(x(L,"JS"),"Error"),x(L,"StandardError")])){pa=jb;try{this.$puts(""+this.$colorize("ERROR:","red")+" "+pa)}finally{a.pop_exception()}}else throw jb; }return this},D.$$arity=1);I.$private();a.def(I,"$usage",R=function(){var pa,ha,H;return"Usage: todo \n\nCommands:\n* add add new task\n* start [text] mark task as started, with optional note\n* done [text] mark task as completed, with optional note\n* block [text] mark task as blocked, with optional note\n* reset [text] reset task to new state, with optional note\n* prio [text] toggle high priority flag, with optional note\n* due [date] set/unset due date (in YYYY-MM-DD format)\n\n* append append text to task title\n* rename rename task\n* del delete task\n* note add note to task\n* delnote delete all notes from task\n\n* list [regex...] list tasks (only active tasks by default)\n* show show all task details\n* repl enter read-eval-print loop mode\n* cleanup [regex...] cleanup completed tasks by regex\n* help this help screen\n\nWith list command the following pre-defined queries can be also used:\n"+ k(this.queries.$keys().$each_with_index(),"map",[],(pa=function(V,ka){null==V&&(V=d);null==ka&&(ka=d);return y(ka["$=="](8)?"\n":"",V)},pa.$$s=this,pa.$$arity=2,pa)).$join(", ")+'\n\nDue dates can be also added via tags in task title: "due:YYYY-MM-DD"\nIn addition to formatted dates, you can use date synonyms:\n"due:today", "due:tomorrow", and day names e.g. "due:monday" or "due:tue"\n\nLegend: '+k(k(x(L,"STATES"),"select",[],(ha=function(V){null==V&&(V=d);return V["$!="]("default")},ha.$$s=this, -ha.$$arity=2,ha)),"map",[],(H=function(V,ka){null==V&&(V=d);null==ka&&(ka=d);return""+V+" "+ka},H.$$s=this,H.$$arity=2,H)).$join(", ")+", priority "+x(L,"PRIORITY_FLAG")+"\n\nTodo file: "+x(L,"TODO_FILE")+"\n"},R.$$arity=0);a.def(I,"$setup",ja=function(){var pa,ha,H,V,ka,wa,ia,xa,Ha,Ia,Ra,Ta,Ja,jb,kb,W,za=d,Ca=d;this.today=x(L,"Date").$parse(x(L,"Date").$today().$strftime(x(L,"DATE_FORMAT")));za=k(c(0,6,!1),"map",[],(pa=function(Aa){var bb=null==pa.$$s?this:pa.$$s;null==bb.today&&(bb.today=d);null== +ha.$$arity=2,ha)),"map",[],(H=function(V,ka){null==V&&(V=d);null==ka&&(ka=d);return""+V+" "+ka},H.$$s=this,H.$$arity=2,H)).$join(", ")+", priority "+x(L,"PRIORITY_FLAG")+"\n\nTodo file: "+x(L,"TODO_FILE")+"\n"},R.$$arity=0);a.def(I,"$setup",ja=function(){var pa,ha,H,V,ka,wa,ia,xa,Ia,Ha,Ra,Ta,Ja,jb,kb,W,za=d,Ca=d;this.today=x(L,"Date").$parse(x(L,"Date").$today().$strftime(x(L,"DATE_FORMAT")));za=k(c(0,6,!1),"map",[],(pa=function(Aa){var bb=null==pa.$$s?this:pa.$$s;null==bb.today&&(bb.today=d);null== Aa&&(Aa=d);return y(bb.today,Aa)},pa.$$s=this,pa.$$arity=1,pa));this.due_date_days=k(za,"map",[],(ha=function(Aa){null==Aa&&(Aa=d);return Aa.$strftime("%A").$downcase()},ha.$$s=this,ha.$$arity=1,ha));Ca=k(za,"map",[],(H=function(Aa){null==Aa&&(Aa=d);return Aa.$strftime(x(L,"DATE_FORMAT"))},H.$$s=this,H.$$arity=1,H));return this.queries=m(":active :done :blocked :started :new :all :priority :note :today :tomorrow :next7days :overdue :due".split(" "),{":active":k(this,"lambda",[],(V=function(Aa){null== Aa&&(Aa=d);return/(new|started|blocked)/.$match(Aa["$[]"]("state"))},V.$$s=this,V.$$arity=1,V)),":done":k(this,"lambda",[],(ka=function(Aa){null==Aa&&(Aa=d);return"done"["$=="](Aa["$[]"]("state"))},ka.$$s=this,ka.$$arity=1,ka)),":blocked":k(this,"lambda",[],(wa=function(Aa){null==Aa&&(Aa=d);return"blocked"["$=="](Aa["$[]"]("state"))},wa.$$s=this,wa.$$arity=1,wa)),":started":k(this,"lambda",[],(ia=function(Aa){null==Aa&&(Aa=d);return"started"["$=="](Aa["$[]"]("state"))},ia.$$s=this,ia.$$arity=1,ia)), -":new":k(this,"lambda",[],(xa=function(Aa){null==Aa&&(Aa=d);return"new"["$=="](Aa["$[]"]("state"))},xa.$$s=this,xa.$$arity=1,xa)),":all":k(this,"lambda",[],(Ha=function(Aa){null==Aa&&(Aa=d);return/\w+/.$match(Aa["$[]"]("state"))},Ha.$$s=this,Ha.$$arity=1,Ha)),":priority":k(this,"lambda",[],(Ia=function(Aa){null==Aa&&(Aa=d);return Aa["$[]"]("priority")},Ia.$$s=this,Ia.$$arity=1,Ia)),":note":k(this,"lambda",[],(Ra=function(Aa){var bb;null==Aa&&(Aa=d);return u(bb=Aa["$[]"]("note"))?Aa["$[]"]("note")["$empty?"]()["$!"](): +":new":k(this,"lambda",[],(xa=function(Aa){null==Aa&&(Aa=d);return"new"["$=="](Aa["$[]"]("state"))},xa.$$s=this,xa.$$arity=1,xa)),":all":k(this,"lambda",[],(Ia=function(Aa){null==Aa&&(Aa=d);return/\w+/.$match(Aa["$[]"]("state"))},Ia.$$s=this,Ia.$$arity=1,Ia)),":priority":k(this,"lambda",[],(Ha=function(Aa){null==Aa&&(Aa=d);return Aa["$[]"]("priority")},Ha.$$s=this,Ha.$$arity=1,Ha)),":note":k(this,"lambda",[],(Ra=function(Aa){var bb;null==Aa&&(Aa=d);return u(bb=Aa["$[]"]("note"))?Aa["$[]"]("note")["$empty?"]()["$!"](): bb},Ra.$$s=this,Ra.$$arity=1,Ra)),":today":k(this,"lambda",[],(Ta=function(Aa){null==Aa&&(Aa=d);return Ca["$[]"](0)["$=="](Aa["$[]"]("due"))},Ta.$$s=this,Ta.$$arity=1,Ta)),":tomorrow":k(this,"lambda",[],(Ja=function(Aa){null==Aa&&(Aa=d);return Ca["$[]"](1)["$=="](Aa["$[]"]("due"))},Ja.$$s=this,Ja.$$arity=1,Ja)),":next7days":k(this,"lambda",[],(jb=function(Aa){null==Aa&&(Aa=d);return a.regexp(["(",Ca.$join("|"),")"]).$match(Aa["$[]"]("due"))},jb.$$s=this,jb.$$arity=1,jb)),":overdue":k(this,"lambda", [],(kb=function(Aa){var bb;null==Aa&&(Aa=d);return u(bb=Aa["$[]"]("due"))?t(Aa["$[]"]("due"),Ca["$[]"](0)):bb},kb.$$s=this,kb.$$arity=1,kb)),":due":k(this,"lambda",[],(W=function(Aa){null==Aa&&(Aa=d);return Aa["$[]"]("due")},W.$$s=this,W.$$arity=1,W))})},ja.$$arity=0);a.def(I,"$load_tasks",da=function(pa){var ha,H=d,V=d,ka=d,wa=d;null==pa&&(pa=d);H=0;V=m([],{});ka=require("fs").existsSync(x(L,"TODO_FILE"))?require("fs").readFileSync(x(L,"TODO_FILE"),"utf8"):"";u(ka["$empty?"]()["$!"]())&&k(ka.$split("\n"), "each",[],(ha=function(ia){null==ia&&(ia=d);if(ia.$strip()["$=="](""))return d;H=y(H,1);ia=[H,x(L,"JSON").$parse(ia.$chomp(),m(["symbolize_names"],{symbolize_names:!0}))];k(V,"[]=",a.to_a(ia));return ia[w(ia.length,1)]},ha.$$s=this,ha.$$arity=1,ha));u(u(wa=pa)?V["$has_key?"](pa)["$!"]():wa)&&this.$raise(""+pa+": No such todo");return V},da.$$arity=-1);a.def(I,"$write_tasks",ma=function(pa){var ha,H=d;H=y(k(pa.$keys().$sort(),"map",[],(ha=function(V){null==V&&(V=d);return x(L,"JSON").$generate(pa["$[]"](V))}, @@ -736,14 +736,14 @@ return"show"["$==="](ha)?this.$show(pa,V):"list"["$==="](ha)?this.$list(V):d},f. [],(H=function(V){var ka=null==H.$$s?this:H.$$s;null==V&&(V=d);var wa=["title",ha];k(V,"[]=",a.to_a(wa));wa[w(wa.length,1)];return ka.$postprocess_tags(V)},H.$$s=this,H.$$arity=1,H)))},A.$$arity=2);a.def(I,"$delete",E=function(pa){var ha=this.$load_tasks(pa);ha.$delete(pa);this.$write_tasks(ha);return this.$list()},E.$$arity=1);a.def(I,"$change_state",F=function(pa,ha,H){var V;null==H&&(H=d);return this.$update_task(pa,"list",k(this,"lambda",[],(V=function(ka){var wa=d;null==ka&&(ka=d);var ia=["state", ha];k(ka,"[]=",a.to_a(ia));ia[w(ia.length,1)];return u(u(wa=H["$nil?"]()["$!"]())?H["$empty?"]()["$!"]():wa)?(u(ia=ka["$[]"]("note"))?ia:(ia=["note",[]],k(ka,"[]=",a.to_a(ia)),ia[w(ia.length,1)]),ka["$[]"]("note").$push(H)):d},V.$$s=this,V.$$arity=1,V)))},F.$$arity=-3);a.def(I,"$set_priority",M=function(pa,ha){var H;null==ha&&(ha=d);return this.$update_task(pa,"list",k(this,"lambda",[],(H=function(V){var ka=d;null==V&&(V=d);var wa=["priority",V["$[]"]("priority")["$!"]()];k(V,"[]=",a.to_a(wa));wa[w(wa.length, 1)];u(V["$[]"]("priority")["$!"]())&&V.$delete("priority");return u(u(ka=ha["$nil?"]()["$!"]())?ha["$empty?"]()["$!"]():ka)?(u(wa=V["$[]"]("note"))?wa:(wa=["note",[]],k(V,"[]=",a.to_a(wa)),wa[w(wa.length,1)]),V["$[]"]("note").$push(ha)):d},H.$$s=this,H.$$arity=1,H)))},M.$$arity=-2);a.def(I,"$due_date",ba=function(pa,ha){var H;null==ha&&(ha="");return this.$update_task(pa,"list",k(this,"lambda",[],(H=function(V){var ka=null==H.$$s?this:H.$$s;null==V&&(V=d);ka=["due",ka.$convert_due_date(ha)];k(V,"[]=", -a.to_a(ka));ka[w(ka.length,1)];return u(V["$[]"]("due")["$nil?"]())?V.$delete("due"):d},H.$$s=this,H.$$arity=1,H)))},ba.$$arity=-2);a.def(I,"$list",ua=function(pa,ha){var H,V,ka=d,wa=d,ia=d,xa=d;null==pa&&(pa=d);null==ha&&(ha=d);pa=u(ka=pa)?ka:this.$load_tasks();wa=[pa.$keys().$max().$to_s().$size(),4].$max();ha=u(ia=ha)?ia:[];u(ha["$&"](":active :done :blocked :started :new :all".split(" "))["$empty?"]())&&(ha=y(ha,[":active"]));xa=k(this.$filter_tasks(pa,ha),"sort_by",[],(H=function(Ha,Ia){var Ra= -d,Ta=d,Ja=d;null==Ha&&(Ha=d);null==Ia&&(Ia=d);return[u(u(Ra=Ia["$[]"]("priority"))?Ia["$[]"]("state")["$!="]("done"):Ra)?0:1,x(L,"ORDER")["$[]"](u(Ta=Ia["$[]"]("state"))?Ta:"default"),u(Ja=Ia["$[]"]("due"))?Ja:"n/a",Ha]},H.$$s=this,H.$$arity=2,H));k(xa,"each",[],(V=function(Ha,Ia){var Ra=null==V.$$s?this:V.$$s,Ta,Ja=d,jb=d,kb=d,W=d,za=d,Ca=d,Aa=d,bb=d,db=Ja=d,ab=d;null==Ra.today&&(Ra.today=d);null==Ra.due_date_days&&(Ra.due_date_days=d);null==Ha&&(Ha=d);null==Ia&&(Ia=d);Ja=u(jb=Ia["$[]"]("state"))? -jb:"default";kb=Ra.$colorize(x(L,"STATES")["$[]"](Ja),x(L,"COLORS")["$[]"](Ja));W=k(Ia["$[]"]("title"),"gsub",[x(L,"CONTEXT_TAG_PATTERN")],(Ta=function(Wa){var Ba=null==Ta.$$s?this:Ta.$$s;null==Wa&&(Wa=d);return y(u(Wa["$start_with?"](" "))?" ":"",Ba.$colorize(Wa.$strip(),"cyan"))},Ta.$$s=Ra,Ta.$$arity=1,Ta));za=u(u(Ca=Ia["$[]"]("priority"))?Ja["$!="]("done"):Ca)?Ra.$colorize(x(L,"PRIORITY_FLAG"),"red"):" ";Aa="";u(u(bb=Ia["$[]"]("due"))?Ja["$!="]("done"):bb)&&(Ja=w(x(L,"Date").$parse(Ia["$[]"]("due")), -Ra.today).$to_i(),u(t(Ja,0))?Aa=Ra.$colorize("("+Ja.$abs()+"d overdue)","red"):u(u(db=Ja["$=="](0))?db:Ja["$=="](1))?Aa=Ra.$colorize("("+x(L,"DUE_DATE_DAYS_SIMPLE")["$[]"](Ja)+")","yellow"):u(J(Ja,1))&&(Aa=Ra.$colorize("("+(u(ab=Ra.due_date_days["$[]"](Ja))?ab:Ia["$[]"]("due"))+")","magenta")),Aa=y(" ",Aa));return Ra.$puts(""+Ha.$to_s().$rjust(wa," ")+":"+za+kb+" "+W+Aa)},V.$$s=this,V.$$arity=2,V));return u(xa["$empty?"]())?this.$puts("No todos found"):d},ua.$$arity=-1);a.def(I,"$add_note",Pa=function(pa, -ha){var H;return this.$update_task(pa,"show",k(this,"lambda",[],(H=function(V){var ka;null==V&&(V=d);u(ka=V["$[]"]("note"))?ka:(ka=["note",[]],k(V,"[]=",a.to_a(ka)),ka[w(ka.length,1)]);return V["$[]"]("note").$push(ha)},H.$$s=this,H.$$arity=1,H)))},Pa.$$arity=2);a.def(I,"$delete_note",va=function(pa){var ha;return this.$update_task(pa,"show",k(this,"lambda",[],(ha=function(H){null==H&&(H=d);return H.$delete("note")},ha.$$s=this,ha.$$arity=1,ha)))},va.$$arity=1);a.def(I,"$show",Da=function(pa,ha){var H, -V=d;null==ha&&(ha=d);ha=u(V=ha)?V:this.$load_tasks(pa);return k(ha["$[]"](pa),"each",[],(H=function(ka,wa){var ia=null==H.$$s?this:H.$$s;null==ka&&(ka=d);null==wa&&(wa=d);wa=u(wa["$kind_of?"](x(L,"Array")))?y("\n",wa.$join("\n")):wa;return ia.$puts(""+ia.$colorize(y(ka.$to_s().$rjust(10," "),":"),"cyan")+" "+wa)},H.$$s=this,H.$$arity=2,H))},Da.$$arity=-2);a.def(I,"$start_repl",Ma=function(){function pa(){V.question("\ntodo> ",function(ka){try{ka=ka.trim(),["exit","quit"].includes(ka)?V.close():(["clear", -"cls"].includes(ka)?process.stdout.write("\u001b[H\u001b[2J"):H(ka),pa())}catch(wa){throw V.close(),wa;}})}var ha,H=d;H=k(this,"lambda",[],(ha=function(ka){var wa=null==ha.$$s?this:ha.$$s;null==ka&&(ka=d);return wa.$execute(ka["$=="]("repl")?[]:ka.$split(/\s+/))},ha.$$s=this,ha.$$arity=1,ha));var V=require("readline").createInterface({input:process.stdin,output:process.stdout});H("");pa()},Ma.$$arity=0);a.def(I,"$cleanup",na=function(pa){var ha,H=d,V=d;H=this.$load_tasks();pa=y([":done"],pa.$to_a()); -V=this.$filter_tasks(H,pa);k(V,"each_key",[],(ha=function(ka){null==ka&&(ka=d);return H.$delete(ka)},ha.$$s=this,ha.$$arity=1,ha));this.$write_tasks(H);return this.$puts("Deleted "+V.$size()+" todo(s)")},na.$$arity=1);a.def(I,"$filter_tasks",S=function(pa,ha){var H;ha=ha.$uniq();return k(pa,"select",[],(H=function(V,ka){var wa=null==H.$$s?this:H.$$s,ia;null==V&&(V=d);null==ka&&(ka=d);return k(ha,"all?",[],(ia=function(xa){var Ha=null==ia.$$s?this:ia.$$s;null==Ha.queries&&(Ha.queries=d);null==xa&& -(xa=d);return u(Ha.queries["$[]"](xa))?Ha.queries["$[]"](xa).$call(ka):a.regexp([xa],"i").$match(ka["$[]"]("title"))},ia.$$s=wa,ia.$$arity=1,ia))},H.$$s=this,H.$$arity=2,H))},S.$$arity=2);a.def(I,"$colorize",sa=function(pa,ha){var H=d;return"\u001b["+(u(H=x(L,"COLOR_CODES")["$[]"](ha))?H:37)+"m"+pa+"\u001b[0m"},sa.$$arity=2);return(a.def(I,"$convert_due_date",ya=function(pa){var ha,H=this,V=d,ka=d,wa=d,ia=d;V=function(){return u(ka=u(wa=H.due_date_days.$index(pa.$to_s().$downcase()))?wa:x(L,"DUE_DATE_DAYS_SIMPLE").$index(pa.$to_s().$downcase()))? -ka:k(H.due_date_days,"map",[],(ha=function(xa){null==xa&&(xa=d);return xa["$[]"](c(0,2,!1))},ha.$$s=H,ha.$$arity=1,ha)).$index(pa.$to_s().$downcase())}();return u(V)?y(H.today,V).$strftime(x(L,"DATE_FORMAT")):u(u(ia=pa["$nil?"]())?ia:pa["$empty?"]())?d:x(L,"Date").$parse(x(L,"DATE_PATTERN").$match(pa).$to_s()).$strftime(x(L,"DATE_FORMAT"))},ya.$$arity=1),d)&&"convert_due_date"})(p[0],null,p);return x(p,"Todo").$new().$execute(process.argv.slice(2))})(Opal);var Qb=Opal.$$;Opal.add_stubs(["$exit"]); -Qb([],"Kernel").$exit();}).call(this); +a.to_a(ka));ka[w(ka.length,1)];return u(V["$[]"]("due")["$nil?"]())?V.$delete("due"):d},H.$$s=this,H.$$arity=1,H)))},ba.$$arity=-2);a.def(I,"$list",ua=function(pa,ha){var H,V,ka=d,wa=d,ia=d,xa=d;null==pa&&(pa=d);null==ha&&(ha=d);pa=u(ka=pa)?ka:this.$load_tasks();wa=[pa.$keys().$max().$to_s().$size(),4].$max();ha=u(ia=ha)?ia:[];u(ha["$&"](":active :done :blocked :started :new :all".split(" "))["$empty?"]())&&(ha=y(ha,[":active"]));xa=k(this.$filter_tasks(pa,ha),"sort_by",[],(H=function(Ia,Ha){var Ra= +d,Ta=d,Ja=d;null==Ia&&(Ia=d);null==Ha&&(Ha=d);return[u(u(Ra=Ha["$[]"]("priority"))?Ha["$[]"]("state")["$!="]("done"):Ra)?0:1,x(L,"ORDER")["$[]"](u(Ta=Ha["$[]"]("state"))?Ta:"default"),u(Ha["$[]"]("state")["$!="]("done"))?u(Ja=Ha["$[]"]("due"))?Ja:"n/a":Ha["$[]"]("modified"),Ia]},H.$$s=this,H.$$arity=2,H));k(xa,"each",[],(V=function(Ia,Ha){var Ra=null==V.$$s?this:V.$$s,Ta,Ja=d,jb=d,kb=d,W=d,za=d,Ca=d,Aa=d,bb=d,db=Ja=d,ab=d;null==Ra.today&&(Ra.today=d);null==Ra.due_date_days&&(Ra.due_date_days=d);null== +Ia&&(Ia=d);null==Ha&&(Ha=d);Ja=u(jb=Ha["$[]"]("state"))?jb:"default";kb=Ra.$colorize(x(L,"STATES")["$[]"](Ja),x(L,"COLORS")["$[]"](Ja));W=k(Ha["$[]"]("title"),"gsub",[x(L,"CONTEXT_TAG_PATTERN")],(Ta=function(Wa){var Ba=null==Ta.$$s?this:Ta.$$s;null==Wa&&(Wa=d);return y(u(Wa["$start_with?"](" "))?" ":"",Ba.$colorize(Wa.$strip(),"cyan"))},Ta.$$s=Ra,Ta.$$arity=1,Ta));za=u(u(Ca=Ha["$[]"]("priority"))?Ja["$!="]("done"):Ca)?Ra.$colorize(x(L,"PRIORITY_FLAG"),"red"):" ";Aa="";u(u(bb=Ha["$[]"]("due"))?Ja["$!="]("done"): +bb)&&(Ja=w(x(L,"Date").$parse(Ha["$[]"]("due")),Ra.today).$to_i(),u(t(Ja,0))?Aa=Ra.$colorize("("+Ja.$abs()+"d overdue)","red"):u(u(db=Ja["$=="](0))?db:Ja["$=="](1))?Aa=Ra.$colorize("("+x(L,"DUE_DATE_DAYS_SIMPLE")["$[]"](Ja)+")","yellow"):u(J(Ja,1))&&(Aa=Ra.$colorize("("+(u(ab=Ra.due_date_days["$[]"](Ja))?ab:Ha["$[]"]("due"))+")","magenta")),Aa=y(" ",Aa));return Ra.$puts(""+Ia.$to_s().$rjust(wa," ")+":"+za+kb+" "+W+Aa)},V.$$s=this,V.$$arity=2,V));return u(xa["$empty?"]())?this.$puts("No todos found"): +d},ua.$$arity=-1);a.def(I,"$add_note",Pa=function(pa,ha){var H;return this.$update_task(pa,"show",k(this,"lambda",[],(H=function(V){var ka;null==V&&(V=d);u(ka=V["$[]"]("note"))?ka:(ka=["note",[]],k(V,"[]=",a.to_a(ka)),ka[w(ka.length,1)]);return V["$[]"]("note").$push(ha)},H.$$s=this,H.$$arity=1,H)))},Pa.$$arity=2);a.def(I,"$delete_note",va=function(pa){var ha;return this.$update_task(pa,"show",k(this,"lambda",[],(ha=function(H){null==H&&(H=d);return H.$delete("note")},ha.$$s=this,ha.$$arity=1,ha)))}, +va.$$arity=1);a.def(I,"$show",Da=function(pa,ha){var H,V=d;null==ha&&(ha=d);ha=u(V=ha)?V:this.$load_tasks(pa);return k(ha["$[]"](pa),"each",[],(H=function(ka,wa){var ia=null==H.$$s?this:H.$$s;null==ka&&(ka=d);null==wa&&(wa=d);wa=u(wa["$kind_of?"](x(L,"Array")))?y("\n",wa.$join("\n")):wa;return ia.$puts(""+ia.$colorize(y(ka.$to_s().$rjust(10," "),":"),"cyan")+" "+wa)},H.$$s=this,H.$$arity=2,H))},Da.$$arity=-2);a.def(I,"$start_repl",Ma=function(){function pa(){V.question("\ntodo> ",function(ka){try{ka= +ka.trim(),["exit","quit"].includes(ka)?V.close():(["clear","cls"].includes(ka)?process.stdout.write("\u001b[H\u001b[2J"):H(ka),pa())}catch(wa){throw V.close(),wa;}})}var ha,H=d;H=k(this,"lambda",[],(ha=function(ka){var wa=null==ha.$$s?this:ha.$$s;null==ka&&(ka=d);return wa.$execute(ka["$=="]("repl")?[]:ka.$split(/\s+/))},ha.$$s=this,ha.$$arity=1,ha));var V=require("readline").createInterface({input:process.stdin,output:process.stdout});H("");pa()},Ma.$$arity=0);a.def(I,"$cleanup",na=function(pa){var ha, +H=d,V=d;H=this.$load_tasks();pa=y([":done"],pa.$to_a());V=this.$filter_tasks(H,pa);k(V,"each_key",[],(ha=function(ka){null==ka&&(ka=d);return H.$delete(ka)},ha.$$s=this,ha.$$arity=1,ha));this.$write_tasks(H);return this.$puts("Deleted "+V.$size()+" todo(s)")},na.$$arity=1);a.def(I,"$filter_tasks",S=function(pa,ha){var H;ha=ha.$uniq();return k(pa,"select",[],(H=function(V,ka){var wa=null==H.$$s?this:H.$$s,ia;null==V&&(V=d);null==ka&&(ka=d);return k(ha,"all?",[],(ia=function(xa){var Ia=null==ia.$$s? +this:ia.$$s;null==Ia.queries&&(Ia.queries=d);null==xa&&(xa=d);return u(Ia.queries["$[]"](xa))?Ia.queries["$[]"](xa).$call(ka):a.regexp([xa],"i").$match(ka["$[]"]("title"))},ia.$$s=wa,ia.$$arity=1,ia))},H.$$s=this,H.$$arity=2,H))},S.$$arity=2);a.def(I,"$colorize",sa=function(pa,ha){var H=d;return"\u001b["+(u(H=x(L,"COLOR_CODES")["$[]"](ha))?H:37)+"m"+pa+"\u001b[0m"},sa.$$arity=2);return(a.def(I,"$convert_due_date",ya=function(pa){var ha,H=this,V=d,ka=d,wa=d,ia=d;V=function(){return u(ka=u(wa=H.due_date_days.$index(pa.$to_s().$downcase()))? +wa:x(L,"DUE_DATE_DAYS_SIMPLE").$index(pa.$to_s().$downcase()))?ka:k(H.due_date_days,"map",[],(ha=function(xa){null==xa&&(xa=d);return xa["$[]"](c(0,2,!1))},ha.$$s=H,ha.$$arity=1,ha)).$index(pa.$to_s().$downcase())}();return u(V)?y(H.today,V).$strftime(x(L,"DATE_FORMAT")):u(u(ia=pa["$nil?"]())?ia:pa["$empty?"]())?d:x(L,"Date").$parse(x(L,"DATE_PATTERN").$match(pa).$to_s()).$strftime(x(L,"DATE_FORMAT"))},ya.$$arity=1),d)&&"convert_due_date"})(p[0],null,p);return x(p,"Todo").$new().$execute(process.argv.slice(2))})(Opal); +var Qb=Opal.$$;Opal.add_stubs(["$exit"]);Qb([],"Kernel").$exit();}).call(this); diff --git a/node/todo.js.rb b/node/todo.js.rb index a2c1f89..123e196 100644 --- a/node/todo.js.rb +++ b/node/todo.js.rb @@ -301,7 +301,12 @@ def list(tasks = nil, patterns = nil) patterns ||= [] patterns += [':active'] if (patterns & [':active', ':done', ':blocked', ':started', ':new', ':all']).empty? items = filter_tasks(tasks, patterns).sort_by do |num, task| - [task[:priority] && task[:state] != 'done' ? 0 : 1, ORDER[task[:state] || 'default'], task[:due] || 'n/a', num] + [ + task[:priority] && task[:state] != 'done' ? 0 : 1, + ORDER[task[:state] || 'default'], + task[:state] != 'done' ? task[:due] || 'n/a' : task[:modified], + num + ] end items.each do |num, task| state = task[:state] || 'default' diff --git a/todo.gemspec b/todo.gemspec index f7cdcf0..ad59ceb 100644 --- a/todo.gemspec +++ b/todo.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'todo-jsonl' - s.version = '1.0.2' + s.version = '1.0.3' s.date = '2021-03-22' s.summary = 'todo list manager on the command-line inspired by todo.txt using the jsonl format' s.authors = ['Gabor Bata'] diff --git a/web/app.js b/web/app.js index 1e191cf..ff3769e 100644 --- a/web/app.js +++ b/web/app.js @@ -746,15 +746,15 @@ h(["state","title","modified"],{state:"new",title:ka,modified:this.today.$strfti qa&&(qa=d);var ta=["state",N];l(qa,"[]=",a.to_a(ta));ta[t(ta.length,1)];return v(v(ea=M["$nil?"]()["$!"]())?M["$empty?"]()["$!"]():ea)?(v(ta=qa["$[]"]("note"))?ta:(ta=["note",[]],l(qa,"[]=",a.to_a(ta)),ta[t(ta.length,1)]),qa["$[]"]("note").$push(M)):d},ia.$$s=this,ia.$$arity=1,ia)))},ba.$$arity=-3);a.def(H,"$set_priority",va=function(ka,N){var M;null==N&&(N=d);return this.$update_task(ka,"list",l(this,"lambda",[],(M=function(ia){var qa=d;null==ia&&(ia=d);var ea=["priority",ia["$[]"]("priority")["$!"]()]; l(ia,"[]=",a.to_a(ea));ea[t(ea.length,1)];v(ia["$[]"]("priority")["$!"]())&&ia.$delete("priority");return v(v(qa=N["$nil?"]()["$!"]())?N["$empty?"]()["$!"]():qa)?(v(ea=ia["$[]"]("note"))?ea:(ea=["note",[]],l(ia,"[]=",a.to_a(ea)),ea[t(ea.length,1)]),ia["$[]"]("note").$push(N)):d},M.$$s=this,M.$$arity=1,M)))},va.$$arity=-2);a.def(H,"$due_date",Pa=function(ka,N){var M;null==N&&(N="");return this.$update_task(ka,"list",l(this,"lambda",[],(M=function(ia){var qa=null==M.$$s?this:M.$$s;null==ia&&(ia=d); qa=["due",qa.$convert_due_date(N)];l(ia,"[]=",a.to_a(qa));qa[t(qa.length,1)];return v(ia["$[]"]("due")["$nil?"]())?ia.$delete("due"):d},M.$$s=this,M.$$arity=1,M)))},Pa.$$arity=-2);a.def(H,"$list",wa=function(ka,N){var M,ia,qa=d,ea=d,ta=d,Ga=d;null==ka&&(ka=d);null==N&&(N=d);ka=v(qa=ka)?qa:this.$load_tasks();ea=[ka.$keys().$max().$to_s().$size(),4].$max();N=v(ta=N)?ta:[];v(N["$&"](":active :done :blocked :started :new :all".split(" "))["$empty?"]())&&(N=w(N,[":active"]));Ga=l(this.$filter_tasks(ka, -N),"sort_by",[],(M=function(Ha,Sa){var Ra=d,Ka=d,eb=d;null==Ha&&(Ha=d);null==Sa&&(Sa=d);return[v(v(Ra=Sa["$[]"]("priority"))?Sa["$[]"]("state")["$!="]("done"):Ra)?0:1,z(J,"ORDER")["$[]"](v(Ka=Sa["$[]"]("state"))?Ka:"default"),v(eb=Sa["$[]"]("due"))?eb:"n/a",Ha]},M.$$s=this,M.$$arity=2,M));l(Ga,"each",[],(ia=function(Ha,Sa){var Ra=null==ia.$$s?this:ia.$$s,Ka,eb=d,kb=d,W=d,ya=d,Ba=d,Ua=d,Da=d,Ya=d,cb=eb=d,$a=d;null==Ra.today&&(Ra.today=d);null==Ra.due_date_days&&(Ra.due_date_days=d);null==Ra.text_buffer&& -(Ra.text_buffer=d);null==Ha&&(Ha=d);null==Sa&&(Sa=d);eb=v(kb=Sa["$[]"]("state"))?kb:"default";W=Ra.$colorize(z(J,"STATES")["$[]"](eb),z(J,"COLORS")["$[]"](eb));ya=l(Sa["$[]"]("title"),"gsub",[z(J,"CONTEXT_TAG_PATTERN")],(Ka=function(za){var ua=null==Ka.$$s?this:Ka.$$s;null==za&&(za=d);return w(v(za["$start_with?"](" "))?" ":"",ua.$colorize(za.$strip(),"cyan"))},Ka.$$s=Ra,Ka.$$arity=1,Ka));Ba=v(v(Ua=Sa["$[]"]("priority"))?eb["$!="]("done"):Ua)?Ra.$colorize(z(J,"PRIORITY_FLAG"),"red"):" ";Da="";v(v(Ya= -Sa["$[]"]("due"))?eb["$!="]("done"):Ya)&&(eb=t(z(J,"Date").$parse(Sa["$[]"]("due")),Ra.today).$to_i(),v(p(eb,0))?Da=Ra.$colorize("("+eb.$abs()+"d overdue)","red"):v(v(cb=eb["$=="](0))?cb:eb["$=="](1))?Da=Ra.$colorize("("+z(J,"DUE_DATE_DAYS_SIMPLE")["$[]"](eb)+")","yellow"):v(F(eb,1))&&(Da=Ra.$colorize("("+(v($a=Ra.due_date_days["$[]"](eb))?$a:Sa["$[]"]("due"))+")","magenta")),Da=w(" ",Da));return Ra.text_buffer.$push(""+Ha.$to_s().$rjust(ea," ")+":"+Ba+W+" "+ya+Da)},ia.$$s=this,ia.$$arity=2,ia)); -return v(Ga["$empty?"]())?this.text_buffer.$push("No todos found"):d},wa.$$arity=-1);a.def(H,"$add_note",Aa=function(ka,N){var M;return this.$update_task(ka,"show",l(this,"lambda",[],(M=function(ia){var qa;null==ia&&(ia=d);v(qa=ia["$[]"]("note"))?qa:(qa=["note",[]],l(ia,"[]=",a.to_a(qa)),qa[t(qa.length,1)]);return ia["$[]"]("note").$push(N)},M.$$s=this,M.$$arity=1,M)))},Aa.$$arity=2);a.def(H,"$delete_note",Ma=function(ka){var N;return this.$update_task(ka,"show",l(this,"lambda",[],(N=function(M){null== -M&&(M=d);return M.$delete("note")},N.$$s=this,N.$$arity=1,N)))},Ma.$$arity=1);a.def(H,"$show",na=function(ka,N){var M,ia=d;null==N&&(N=d);N=v(ia=N)?ia:this.$load_tasks(ka);return l(N["$[]"](ka),"each",[],(M=function(qa,ea){var ta=null==M.$$s?this:M.$$s;null==ta.text_buffer&&(ta.text_buffer=d);null==qa&&(qa=d);null==ea&&(ea=d);ea=v(ea["$kind_of?"](z(J,"Array")))?w("\n",ea.$join("\n")):ea;return ta.text_buffer.$push(""+ta.$colorize(w(qa.$to_s().$rjust(10," "),":"),"cyan")+" "+ea)},M.$$s=this,M.$$arity= -2,M))},na.$$arity=-2);a.def(H,"$cleanup",T=function(ka){var N,M=d,ia=d;M=this.$load_tasks();ka=w([":done"],ka.$to_a());ia=this.$filter_tasks(M,ka);l(ia,"each_key",[],(N=function(qa){null==qa&&(qa=d);return M.$delete(qa)},N.$$s=this,N.$$arity=1,N));this.$write_tasks(M);return this.text_buffer.$push("Deleted "+ia.$size()+" todo(s)")},T.$$arity=1);a.def(H,"$filter_tasks",sa=function(ka,N){var M;N=N.$uniq();return l(ka,"select",[],(M=function(ia,qa){var ea=null==M.$$s?this:M.$$s,ta;null==ia&&(ia=d);null== -qa&&(qa=d);return l(N,"all?",[],(ta=function(Ga){var Ha=null==ta.$$s?this:ta.$$s;null==Ha.queries&&(Ha.queries=d);null==Ga&&(Ga=d);return v(Ha.queries["$[]"](Ga))?Ha.queries["$[]"](Ga).$call(qa):a.regexp([Ga],"i").$match(qa["$[]"]("title"))},ta.$$s=ea,ta.$$arity=1,ta))},M.$$s=this,M.$$arity=2,M))},sa.$$arity=2);a.def(H,"$colorize",xa=function(ka,N){var M=d;return"e["+(v(M=z(J,"COLOR_CODES")["$[]"](N))?M:37)+"m"+ka+"e[0m"},xa.$$arity=2);return(a.def(H,"$convert_due_date",Ja=function(ka){var N,M=this, -ia=d,qa=d,ea=d,ta=d;ia=function(){return v(qa=v(ea=M.due_date_days.$index(ka.$to_s().$downcase()))?ea:z(J,"DUE_DATE_DAYS_SIMPLE").$index(ka.$to_s().$downcase()))?qa:l(M.due_date_days,"map",[],(N=function(Ga){null==Ga&&(Ga=d);return Ga["$[]"](c(0,2,!1))},N.$$s=M,N.$$arity=1,N)).$index(ka.$to_s().$downcase())}();return v(ia)?w(M.today,ia).$strftime(z(J,"DATE_FORMAT")):v(v(ta=ka["$nil?"]())?ta:ka["$empty?"]())?d:z(J,"Date").$parse(z(J,"DATE_PATTERN").$match(ka).$to_s()).$strftime(z(J,"DATE_FORMAT"))}, -Ja.$$arity=1),d)&&"convert_due_date"}(q[0],null,q)}; -(function(a){var w,F=a.top,p=[],t=a.nil,y=a.$$$,q=a.$$,d=a.send,G=t,z=t;a.add_stubs("$require $new $lambda $to_html $execute $+".split(" "));F.$require("./todo.js.rb");G=q(p,"Todo").$new();z=d(F,"lambda",[],(w=function(f,h,v){null==f&&(f=t);null==h&&(h=t);null==v&&(v=t);var c=f.output,l=G,H=l.$execute;h=[h];v="number"===typeof h&&"number"===typeof v?h+v:h["$+"](v);return c.call(f,H.call(l,v).$to_html())},w.$$s=F,w.$$arity=3,w));(new VanillaTerminal({welcome:'todo list manager REPL v1.0.2
Type "help" or "copyright" for more information.

',defaultCallback:z, -prompt:"todo",commands:{cls:function(f){f.clear()},copyright:function(f){f.output('todo-jsonl - Copyright (c) 2020-2021 Gabor Bata
opal - Copyright (c) 2013-2021 Adam Beynon and the Opal contributors
vanilla-terminal - Copyright (c) 2018 Javier Jimenez Villar
')},wipe:function(f){f.prompt("Are you sure remove all your todo data? y/n",function(h){"Y"===h.trim().toUpperCase()&&(localStorage.removeItem(y(q(p,"Todo"),"TODO_FILE")),f.history=[],f.historyCursor=0,f.output("todo data wiped"))})}}})).output(G.$execute(["list"]).$to_html())})(Opal); -var Qb=Opal.$$;Opal.add_stubs(["$exit"]);Qb([],"Kernel").$exit();}).call(this); +N),"sort_by",[],(M=function(Ha,Sa){var Ra=d,Ka=d,eb=d;null==Ha&&(Ha=d);null==Sa&&(Sa=d);return[v(v(Ra=Sa["$[]"]("priority"))?Sa["$[]"]("state")["$!="]("done"):Ra)?0:1,z(J,"ORDER")["$[]"](v(Ka=Sa["$[]"]("state"))?Ka:"default"),v(Sa["$[]"]("state")["$!="]("done"))?v(eb=Sa["$[]"]("due"))?eb:"n/a":Sa["$[]"]("modified"),Ha]},M.$$s=this,M.$$arity=2,M));l(Ga,"each",[],(ia=function(Ha,Sa){var Ra=null==ia.$$s?this:ia.$$s,Ka,eb=d,kb=d,W=d,ya=d,Ba=d,Ua=d,Da=d,Ya=d,cb=eb=d,$a=d;null==Ra.today&&(Ra.today=d);null== +Ra.due_date_days&&(Ra.due_date_days=d);null==Ra.text_buffer&&(Ra.text_buffer=d);null==Ha&&(Ha=d);null==Sa&&(Sa=d);eb=v(kb=Sa["$[]"]("state"))?kb:"default";W=Ra.$colorize(z(J,"STATES")["$[]"](eb),z(J,"COLORS")["$[]"](eb));ya=l(Sa["$[]"]("title"),"gsub",[z(J,"CONTEXT_TAG_PATTERN")],(Ka=function(za){var ua=null==Ka.$$s?this:Ka.$$s;null==za&&(za=d);return w(v(za["$start_with?"](" "))?" ":"",ua.$colorize(za.$strip(),"cyan"))},Ka.$$s=Ra,Ka.$$arity=1,Ka));Ba=v(v(Ua=Sa["$[]"]("priority"))?eb["$!="]("done"): +Ua)?Ra.$colorize(z(J,"PRIORITY_FLAG"),"red"):" ";Da="";v(v(Ya=Sa["$[]"]("due"))?eb["$!="]("done"):Ya)&&(eb=t(z(J,"Date").$parse(Sa["$[]"]("due")),Ra.today).$to_i(),v(p(eb,0))?Da=Ra.$colorize("("+eb.$abs()+"d overdue)","red"):v(v(cb=eb["$=="](0))?cb:eb["$=="](1))?Da=Ra.$colorize("("+z(J,"DUE_DATE_DAYS_SIMPLE")["$[]"](eb)+")","yellow"):v(F(eb,1))&&(Da=Ra.$colorize("("+(v($a=Ra.due_date_days["$[]"](eb))?$a:Sa["$[]"]("due"))+")","magenta")),Da=w(" ",Da));return Ra.text_buffer.$push(""+Ha.$to_s().$rjust(ea, +" ")+":"+Ba+W+" "+ya+Da)},ia.$$s=this,ia.$$arity=2,ia));return v(Ga["$empty?"]())?this.text_buffer.$push("No todos found"):d},wa.$$arity=-1);a.def(H,"$add_note",Aa=function(ka,N){var M;return this.$update_task(ka,"show",l(this,"lambda",[],(M=function(ia){var qa;null==ia&&(ia=d);v(qa=ia["$[]"]("note"))?qa:(qa=["note",[]],l(ia,"[]=",a.to_a(qa)),qa[t(qa.length,1)]);return ia["$[]"]("note").$push(N)},M.$$s=this,M.$$arity=1,M)))},Aa.$$arity=2);a.def(H,"$delete_note",Ma=function(ka){var N;return this.$update_task(ka, +"show",l(this,"lambda",[],(N=function(M){null==M&&(M=d);return M.$delete("note")},N.$$s=this,N.$$arity=1,N)))},Ma.$$arity=1);a.def(H,"$show",na=function(ka,N){var M,ia=d;null==N&&(N=d);N=v(ia=N)?ia:this.$load_tasks(ka);return l(N["$[]"](ka),"each",[],(M=function(qa,ea){var ta=null==M.$$s?this:M.$$s;null==ta.text_buffer&&(ta.text_buffer=d);null==qa&&(qa=d);null==ea&&(ea=d);ea=v(ea["$kind_of?"](z(J,"Array")))?w("\n",ea.$join("\n")):ea;return ta.text_buffer.$push(""+ta.$colorize(w(qa.$to_s().$rjust(10, +" "),":"),"cyan")+" "+ea)},M.$$s=this,M.$$arity=2,M))},na.$$arity=-2);a.def(H,"$cleanup",T=function(ka){var N,M=d,ia=d;M=this.$load_tasks();ka=w([":done"],ka.$to_a());ia=this.$filter_tasks(M,ka);l(ia,"each_key",[],(N=function(qa){null==qa&&(qa=d);return M.$delete(qa)},N.$$s=this,N.$$arity=1,N));this.$write_tasks(M);return this.text_buffer.$push("Deleted "+ia.$size()+" todo(s)")},T.$$arity=1);a.def(H,"$filter_tasks",sa=function(ka,N){var M;N=N.$uniq();return l(ka,"select",[],(M=function(ia,qa){var ea= +null==M.$$s?this:M.$$s,ta;null==ia&&(ia=d);null==qa&&(qa=d);return l(N,"all?",[],(ta=function(Ga){var Ha=null==ta.$$s?this:ta.$$s;null==Ha.queries&&(Ha.queries=d);null==Ga&&(Ga=d);return v(Ha.queries["$[]"](Ga))?Ha.queries["$[]"](Ga).$call(qa):a.regexp([Ga],"i").$match(qa["$[]"]("title"))},ta.$$s=ea,ta.$$arity=1,ta))},M.$$s=this,M.$$arity=2,M))},sa.$$arity=2);a.def(H,"$colorize",xa=function(ka,N){var M=d;return"e["+(v(M=z(J,"COLOR_CODES")["$[]"](N))?M:37)+"m"+ka+"e[0m"},xa.$$arity=2);return(a.def(H, +"$convert_due_date",Ja=function(ka){var N,M=this,ia=d,qa=d,ea=d,ta=d;ia=function(){return v(qa=v(ea=M.due_date_days.$index(ka.$to_s().$downcase()))?ea:z(J,"DUE_DATE_DAYS_SIMPLE").$index(ka.$to_s().$downcase()))?qa:l(M.due_date_days,"map",[],(N=function(Ga){null==Ga&&(Ga=d);return Ga["$[]"](c(0,2,!1))},N.$$s=M,N.$$arity=1,N)).$index(ka.$to_s().$downcase())}();return v(ia)?w(M.today,ia).$strftime(z(J,"DATE_FORMAT")):v(v(ta=ka["$nil?"]())?ta:ka["$empty?"]())?d:z(J,"Date").$parse(z(J,"DATE_PATTERN").$match(ka).$to_s()).$strftime(z(J, +"DATE_FORMAT"))},Ja.$$arity=1),d)&&"convert_due_date"}(q[0],null,q)}; +(function(a){var w,F=a.top,p=[],t=a.nil,y=a.$$$,q=a.$$,d=a.send,G=t,z=t;a.add_stubs("$require $new $lambda $to_html $execute $+".split(" "));F.$require("./todo.js.rb");G=q(p,"Todo").$new();z=d(F,"lambda",[],(w=function(f,h,v){null==f&&(f=t);null==h&&(h=t);null==v&&(v=t);var c=f.output,l=G,H=l.$execute;h=[h];v="number"===typeof h&&"number"===typeof v?h+v:h["$+"](v);return c.call(f,H.call(l,v).$to_html())},w.$$s=F,w.$$arity=3,w));(new VanillaTerminal({welcome:'todo list manager REPL v1.0.3
Type "help" or "copyright" for more information.

', +defaultCallback:z,prompt:"todo",commands:{cls:function(f){f.clear()},copyright:function(f){f.output('todo-jsonl - Copyright (c) 2020-2021 Gabor Bata
opal - Copyright (c) 2013-2021 Adam Beynon and the Opal contributors
vanilla-terminal - Copyright (c) 2018 Javier Jimenez Villar
')},wipe:function(f){f.prompt("Are you sure remove all your todo data? y/n",function(h){"Y"===h.trim().toUpperCase()&&(localStorage.removeItem(y(q(p,"Todo"),"TODO_FILE")),f.history=[],f.historyCursor= +0,f.output("todo data wiped"))})}}})).output(G.$execute(["list"]).$to_html())})(Opal);var Qb=Opal.$$;Opal.add_stubs(["$exit"]);Qb([],"Kernel").$exit();}).call(this); diff --git a/web/app.js.rb b/web/app.js.rb index 610fbb3..5eae969 100644 --- a/web/app.js.rb +++ b/web/app.js.rb @@ -8,7 +8,7 @@ ` var term = new VanillaTerminal({ - 'welcome': 'todo list manager REPL v1.0.2
Type "help" or "copyright" for more information.

', + 'welcome': 'todo list manager REPL v1.0.3
Type "help" or "copyright" for more information.

', 'defaultCallback': default_callback, 'prompt': 'todo', 'commands': { diff --git a/web/todo.js.rb b/web/todo.js.rb index 27e0f6b..5c640c9 100644 --- a/web/todo.js.rb +++ b/web/todo.js.rb @@ -315,7 +315,12 @@ def list(tasks = nil, patterns = nil) patterns ||= [] patterns += [':active'] if (patterns & [':active', ':done', ':blocked', ':started', ':new', ':all']).empty? items = filter_tasks(tasks, patterns).sort_by do |num, task| - [task[:priority] && task[:state] != 'done' ? 0 : 1, ORDER[task[:state] || 'default'], task[:due] || 'n/a', num] + [ + task[:priority] && task[:state] != 'done' ? 0 : 1, + ORDER[task[:state] || 'default'], + task[:state] != 'done' ? task[:due] || 'n/a' : task[:modified], + num + ] end items.each do |num, task| state = task[:state] || 'default'