Show
Ignore:
Timestamp:
01/10/06 19:25:15 (3 years ago)
Author:
bob
Message:

find and findIdentical

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • mochikit/trunk/packed/MochiKit/MochiKit.js

    r489 r491  
    664664},objMin:function(){ 
    665665return MochiKit.Base.listMinMax(-1,arguments); 
    666 },nodeWalk:function(_96,_97){ 
    667 var _98=[_96]; 
    668 var _99=MochiKit.Base.extend; 
    669 while(_98.length){ 
    670 var res=_97(_98.shift()); 
     666},findIdentical:function(lst,_96,_97,end){ 
     667if(typeof (end)=="undefined"||end==null){ 
     668end=lst.length; 
     669
     670for(var i=(_97||0);i<end;i++){ 
     671if(lst[i]===_96){ 
     672return i; 
     673
     674
     675return -1; 
     676},find:function(lst,_99,_100,end){ 
     677if(typeof (end)=="undefined"||end==null){ 
     678end=lst.length; 
     679
     680var cmp=MochiKit.Base.compare; 
     681for(var i=(_100||0);i<end;i++){ 
     682if(cmp(lst[i],_99)==0){ 
     683return i; 
     684
     685
     686return -1; 
     687},nodeWalk:function(node,_102){ 
     688var _103=[node]; 
     689var _104=MochiKit.Base.extend; 
     690while(_103.length){ 
     691var res=_102(_103.shift()); 
    671692if(res){ 
    672 _99(_98,res); 
    673 } 
    674 } 
    675 },nameFunctions:function(_100){ 
    676 var base=_100.NAME; 
     693_104(_103,res); 
     694} 
     695} 
     696},nameFunctions:function(_105){ 
     697var base=_105.NAME; 
    677698if(typeof (base)=="undefined"){ 
    678699base=""; 
     
    680701base=base+"."; 
    681702} 
    682 for(var name in _100){ 
    683 var o=_100[name]; 
     703for(var name in _105){ 
     704var o=_105[name]; 
    684705if(typeof (o)=="function"&&typeof (o.NAME)=="undefined"){ 
    685706try{ 
     
    690711} 
    691712} 
    692 },queryString:function(_103,_104){ 
    693 if(typeof (MochiKit.DOM)!="undefined"&&arguments.length==1&&(typeof (_103)=="string"||(typeof (_103.nodeType)!="undefined"&&_103.nodeType>0))){ 
    694 var kv=MochiKit.DOM.formContents(_103); 
    695 _103=kv[0]; 
    696 _104=kv[1]; 
     713},queryString:function(_108,_109){ 
     714if(typeof (MochiKit.DOM)!="undefined"&&arguments.length==1&&(typeof (_108)=="string"||(typeof (_108.nodeType)!="undefined"&&_108.nodeType>0))){ 
     715var kv=MochiKit.DOM.formContents(_108); 
     716_108=kv[0]; 
     717_109=kv[1]; 
    697718}else{ 
    698719if(arguments.length==1){ 
    699 var o=_103
    700 _103=[]; 
    701 _104=[]; 
     720var o=_108
     721_108=[]; 
     722_109=[]; 
    702723for(var k in o){ 
    703724var v=o[k]; 
    704725if(typeof (v)!="function"){ 
    705 _103.push(k); 
    706 _104.push(v); 
     726_108.push(k); 
     727_109.push(v); 
    707728} 
    708729} 
     
    710731} 
    711732var rval=[]; 
    712 var len=Math.min(_103.length,_104.length); 
    713 var _108=MochiKit.Base.urlEncode; 
     733var len=Math.min(_108.length,_109.length); 
     734var _113=MochiKit.Base.urlEncode; 
    714735for(var i=0;i<len;i++){ 
    715 v=_104[i]; 
     736v=_109[i]; 
    716737if(typeof (v)!="undefined"&&v!=null){ 
    717 rval.push(_108(_103[i])+"="+_108(v)); 
     738rval.push(_113(_108[i])+"="+_113(v)); 
    718739} 
    719740} 
    720741return rval.join("&"); 
    721 },parseQueryString:function(_109,_110){ 
    722 var _111=_109.replace(/\+/g,"%20").split("&"); 
     742},parseQueryString:function(_114,_115){ 
     743var _116=_114.replace(/\+/g,"%20").split("&"); 
    723744var o={}; 
    724 var _112
     745var _117
    725746if(typeof (decodeURIComponent)!="undefined"){ 
    726 _112=decodeURIComponent; 
    727 }else{ 
    728 _112=unescape; 
    729 } 
    730 if(_110){ 
    731 for(var i=0;i<_111.length;i++){ 
    732 var pair=_111[i].split("="); 
    733 var name=_112(pair[0]); 
     747_117=decodeURIComponent; 
     748}else{ 
     749_117=unescape; 
     750} 
     751if(_115){ 
     752for(var i=0;i<_116.length;i++){ 
     753var pair=_116[i].split("="); 
     754var name=_117(pair[0]); 
    734755var arr=o[name]; 
    735756if(!(arr instanceof Array)){ 
     
    737758o[name]=arr; 
    738759} 
    739 arr.push(_112(pair[1])); 
    740 } 
    741 }else{ 
    742 for(i=0;i<_111.length;i++){ 
    743 pair=_111[i].split("="); 
    744 o[_112(pair[0])]=_112(pair[1]); 
     760arr.push(_117(pair[1])); 
     761} 
     762}else{ 
     763for(i=0;i<_116.length;i++){ 
     764pair=_116[i].split("="); 
     765o[_117(pair[0])]=_117(pair[1]); 
    745766} 
    746767} 
     
    750771this.pairs=[]; 
    751772}; 
    752 MochiKit.Base.AdapterRegistry.prototype={register:function(name,_114,wrap,_116){ 
    753 if(_116){ 
    754 this.pairs.unshift([name,_114,wrap]); 
    755 }else{ 
    756 this.pairs.push([name,_114,wrap]); 
     773MochiKit.Base.AdapterRegistry.prototype={register:function(name,_119,wrap,_121){ 
     774if(_121){ 
     775this.pairs.unshift([name,_119,wrap]); 
     776}else{ 
     777this.pairs.push([name,_119,wrap]); 
    757778} 
    758779},match:function(){ 
     
    774795return false; 
    775796}}; 
    776 MochiKit.Base.EXPORT=["counter","clone","extend","update","updatetree","setdefault","keys","items","NamedError","operator","forward","itemgetter","typeMatcher","isCallable","isUndefined","isUndefinedOrNull","isNull","isNotEmpty","isArrayLike","isDateLike","xmap","map","xfilter","filter","bind","bindMethods","NotFound","AdapterRegistry","registerComparator","compare","registerRepr","repr","objEqual","arrayEqual","concat","keyComparator","reverseKeyComparator","partial","merge","listMinMax","listMax","listMin","objMax","objMin","nodeWalk","zip","urlEncode","queryString","serializeJSON","registerJSON","evalJSON","parseQueryString"]; 
     797MochiKit.Base.EXPORT=["counter","clone","extend","update","updatetree","setdefault","keys","items","NamedError","operator","forward","itemgetter","typeMatcher","isCallable","isUndefined","isUndefinedOrNull","isNull","isNotEmpty","isArrayLike","isDateLike","xmap","map","xfilter","filter","bind","bindMethods","NotFound","AdapterRegistry","registerComparator","compare","registerRepr","repr","objEqual","arrayEqual","concat","keyComparator","reverseKeyComparator","partial","merge","listMinMax","listMax","listMin","objMax","objMin","nodeWalk","zip","urlEncode","queryString","serializeJSON","registerJSON","evalJSON","parseQueryString","find","findIdentical"]; 
    777798MochiKit.Base.EXPORT_OK=["nameFunctions","comparatorRegistry","reprRegistry","jsonRegistry","compareDateLike","compareArrayLike","reprArrayLike","reprString","reprNumber"]; 
    778 MochiKit.Base._exportSymbols=function(_117,_118){ 
     799MochiKit.Base._exportSymbols=function(_122,_123){ 
    779800if((typeof (JSAN)=="undefined"&&typeof (dojo)=="undefined")||(typeof (MochiKit.__compat__)=="boolean"&&MochiKit.__compat__)){ 
    780 var all=_118.EXPORT_TAGS[":all"]; 
     801var all=_123.EXPORT_TAGS[":all"]; 
    781802for(var i=0;i<all.length;i++){ 
    782 _117[all[i]]=_118[all[i]]; 
     803_122[all[i]]=_123[all[i]]; 
    783804} 
    784805} 
     
    787808var m=this; 
    788809if(typeof (encodeURIComponent)!="undefined"){ 
    789 m.urlEncode=function(_120){ 
    790 return encodeURIComponent(_120).replace(/\'/g,"%27"); 
    791 }; 
    792 }else{ 
    793 m.urlEncode=function(_121){ 
    794 return escape(_121).replace(/\+/g,"%2B").replace(/\"/g,"%22").rval.replace(/\'/g,"%27"); 
     810m.urlEncode=function(_125){ 
     811return encodeURIComponent(_125).replace(/\'/g,"%27"); 
     812}; 
     813}else{ 
     814m.urlEncode=function(_126){ 
     815return escape(_126).replace(/\+/g,"%2B").replace(/\"/g,"%22").rval.replace(/\'/g,"%27"); 
    795816}; 
    796817} 
     
    853874},toString:function(){ 
    854875return this.__repr__(); 
    855 },registerIteratorFactory:function(name,_122,_123,_124){ 
    856 MochiKit.Iter.iteratorRegistry.register(name,_122,_123,_124); 
    857 },iter:function(_125,_126){ 
     876},registerIteratorFactory:function(name,_127,_128,_129){ 
     877MochiKit.Iter.iteratorRegistry.register(name,_127,_128,_129); 
     878},iter:function(_130,_131){ 
    858879var self=MochiKit.Iter; 
    859880if(arguments.length==2){ 
    860881return self.takewhile(function(a){ 
    861 return a!=_126
    862 },_125); 
    863 } 
    864 if(typeof (_125.next)=="function"){ 
    865 return _125
    866 }else{ 
    867 if(typeof (_125.iter)=="function"){ 
    868 return _125.iter(); 
    869 } 
    870 } 
    871 try{ 
    872 return self.iteratorRegistry.match(_125); 
     882return a!=_131
     883},_130); 
     884} 
     885if(typeof (_130.next)=="function"){ 
     886return _130
     887}else{ 
     888if(typeof (_130.iter)=="function"){ 
     889return _130.iter(); 
     890} 
     891} 
     892try{ 
     893return self.iteratorRegistry.match(_130); 
    873894} 
    874895catch(e){ 
    875896var m=MochiKit.Base; 
    876897if(e==m.NotFound){ 
    877 e=new TypeError(typeof (_125)+": "+m.repr(_125)+" is not iterable"); 
     898e=new TypeError(typeof (_130)+": "+m.repr(_130)+" is not iterable"); 
    878899} 
    879900throw e; 
     
    891912var m=MochiKit.Base; 
    892913var lst=[]; 
    893 var _129=self.iter(p); 
     914var _134=self.iter(p); 
    894915return {repr:function(){ 
    895916return "cycle(...)"; 
    896917},toString:m.forward("repr"),next:function(){ 
    897918try{ 
    898 var rval=_129.next(); 
     919var rval=_134.next(); 
    899920lst.push(rval); 
    900921return rval; 
     
    936957return elem; 
    937958}}; 
    938 },next:function(_131){ 
    939 return _131.next(); 
     959},next:function(_136){ 
     960return _136.next(); 
    940961},izip:function(p,q){ 
    941962var m=MochiKit.Base; 
    942963var next=MochiKit.Iter.next; 
    943 var _134=m.map(iter,arguments); 
     964var _139=m.map(iter,arguments); 
    944965return {repr:function(){ 
    945966return "izip(...)"; 
    946967},toString:m.forward("repr"),next:function(){ 
    947 return m.map(next,_134); 
     968return m.map(next,_139); 
    948969}}; 
    949970},ifilter:function(pred,seq){ 
     
    9851006var m=MochiKit.Base; 
    9861007seq=self.iter(seq); 
    987 var _137=0; 
     1008var _142=0; 
    9881009var stop=0; 
    9891010var step=1; 
     
    9931014}else{ 
    9941015if(arguments.length==3){ 
    995 _137=arguments[1]; 
     1016_142=arguments[1]; 
    9961017stop=arguments[2]; 
    9971018}else{ 
    998 _137=arguments[1]; 
     1019_142=arguments[1]; 
    9991020stop=arguments[2]; 
    10001021step=arguments[3]; 
     
    10021023} 
    10031024return {repr:function(){ 
    1004 return "islice("+["...",_137,stop,step].join(", ")+")"; 
     1025return "islice("+["...",_142,stop,step].join(", ")+")"; 
    10051026},toString:m.forward("repr"),next:function(){ 
    10061027var rval; 
    1007 while(i<_137){ 
     1028while(i<_142){ 
    10081029rval=seq.next(); 
    10091030i++; 
    10101031} 
    1011 if(_137>=stop){ 
     1032if(_142>=stop){ 
    10121033throw self.StopIteration; 
    10131034} 
    1014 _137+=step; 
     1035_142+=step; 
    10151036return rval; 
    10161037}}; 
     
    10181039var m=MochiKit.Base; 
    10191040var self=MochiKit.Iter; 
    1020 var _141=m.map(self.iter,m.extend(null,arguments,1)); 
     1041var _146=m.map(self.iter,m.extend(null,arguments,1)); 
    10211042var map=m.map; 
    10221043var next=self.next; 
     
    10241045return "imap(...)"; 
    10251046},toString:m.forward("repr"),next:function(){ 
    1026 return fun.apply(this,map(next,_141)); 
     1047return fun.apply(this,map(next,_146)); 
    10271048}}; 
    10281049},applymap:function(fun,seq,self){ 
     
    10401061return self.iter(arguments[0]); 
    10411062} 
    1042 var _143=m.map(self.iter,arguments); 
     1063var _148=m.map(self.iter,arguments); 
    10431064return {repr:function(){ 
    10441065return "chain(...)"; 
    10451066},toString:m.forward("repr"),next:function(){ 
    1046 while(_143.length>1){ 
    1047 try{ 
    1048 return _143[0].next(); 
     1067while(_148.length>1){ 
     1068try{ 
     1069return _148[0].next(); 
    10491070} 
    10501071catch(e){ 
     
    10521073throw e; 
    10531074} 
    1054 _143.shift(); 
    1055 } 
    1056 } 
    1057 if(_143.length==1){ 
    1058 var arg=_143.shift(); 
     1075_148.shift(); 
     1076} 
     1077} 
     1078if(_148.length==1){ 
     1079var arg=_148.shift(); 
    10591080this.next=m.bind("next",arg); 
    10601081return this.next(); 
     
    10931114return rval; 
    10941115}}; 
    1095 },_tee:function(_145,sync,_147){ 
    1096 sync.pos[_145]=-1; 
     1116},_tee:function(_150,sync,_152){ 
     1117sync.pos[_150]=-1; 
    10971118var m=MochiKit.Base; 
    1098 var _148=m.listMin; 
     1119var _153=m.listMin; 
    10991120return {repr:function(){ 
    1100 return "tee("+_145+", ...)"; 
     1121return "tee("+_150+", ...)"; 
    11011122},toString:m.forward("repr"),next:function(){ 
    11021123var rval; 
    1103 var i=sync.pos[_145]; 
     1124var i=sync.pos[_150]; 
    11041125if(i==sync.max){ 
    1105 rval=_147.next(); 
     1126rval=_152.next(); 
    11061127sync.deque.push(rval); 
    11071128sync.max+=1; 
    1108 sync.pos[_145]+=1; 
     1129sync.pos[_150]+=1; 
    11091130}else{ 
    11101131rval=sync.deque[i-sync.min]; 
    1111 sync.pos[_145]+=1; 
    1112 if(i==sync.min&&_148(sync.pos)!=sync.min){ 
     1132sync.pos[_150]+=1; 
     1133if(i==sync.min&&_153(sync.pos)!=sync.min){ 
    11131134sync.min+=1; 
    11141135sync.deque.shift(); 
     
    11171138return rval; 
    11181139}}; 
    1119 },tee:function(_149,n){ 
     1140},tee:function(_154,n){ 
    11201141var rval=[]; 
    11211142var sync={"pos":[],"deque":[],"max":-1,"min":-1}; 
     
    11241145} 
    11251146var self=MochiKit.Iter; 
    1126 _149=self.iter(_149); 
     1147_154=self.iter(_154); 
    11271148var _tee=self._tee; 
    11281149for(var i=0;i<n;i++){ 
    1129 rval.push(_tee(i,sync,_149)); 
     1150rval.push(_tee(i,sync,_154)); 
    11301151} 
    11311152return rval; 
    1132 },list:function(_151){ 
     1153},list:function(_156){ 
    11331154var m=MochiKit.Base; 
    1134 if(typeof (_151.slice)=="function"){ 
    1135 return _151.slice(); 
    1136 }else{ 
    1137 if(m.isArrayLike(_151)){ 
    1138 return m.concat(_151); 
     1155if(typeof (_156.slice)=="function"){ 
     1156return _156.slice(); 
     1157}else{ 
     1158if(m.isArrayLike(_156)){ 
     1159return m.concat(_156); 
    11391160} 
    11401161} 
    11411162var self=MochiKit.Iter; 
    1142 _151=self.iter(_151); 
     1163_156=self.iter(_156); 
    11431164var rval=[]; 
    11441165try{ 
    11451166while(true){ 
    1146 rval.push(_151.next()); 
     1167rval.push(_156.next()); 
    11471168} 
    11481169} 
     
    11541175} 
    11551176return undefined; 
    1156 },reduce:function(fn,_152,_153){ 
     1177},reduce:function(fn,_157,_158){ 
    11571178var i=0; 
    1158 var x=_153
     1179var x=_158
    11591180var self=MochiKit.Iter; 
    1160 _152=self.iter(_152); 
     1181_157=self.iter(_157); 
    11611182if(arguments.length<3){ 
    11621183try{ 
    1163 x=_152.next(); 
     1184x=_157.next(); 
    11641185} 
    11651186catch(e){ 
     
    11731194try{ 
    11741195while(true){ 
    1175 x=fn(x,_152.next()); 
     1196x=fn(x,_157.next()); 
    11761197} 
    11771198} 
     
    11831204return x; 
    11841205},range:function(){ 
    1185 var _155=0; 
     1206var _160=0; 
    11861207var stop=0; 
    11871208var step=1; 
     
    11901211}else{ 
    11911212if(arguments.length==2){ 
    1192 _155=arguments[0]; 
     1213_160=arguments[0]; 
    11931214stop=arguments[1]; 
    11941215}else{ 
    11951216if(arguments.length==3){ 
    1196 _155=arguments[0]; 
     1217_160=arguments[0]; 
    11971218stop=arguments[1]; 
    11981219step=arguments[2]; 
     
    12061227} 
    12071228return {next:function(){ 
    1208 if((step>0&&_155>=stop)||(step<0&&_155<=stop)){ 
     1229if((step>0&&_160>=stop)||(step<0&&_160<=stop)){ 
    12091230throw MochiKit.Iter.StopIteration; 
    12101231} 
    1211 var rval=_155
    1212 _155+=step; 
     1232var rval=_160
     1233_160+=step; 
    12131234return rval; 
    12141235},repr:function(){ 
    1215 return "range("+[_155,stop,step].join(", ")+")"; 
     1236return "range("+[_160,stop,step].join(", ")+")"; 
    12161237},toString:MochiKit.Base.forward("repr")}; 
    1217 },sum:function(_156,_157){ 
    1218 var x=_157||0; 
     1238},sum:function(_161,_162){ 
     1239var x=_162||0; 
    12191240var self=MochiKit.Iter; 
    1220 _156=self.iter(_156); 
     1241_161=self.iter(_161); 
    12211242try{ 
    12221243while(true){ 
    1223 x+=_156.next(); 
     1244x+=_161.next(); 
    12241245} 
    12251246} 
     
    12301251} 
    12311252return x; 
    1232 },exhaust:function(_158){ 
     1253},exhaust:function(_163){ 
    12331254var self=MochiKit.Iter; 
    1234 _158=self.iter(_158); 
     1255_163=self.iter(_163); 
    12351256try{ 
    12361257while(true){ 
    1237 _158.next(); 
     1258_163.next(); 
    12381259} 
    12391260} 
     
    12431264} 
    12441265} 
    1245 },forEach:function(_159,func,self){ 
     1266},forEach:function(_164,func,self){ 
    12461267var m=MochiKit.Base; 
    12471268if(arguments.length>2){ 
    12481269func=m.bind(func,self); 
    12491270} 
    1250 if(m.isArrayLike(_159)){ 
    1251 try{ 
    1252 for(var i=0;i<_159.length;i++){ 
    1253 func(_159[i]); 
     1271if(m.isArrayLike(_164)){ 
     1272try{ 
     1273for(var i=0;i<_164.length;i++){ 
     1274func(_164[i]); 
    12541275} 
    12551276} 
     
    12611282}else{ 
    12621283self=MochiKit.Iter; 
    1263 self.exhaust(self.imap(func,_159)); 
    1264 } 
    1265 },every:function(_161,func){ 
     1284self.exhaust(self.imap(func,_164)); 
     1285} 
     1286},every:function(_166,func){ 
    12661287var self=MochiKit.Iter; 
    12671288try{ 
    1268 self.ifilterfalse(func,_161).next(); 
     1289self.ifilterfalse(func,_166).next(); 
    12691290return false; 
    12701291} 
     
    12751296return true; 
    12761297} 
    1277 },sorted:function(_162,cmp){ 
    1278 var rval=MochiKit.Iter.list(_162); 
     1298},sorted:function(_167,cmp){ 
     1299var rval=MochiKit.Iter.list(_167); 
    12791300if(arguments.length==1){ 
    12801301cmp=MochiKit.Base.compare; 
     
    12821303rval.sort(cmp); 
    12831304return rval; 
    1284 },reversed:function(_163){ 
    1285 var rval=MochiKit.Iter.list(_163); 
     1305},reversed:function(_168){ 
     1306var rval=MochiKit.Iter.list(_168); 
    12861307rval.reverse(); 
    12871308return rval; 
    1288 },some:function(_164,func){ 
     1309},some:function(_169,func){ 
    12891310var self=MochiKit.Iter; 
    12901311try{ 
    1291 self.ifilter(func,_164).next(); 
     1312self.ifilter(func,_169).next(); 
    12921313return true; 
    12931314} 
     
    12981319return false; 
    12991320} 
    1300 },iextend:function(lst,_165){ 
    1301 if(MochiKit.Base.isArrayLike(_165)){ 
    1302 for(var i=0;i<_165.length;i++){ 
    1303 lst.push(_165[i]); 
     1321},iextend:function(lst,_170){ 
     1322if(MochiKit.Base.isArrayLike(_170)){ 
     1323for(var i=0;i<_170.length;i++){ 
     1324lst.push(_170[i]); 
    13041325} 
    13051326}else{ 
    13061327var self=MochiKit.Iter; 
    1307 _165=self.iter(_165); 
     1328_170=self.iter(_170); 
    13081329try{ 
    13091330while(true){ 
    1310 lst.push(_165.next()); 
     1331lst.push(_170.next()); 
    13111332} 
    13121333} 
     
    13181339} 
    13191340return lst; 
    1320 },groupby:function(_166,_167){ 
     1341},groupby:function(_171,_172){ 
    13211342var m=MochiKit.Base; 
    13221343var self=MochiKit.Iter; 
    13231344if(arguments.length<2){ 
    1324 _167=m.operator.identity; 
    1325 } 
    1326 _166=self.iter(_166); 
     1345_172=m.operator.identity; 
     1346} 
     1347_171=self.iter(_171); 
    13271348var pk=undefined; 
    13281349var k=undefined; 
    13291350var v; 
    13301351function fetch(){ 
    1331 v=_166.next(); 
    1332 k=_167(v); 
     1352v=_171.next(); 
     1353k=_172(v); 
    13331354} 
    13341355function eat(){ 
     
    13371358return ret; 
    13381359} 
    1339 var _170=true; 
     1360var _175=true; 
    13401361return {repr:function(){ 
    13411362return "groupby(...)"; 
     
    13431364while(k==pk){ 
    13441365fetch(); 
    1345 if(_170){ 
    1346 _170=false; 
     1366if(_175){ 
     1367_175=false; 
    13471368break; 
    13481369} 
     
    13591380}}]; 
    13601381}}; 
    1361 },groupby_as_array:function(_171,_172){ 
     1382},groupby_as_array:function(_176,_177){ 
    13621383var m=MochiKit.Base; 
    13631384var self=MochiKit.Iter; 
    13641385if(arguments.length<2){ 
    1365 _172=m.operator.identity; 
    1366 } 
    1367 _171=self.iter(_171); 
    1368 var _173=[]; 
    1369 var _174=true; 
    1370 var _175
     1386_177=m.operator.identity; 
     1387} 
     1388_176=self.iter(_176); 
     1389var _178=[]; 
     1390var _179=true; 
     1391var _180
    13711392while(true){ 
    13721393try{ 
    1373 var _176=_171.next(); 
    1374 var key=_172(_176); 
     1394var _181=_176.next(); 
     1395var key=_177(_181); 
    13751396} 
    13761397catch(e){ 
     
    13801401throw e; 
    13811402} 
    1382 if(_174||key!=_175){ 
    1383 var _177=[]; 
    1384 _173.push([key,_177]); 
    1385 } 
    1386 _177.push(_176); 
    1387 _174=false; 
    1388 _175=key; 
    1389 } 
    1390 return _173
    1391 },arrayLikeIter:function(_178){ 
     1403if(_179||key!=_180){ 
     1404var _182=[]; 
     1405_178.push([key,_182]); 
     1406} 
     1407_182.push(_181); 
     1408_179=false; 
     1409_180=key; 
     1410} 
     1411return _178
     1412},arrayLikeIter:function(_183){ 
    13921413var i=0; 
    13931414return {repr:function(){ 
    13941415return "arrayLikeIter(...)"; 
    13951416},toString:MochiKit.Base.forward("repr"),next:function(){ 
    1396 if(i>=_178.length){ 
     1417if(i>=_183.length){ 
    13971418throw MochiKit.Iter.StopIteration; 
    13981419} 
    1399 return _178[i++]; 
     1420return _183[i++]; 
    14001421}}; 
    1401 },hasIterateNext:function(_179){ 
    1402 return (_179&&typeof (_179.iterateNext)=="function"); 
    1403 },iterateNextIter:function(_180){ 
     1422},hasIterateNext:function(_184){ 
     1423return (_184&&typeof (_184.iterateNext)=="function"); 
     1424},iterateNextIter:function(_185){ 
    14041425return {repr:function(){ 
    14051426return "iterateNextIter(...)"; 
    14061427},toString:MochiKit.Base.forward("repr"),next:function(){ 
    1407 var rval=_180.iterateNext(); 
     1428var rval=_185.iterateNext(); 
    14081429if(rval===null||rval===undefined){ 
    14091430throw MochiKit.Iter.StopIteration; 
     
    14541475MochiKit.Logging.EXPORT=["LogLevel","LogMessage","Logger","alertListener","logger","log","logError","logDebug","logFatal","logWarning"]; 
    14551476MochiKit.Logging.EXPORT_OK=["logLevelAtLeast","isLogMessage","compareLogMessage"]; 
    1456 MochiKit.Logging.LogMessage=function(num,_182,info){ 
     1477MochiKit.Logging.LogMessage=function(num,_187,info){ 
    14571478this.num=num; 
    1458 this.level=_182
     1479this.level=_187
    14591480this.info=info; 
    14601481this.timestamp=new Date(); 
     
    14641485return "LogMessage("+m.map(m.repr,[this.num,this.level,this.info]).join(", ")+")"; 
    14651486},toString:MochiKit.Base.forward("repr")}; 
    1466 MochiKit.Base.update(MochiKit.Logging,{logLevelAtLeast:function(_184){ 
     1487MochiKit.Base.update(MochiKit.Logging,{logLevelAtLeast:function(_189){ 
    14671488var self=MochiKit.Logging; 
    1468 if(typeof (_184)=="string"){ 
    1469 _184=self.LogLevel[_184]; 
     1489if(typeof (_189)=="string"){ 
     1490_189=self.LogLevel[_189]; 
    14701491} 
    14711492return function(msg){ 
    1472 var _186=msg.level; 
    1473 if(typeof (_186)=="string"){ 
    1474 _186=self.LogLevel[_186]; 
    1475 } 
    1476 return _186>=_184
     1493var _191=msg.level; 
     1494if(typeof (_191)=="string"){ 
     1495_191=self.LogLevel[_191]; 
     1496} 
     1497return _191>=_189
    14771498}; 
    14781499},isLogMessage:function(){ 
    1479 var _187=MochiKit.Logging.LogMessage; 
     1500var _192=MochiKit.Logging.LogMessage; 
    14801501for(var i=0;i<arguments.length;i++){ 
    1481 if(!(arguments[i] instanceof _187)){ 
     1502if(!(arguments[i] instanceof _192)){ 
    14821503return false; 
    14831504} 
     
    14891510alert("num: "+msg.num+"\nlevel: "+msg.level+"\ninfo: "+msg.info.join(" ")); 
    14901511}}); 
    1491 MochiKit.Logging.Logger=function(_188){ 
     1512MochiKit.Logging.Logger=function(_193){ 
    14921513this.counter=0; 
    1493 if(typeof (_188)=="undefined"||_188==null){ 
    1494 _188=-1; 
    1495 } 
    1496 this.maxSize=_188
     1514if(typeof (_193)=="undefined"||_193==null){ 
     1515_193=-1; 
     1516} 
     1517this.maxSize=_193
    14971518this._messages=[]; 
    14981519this.listeners={}; 
     
    15081529pair[1](msg); 
    15091530} 
    1510 },addListener:function(_189,_190,_191){ 
    1511 if(typeof (_190)=="string"){ 
    1512 _190=MochiKit.Logging.logLevelAtLeast(_190); 
    1513 } 
    1514 var _192=[_190,_191]; 
    1515 _192.ident=_189
    1516 this.listeners[_189]=_192
    1517 },removeListener:function(_193){ 
    1518 delete this.listeners[_193]; 
    1519 },baseLog:function(_194,_195){ 
    1520 var msg=new MochiKit.Logging.LogMessage(this.counter,_194,MochiKit.Base.extend(null,arguments,1)); 
     1531},addListener:function(_194,_195,_196){ 
     1532if(typeof (_195)=="string"){ 
     1533_195=MochiKit.Logging.logLevelAtLeast(_195); 
     1534} 
     1535var _197=[_195,_196]; 
     1536_197.ident=_194
     1537this.listeners[_194]=_197
     1538},removeListener:function(_198){ 
     1539delete this.listeners[_198]; 
     1540},baseLog:function(_199,_200){ 
     1541var msg=new MochiKit.Logging.LogMessage(this.counter,_199,MochiKit.Base.extend(null,arguments,1)); 
    15211542this._messages.push(msg); 
    15221543this.dispatchListeners(msg); 
     
    15251546this._messges.shift(); 
    15261547} 
    1527 },getMessages:function(_196){ 
    1528 var _197=0; 
    1529 if(!(typeof (_196)=="undefined"||_196==null)){ 
    1530 _197=Math.max(0,this._messages.length-_196); 
    1531 } 
    1532 return this._messages.slice(_197); 
    1533 },getMessageText:function(_198){ 
    1534 if(typeof (_198)=="undefined"||_198==null){ 
    1535 _198=30; 
    1536 } 
    1537 var _199=this.getMessages(_198); 
    1538 if(_199.length){ 
     1548},getMessages:function(_201){ 
     1549var _202=0; 
     1550if(!(typeof (_201)=="undefined"||_201==null)){ 
     1551_202=Math.max(0,this._messages.length-_201); 
     1552} 
     1553return this._messages.slice(_202); 
     1554},getMessageText:function(_203){ 
     1555if(typeof (_203)=="undefined"||_203==null){ 
     1556_203=30; 
     1557} 
     1558var _204=this.getMessages(_203); 
     1559if(_204.length){ 
    15391560var lst=map(function(m){ 
    15401561return "\n  ["+m.num+"] "+m.level+": "+m.info.join(" "); 
    1541 },_199); 
    1542 lst.unshift("LAST "+_199.length+" MESSAGES:"); 
     1562},_204); 
     1563lst.unshift("LAST "+_204.length+" MESSAGES:"); 
    15431564return lst.join(""); 
    15441565} 
    15451566return ""; 
    1546 },debuggingBookmarklet:function(_200){ 
     1567},debuggingBookmarklet:function(_205){ 
    15471568if(typeof (MochiKit.LoggingPane)=="undefined"){ 
    15481569alert(this.getMessageText()); 
    15491570}else{ 
    1550 MochiKit.LoggingPane.createLoggingPane(_200||false); 
     1571MochiKit.LoggingPane.createLoggingPane(_205||false); 
    15511572} 
    15521573}}; 
     
    15551576var m=MochiKit.Base; 
    15561577m.registerComparator("LogMessage",this.isLogMessage,this.compareLogMessage); 
    1557 var _201=m.partial; 
    1558 var _202=this.Logger; 
    1559 var _203=_202.prototype.baseLog; 
    1560 m.update(this.Logger.prototype,{debug:_201(_203,"DEBUG"),log:_201(_203,"INFO"),error:_201(_203,"ERROR"),fatal:_201(_203,"FATAL"),warning:_201(_203,"WARNING")}); 
     1578var _206=m.partial; 
     1579var _207=this.Logger; 
     1580var _208=_207.prototype.baseLog; 
     1581m.update(this.Logger.prototype,{debug:_206(_208,"DEBUG"),log:_206(_208,"INFO"),error:_206(_208,"ERROR"),fatal:_206(_208,"FATAL"),warning:_206(_208,"WARNING")}); 
    15611582var self=this; 
    1562 var _204=function(name){ 
     1583var _209=function(name){ 
    15631584return function(){ 
    15641585self.logger[name].apply(self.logger,arguments); 
    15651586}; 
    15661587}; 
    1567 this.log=_204("log"); 
    1568 this.logError=_204("error"); 
    1569 this.logDebug=_204("debug"); 
    1570 this.logFatal=_204("fatal"); 
    1571 this.logWarning=_204("warning"); 
    1572 this.logger=new _202(); 
     1588this.log=_209("log"); 
     1589this.logError=_209("error"); 
     1590this.logDebug=_209("debug"); 
     1591this.logFatal=_209("fatal"); 
     1592this.logWarning=_209("warning"); 
     1593this.logger=new _207(); 
    15731594this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; 
    15741595m.nameFunctions(this); 
     
    16491670return new Date(Date.UTC(year,month,day,hour,min,sec,msec)-ofs); 
    16501671}; 
    1651 MochiKit.DateTime.toISOTime=function(date,_210){ 
     1672MochiKit.DateTime.toISOTime=function(date,_215){ 
    16521673if(typeof (date)=="undefined"||date==null){ 
    16531674return null; 
     
    16561677var mm=date.getMinutes(); 
    16571678var ss=date.getSeconds(); 
    1658 var lst=[((_210&&(hh<10))?"0"+hh:hh),((mm<10)?"0"+mm:mm),((ss<10)?"0"+ss:ss)]; 
     1679var lst=[((_215&&(hh<10))?"0"+hh:hh),((mm<10)?"0"+mm:mm),((ss<10)?"0"+ss:ss)]; 
    16591680return lst.join(":"); 
    16601681}; 
    1661 MochiKit.DateTime.toISOTimestamp=function(date,_214){ 
     1682MochiKit.DateTime.toISOTimestamp=function(date,_219){ 
    16621683if(typeof (date)=="undefined"||date==null){ 
    16631684return null; 
    16641685} 
    1665 var sep=_214?"T":" "; 
    1666 var foot=_214?"Z":""; 
    1667 if(_214){ 
     1686var sep=_219?"T":" "; 
     1687var foot=_219?"Z":""; 
     1688if(_219){ 
    16681689date=new Date(date.getTime()+(date.getTimezoneOffset()*60000)); 
    16691690} 
    1670 return MochiKit.DateTime.toISODate(date)+sep+MochiKit.DateTime.toISOTime(date,_214)+foot; 
     1691return MochiKit.DateTime.toISODate(date)+sep+MochiKit.DateTime.toISOTime(date,_219)+foot; 
    16711692}; 
    16721693MochiKit.DateTime.toISODate=function(date){ 
     
    16741695return null; 
    16751696} 
    1676 var _217=MochiKit.DateTime._padTwo; 
    1677 return [date.getFullYear(),_217(date.getMonth()+1),_217(date.getDate())].join("-"); 
     1697var _222=MochiKit.DateTime._padTwo; 
     1698return [date.getFullYear(),_222(date.getMonth()+1),_222(date.getDate())].join("-"); 
    16781699}; 
    16791700MochiKit.DateTime.americanDate=function(d){ 
     
    16921713return null; 
    16931714} 
    1694 var _219=MochiKit.DateTime._padTwo; 
    1695 return [_219(d.getMonth()+1),_219(d.getDate()),d.getFullYear()].join("/"); 
     1715var _224=MochiKit.DateTime._padTwo; 
     1716return [_224(d.getMonth()+1),_224(d.getDate()),d.getFullYear()].join("/"); 
    16961717}; 
    16971718MochiKit.DateTime.toAmericanDate=function(d){ 
     
    17181739}; 
    17191740MochiKit.DateTime.__new__(); 
    1720 (function(_220,_221){ 
     1741(function(_225,_226){ 
    17211742if((typeof (JSAN)=="undefined"&&typeof (dojo)=="undefined")||(typeof (MochiKit.__compat__)=="boolean"&&MochiKit.__compat__)){ 
    1722 var all=_221.EXPORT_TAGS[":all"]; 
     1743var all=_226.EXPORT_TAGS[":all"]; 
    17231744for(var i=0;i<all.length;i++){ 
    1724 _220[all[i]]=_221[all[i]]; 
     1745_225[all[i]]=_226[all[i]]; 
    17251746} 
    17261747} 
     
    17431764return this.__repr__(); 
    17441765}; 
    1745 MochiKit.Format._numberFormatter=function(_222,_223,_224,_225,_226,_227,_228,_229,_230){ 
     1766MochiKit.Format._numberFormatter=function(_227,_228,_229,_230,_231,_232,_233,_234,_235){ 
    17461767return function(num){ 
    17471768num=parseFloat(num); 
    17481769if(typeof (num)=="undefined"||num==null||isNaN(num)){ 
    1749 return _222
    1750 } 
    1751 var _231=_223
    1752 var _232=_224
     1770return _227
     1771} 
     1772var _236=_228
     1773var _237=_229
    17531774if(num<0){ 
    17541775num=-num; 
    17551776}else{ 
    1756 _231=_231.replace(/-/,""); 
     1777_236=_236.replace(/-/,""); 
    17571778} 
    17581779var me=arguments.callee; 
    1759 var fmt=MochiKit.Format.formatLocale(_225); 
    1760 if(_226){ 
     1780var fmt=MochiKit.Format.formatLocale(_230); 
     1781if(_231){ 
    17611782num=num*100; 
    1762 _232=fmt.percent+_232
    1763 } 
    1764 num=MochiKit.Format.roundToFixed(num,_227); 
    1765 var _234=num.split(/\./); 
    1766 var _235=_234[0]; 
    1767 var frac=(_234.length==1)?"":_234[1]; 
     1783_237=fmt.percent+_237
     1784} 
     1785num=MochiKit.Format.roundToFixed(num,_232); 
     1786var _239=num.split(/\./); 
     1787var _240=_239[0]; 
     1788var frac=(_239.length==1)?"":_239[1]; 
    17681789var res=""; 
    1769 while(_235.length<_228){ 
    1770 _235="0"+_235
    1771 } 
    1772 if(_229){ 
    1773 while(_235.length>_229){ 
    1774 var i=_235.length-_229
    1775 res=fmt.separator+_235.substring(i,_235.length)+res; 
    1776 _235=_235.substring(0,i); 
    1777 } 
    1778 } 
    1779 res=_235+res; 
    1780 if(_227>0){ 
    1781 while(frac.length<_230){ 
     1790while(_240.length<_233){ 
     1791_240="0"+_240
     1792} 
     1793if(_234){ 
     1794while(_240.length>_234){ 
     1795var i=_240.length-_234
     1796res=fmt.separator+_240.substring(i,_240.length)+res; 
     1797_240=_240.substring(0,i); 
     1798} 
     1799} 
     1800res=_240+res; 
     1801if(_232>0){ 
     1802while(frac.length<_235){ 
    17821803frac=frac+"0"; 
    17831804} 
    17841805res=res+fmt.decimal+frac; 
    17851806} 
    1786 return _231+res+_232
    1787 }; 
    1788 }; 
    1789 MochiKit.Format.numberFormatter=function(_237,_238,_239){ 
    1790 if(typeof (_238)=="undefined"){ 
    1791 _238=""; 
    1792 } 
    1793 var _240=_237.match(/((?:[0#]+,)?[0#]+)(?:\.([0#]+))?(%)?/); 
    1794 if(!_240){ 
     1807return _236+res+_237
     1808}; 
     1809}; 
     1810MochiKit.Format.numberFormatter=function(_242,_243,_244){ 
     1811if(typeof (_243)=="undefined"){ 
     1812_243=""; 
     1813} 
     1814var _245=_242.match(/((?:[0#]+,)?[0#]+)(?:\.([0#]+))?(%)?/); 
     1815if(!_245){ 
    17951816throw TypeError("Invalid pattern"); 
    17961817} 
    1797 var _241=_237.substr(0,_240.index); 
    1798 var _242=_237.substr(_240.index+_240[0].length); 
    1799 if(_241.search(/-/)==-1){ 
    1800 _241=_241+"-"; 
    1801 } 
    1802 var _243=_240[1]; 
    1803 var frac=(typeof (_240[2])=="string"&&_240[2]!="")?_240[2]:""; 
    1804 var _244=(typeof (_240[3])=="string"&&_240[3]!=""); 
    1805 var tmp=_243.split(/,/); 
    1806 var _246
    1807 if(typeof (_239)=="undefined"){ 
    1808 _239="default"; 
     1818var _246=_242.substr(0,_245.index); 
     1819var _247=_242.substr(_245.index+_245[0].length); 
     1820if(_246.search(/-/)==-1){ 
     1821_246=_246+"-"; 
     1822} 
     1823var _248=_245[1]; 
     1824var frac=(typeof (_245[2])=="string"&&_245[2]!="")?_245[2]:""; 
     1825var _249=(typeof (_245[3])=="string"&&_245[3]!=""); 
     1826var tmp=_248.split(/,/); 
     1827var _251
     1828if(typeof (_244)=="undefined"){ 
     1829_244="default"; 
    18091830} 
    18101831if(tmp.length==1){ 
    1811 _246=null; 
    1812 }else{ 
    1813 _246=tmp[1].length; 
    1814 } 
    1815 var _247=_243.length-_243.replace(/0/g,"").length; 
    1816 var _248=frac.length-frac.replace(/0/g,"").length; 
    1817 var _249=frac.length; 
    1818 var rval=MochiKit.Format._numberFormatter(_238,_241,_242,_239,_244,_249,_247,_246,_248); 
     1832_251=null; 
     1833}else{ 
     1834_251=tmp[1].length; 
     1835} 
     1836var _252=_248.length-_248.replace(/0/g,"").length; 
     1837var _253=frac.length-frac.replace(/0/g,"").length; 
     1838var _254=frac.length; 
     1839var rval=MochiKit.Format._numberFormatter(_243,_246,_247,_244,_249,_254,_252,_251,_253); 
    18191840var m=MochiKit.Base; 
    18201841if(m){ 
     
    18271848return rval; 
    18281849}; 
    1829 MochiKit.Format.formatLocale=function(_251){ 
    1830 if(typeof (_251)=="undefined"||_251==null){ 
    1831 _251="default"; 
    1832 } 
    1833 if(typeof (_251)=="string"){ 
    1834 var rval=MochiKit.Format.LOCALE[_251]; 
     1850MochiKit.Format.formatLocale=function(_256){ 
     1851if(typeof (_256)=="undefined"||_256==null){ 
     1852_256="default"; 
     1853} 
     1854if(typeof (_256)=="string"){ 
     1855var rval=MochiKit.Format.LOCALE[_256]; 
    18351856if(typeof (rval)=="string"){ 
    18361857rval=arguments.callee(rval); 
    1837 MochiKit.Format.LOCALE[_251]=rval; 
     1858MochiKit.Format.LOCALE[_256]=rval; 
    18381859} 
    18391860return rval; 
    18401861}else{ 
    1841 return _251
    1842 } 
    1843 }; 
    1844 MochiKit.Format.twoDigitAverage=function(_252,_253){ 
    1845 if(_253){ 
    1846 var res=_252/_253
     1862return _256
     1863} 
     1864}; 
     1865MochiKit.Format.twoDigitAverage=function(_257,_258){ 
     1866if(_258){ 
     1867var res=_257/_258
    18471868if(!isNaN(res)){ 
    1848 return MochiKit.Format.twoDigitFloat(_252/_253); 
     1869return MochiKit.Format.twoDigitFloat(_257/_258); 
    18491870} 
    18501871} 
    18511872return "0"; 
    18521873}; 
    1853 MochiKit.Format.twoDigitFloat=function(_254){ 
    1854 var sign=(_254<0?"-":""); 
    1855 var s=Math.floor(Math.abs(_254)*100).toString(); 
     1874MochiKit.Format.twoDigitFloat=function(_259){ 
     1875var sign=(_259<0?"-":""); 
     1876var s=Math.floor(Math.abs(_259)*100).toString(); 
    18561877if(s=="0"){ 
    18571878return s; 
     
    18751896} 
    18761897}; 
    1877 MochiKit.Format.lstrip=function(str,_259){ 
     1898MochiKit.Format.lstrip=function(str,_264){ 
    18781899str=str+""; 
    18791900if(typeof (str)!="string"){ 
    18801901return null; 
    18811902} 
    1882 if(!_259){ 
     1903if(!_264){ 
    18831904return str.replace(/^\s+/,""); 
    18841905}else{ 
    1885 return str.replace(new RegExp("^["+_259+"]+"),""); 
    1886 } 
    1887 }; 
    1888 MochiKit.Format.rstrip=function(str,_260){ 
     1906return str.replace(new RegExp("^["+_264+"]+"),""); 
     1907} 
     1908}; 
     1909MochiKit.Format.rstrip=function(str,_265){ 
    18891910str=str+""; 
    18901911if(typeof (str)!="string"){ 
    18911912return null; 
    18921913} 
    1893 if(!_260){ 
     1914if(!_265){ 
    18941915return str.replace(/\s+$/,""); 
    18951916}else{ 
    1896 return str.replace(new RegExp("["+_260+"]+$"),""); 
    1897 } 
    1898 }; 
    1899 MochiKit.Format.strip=function(str,_261){ 
     1917return str.replace(new RegExp("["+_265+"]+$"),""); 
     1918} 
     1919}; 
     1920MochiKit.Format.strip=function(str,_266){ 
    19001921var self=MochiKit.Format; 
    1901 return self.rstrip(self.lstrip(str,_261),_261); 
    1902 }; 
    1903 MochiKit.Format.truncToFixed=function(_262,_263){ 
    1904 _262=Math.floor(_262*Math.pow(10,_263)); 
    1905 var res=(_262*Math.pow(10,-_263)).toFixed(_263); 
     1922return self.rstrip(self.lstrip(str,_266),_266); 
     1923}; 
     1924MochiKit.Format.truncToFixed=function(_267,_268){ 
     1925_267=Math.floor(_267*Math.pow(10,_268)); 
     1926var res=(_267*Math.pow(10,-_268)).toFixed(_268); 
    19061927if(res.charAt(0)=="."){ 
    19071928res="0"+res; 
     
    19091930return res; 
    19101931}; 
    1911 MochiKit.Format.roundToFixed=function(_264,_265){ 
    1912 return MochiKit.Format.truncToFixed(_264+0.5*Math.pow(10,-_265),_265); 
    1913 }; 
    1914 MochiKit.Format.percentFormat=function(_266){ 
    1915 return MochiKit.Format.twoDigitFloat(100*_266)+"%"; 
     1932MochiKit.Format.roundToFixed=function(_269,_270){ 
     1933return MochiKit.Format.truncToFixed(_269+0.5*Math.pow(10,-_270),_270</