/***

    MochiKit.MochiKit 1.5 : PACKED VERSION

    THIS FILE IS AUTOMATICALLY GENERATED.  If creating patches, please
    diff against the source tree, not this file.

    See <http://mochikit.com/> for documentation, downloads, license, etc.

    (c) 2005 Bob Ippolito.  All rights Reserved.

    CONTAINS ALL NON-WEB MODULES: Base, DateTime, Format, Text, Iter.

***/

if(typeof (MochiKit)=="undefined"){
MochiKit={};
}
if(typeof (MochiKit.__export__)=="undefined"){
MochiKit.__export__=true;
}
if(typeof (MochiKit.Base)=="undefined"){
MochiKit.Base={};
}
MochiKit.Base._module=function(_1,_2,_3){
if(!(_1 in MochiKit)){
MochiKit[_1]={};
}
var _4=MochiKit[_1];
_4.NAME="MochiKit."+_1;
_4.VERSION=_2;
_4.__repr__=function(){
return "["+this.NAME+" "+this.VERSION+"]";
};
_4.toString=function(){
return this.__repr__();
};
for(var i=0;i<_3.length;i++){
if(!(_3[i] in MochiKit)){
throw "MochiKit."+_1+" depends on MochiKit."+_3[i]+"!";
}
}
};
MochiKit.Base._module("Base","1.5",[]);
MochiKit.Base.update=function(_6,_7){
if(_6===null||_6===undefined){
_6={};
}
for(var i=1;i<arguments.length;i++){
var o=arguments[i];
if(typeof (o)!="undefined"&&o!==null){
for(var k in o){
_6[k]=o[k];
}
}
}
return _6;
};
MochiKit.Base.update(MochiKit.Base,{camelize:function(_b){
var _c=_b.split("-");
var cc=_c[0];
for(var i=1;i<_c.length;i++){
cc+=_c[i].charAt(0).toUpperCase()+_c[i].substring(1);
}
return cc;
},counter:function(n){
if(arguments.length===0){
n=1;
}
return function(){
return n++;
};
},clone:function(obj){
var me=arguments.callee;
if(arguments.length==1){
me.prototype=obj;
return new me();
}
},_flattenArray:function(res,lst){
for(var i=0;i<lst.length;i++){
var o=lst[i];
if(o instanceof Array){
arguments.callee(res,o);
}else{
res.push(o);
}
}
return res;
},flattenArray:function(lst){
return MochiKit.Base._flattenArray([],lst);
},flattenArguments:function(lst){
var res=[];
var m=MochiKit.Base;
var _1a=m.extend(null,arguments);
while(_1a.length){
var o=_1a.shift();
if(o&&typeof (o)=="object"&&typeof (o.length)=="number"){
for(var i=o.length-1;i>=0;i--){
_1a.unshift(o[i]);
}
}else{
res.push(o);
}
}
return res;
},extend:function(_1d,obj,_1f){
if(!_1f){
_1f=0;
}
if(obj){
var l=obj.length;
if(typeof (l)!="number"){
if(typeof (MochiKit.Iter)!="undefined"){
obj=MochiKit.Iter.list(obj);
l=obj.length;
}else{
throw new TypeError("Argument not an array-like and MochiKit.Iter not present");
}
}
if(!_1d){
_1d=[];
}
for(var i=_1f;i<l;i++){
_1d.push(obj[i]);
}
}
return _1d;
},updatetree:function(_22,obj){
if(_22===null||_22===undefined){
_22={};
}
for(var i=1;i<arguments.length;i++){
var o=arguments[i];
if(typeof (o)!="undefined"&&o!==null){
for(var k in o){
var v=o[k];
if(typeof (_22[k])=="object"&&typeof (v)=="object"){
arguments.callee(_22[k],v);
}else{
_22[k]=v;
}
}
}
}
return _22;
},setdefault:function(_28,obj){
if(_28===null||_28===undefined){
_28={};
}
for(var i=1;i<arguments.length;i++){
var o=arguments[i];
for(var k in o){
if(!(k in _28)){
_28[k]=o[k];
}
}
}
return _28;
},keys:function(obj){
var _2e=[];
for(var _2f in obj){
_2e.push(_2f);
}
return _2e;
},values:function(obj){
var _31=[];
for(var _32 in obj){
_31.push(obj[_32]);
}
return _31;
},items:function(obj){
var _34=[];
var e;
for(var _36 in obj){
var v;
try{
v=obj[_36];
}
catch(e){
continue;
}
_34.push([_36,v]);
}
return _34;
},_newNamedError:function(_38,_39,_3a){
_3a.prototype=new MochiKit.Base.NamedError(_38.NAME+"."+_39);
_38[_39]=_3a;
},operator:{truth:function(a){
return !!a;
},lognot:function(a){
return !a;
},identity:function(a){
return a;
},not:function(a){
return ~a;
},neg:function(a){
return -a;
},add:function(a,b){
return a+b;
},sub:function(a,b){
return a-b;
},div:function(a,b){
return a/b;
},mod:function(a,b){
return a%b;
},mul:function(a,b){
return a*b;
},and:function(a,b){
return a&b;
},or:function(a,b){
return a|b;
},xor:function(a,b){
return a^b;
},lshift:function(a,b){
return a<<b;
},rshift:function(a,b){
return a>>b;
},zrshift:function(a,b){
return a>>>b;
},eq:function(a,b){
return a==b;
},ne:function(a,b){
return a!=b;
},gt:function(a,b){
return a>b;
},ge:function(a,b){
return a>=b;
},lt:function(a,b){
return a<b;
},le:function(a,b){
return a<=b;
},seq:function(a,b){
return a===b;
},sne:function(a,b){
return a!==b;
},ceq:function(a,b){
return MochiKit.Base.compare(a,b)===0;
},cne:function(a,b){
return MochiKit.Base.compare(a,b)!==0;
},cgt:function(a,b){
return MochiKit.Base.compare(a,b)==1;
},cge:function(a,b){
return MochiKit.Base.compare(a,b)!=-1;
},clt:function(a,b){
return MochiKit.Base.compare(a,b)==-1;
},cle:function(a,b){
return MochiKit.Base.compare(a,b)!=1;
},logand:function(a,b){
return a&&b;
},logor:function(a,b){
return a||b;
},contains:function(a,b){
return b in a;
}},forwardCall:function(_78){
return function(){
return this[_78].apply(this,arguments);
};
},itemgetter:function(_79){
return function(arg){
return arg[_79];
};
},bool:function(_7b){
if(typeof (_7b)==="boolean"||_7b instanceof Boolean){
return _7b.valueOf();
}else{
if(typeof (_7b)==="string"||_7b instanceof String){
return _7b.length>0&&_7b!="false"&&_7b!="null"&&_7b!="undefined"&&_7b!="0";
}else{
if(typeof (_7b)==="number"||_7b instanceof Number){
return !isNaN(_7b)&&_7b!=0;
}else{
if(_7b!=null&&typeof (_7b.length)==="number"){
return _7b.length!==0;
}else{
return _7b!=null;
}
}
}
}
},typeMatcher:function(){
var _7c={};
for(var i=0;i<arguments.length;i++){
var typ=arguments[i];
_7c[typ]=typ;
}
return function(){
for(var i=0;i<arguments.length;i++){
if(!(typeof (arguments[i]) in _7c)){
return false;
}
}
return true;
};
},isNull:function(){
for(var i=0;i<arguments.length;i++){
if(arguments[i]!==null){
return false;
}
}
return true;
},isUndefinedOrNull:function(){
for(var i=0;i<arguments.length;i++){
var o=arguments[i];
if(!(typeof (o)=="undefined"||o===null)){
return false;
}
}
return true;
},isEmpty:function(obj){
return !MochiKit.Base.isNotEmpty.apply(this,arguments);
},isNotEmpty:function(obj){
for(var i=0;i<arguments.length;i++){
var o=arguments[i];
if(!(o&&o.length)){
return false;
}
}
return true;
},isArrayLike:function(){
for(var i=0;i<arguments.length;i++){
var o=arguments[i];
var typ=typeof (o);
if((typ!="object"&&!(typ=="function"&&typeof (o.item)=="function"))||o===null||typeof (o.length)!="number"||o.nodeType===3||o.nodeType===4){
return false;
}
}
return true;
},isDateLike:function(){
for(var i=0;i<arguments.length;i++){
var o=arguments[i];
if(typeof (o)!="object"||o===null||typeof (o.getTime)!="function"){
return false;
}
}
return true;
},xmap:function(fn){
if(fn===null){
return MochiKit.Base.extend(null,arguments,1);
}
var _8d=[];
for(var i=1;i<arguments.length;i++){
_8d.push(fn(arguments[i]));
}
return _8d;
},map:function(fn,lst){
var m=MochiKit.Base;
var itr=MochiKit.Iter;
var _93=m.isArrayLike;
if(arguments.length<=2){
if(!_93(lst)){
if(itr){
lst=itr.list(lst);
if(fn===null){
return lst;
}
}else{
throw new TypeError("Argument not an array-like and MochiKit.Iter not present");
}
}
if(fn===null){
return m.extend(null,lst);
}
var _94=[];
for(var i=0;i<lst.length;i++){
_94.push(fn(lst[i]));
}
return _94;
}else{
if(fn===null){
fn=Array;
}
var _96=null;
for(var i=1;i<arguments.length;i++){
if(!_93(arguments[i])){
if(itr){
return itr.list(itr.imap.apply(null,arguments));
}else{
throw new TypeError("Argument not an array-like and MochiKit.Iter not present");
}
}
var l=arguments[i].length;
if(_96===null||_96>l){
_96=l;
}
}
_94=[];
for(var i=0;i<_96;i++){
var _98=[];
for(var j=1;j<arguments.length;j++){
_98.push(arguments[j][i]);
}
_94.push(fn.apply(this,_98));
}
return _94;
}
},xfilter:function(fn){
var _9b=[];
if(fn===null){
fn=MochiKit.Base.operator.truth;
}
for(var i=1;i<arguments.length;i++){
var o=arguments[i];
if(fn(o)){
_9b.push(o);
}
}
return _9b;
},filter:function(fn,lst,_a0){
var _a1=[];
var m=MochiKit.Base;
if(!m.isArrayLike(lst)){
if(MochiKit.Iter){
lst=MochiKit.Iter.list(lst);
}else{
throw new TypeError("Argument not an array-like and MochiKit.Iter not present");
}
}
if(fn===null){
fn=m.operator.truth;
}
if(typeof (Array.prototype.filter)=="function"){
return Array.prototype.filter.call(lst,fn,_a0);
}else{
if(typeof (_a0)=="undefined"||_a0===null){
for(var i=0;i<lst.length;i++){
var o=lst[i];
if(fn(o)){
_a1.push(o);
}
}
}else{
for(var i=0;i<lst.length;i++){
o=lst[i];
if(fn.call(_a0,o)){
_a1.push(o);
}
}
}
}
return _a1;
},_wrapDumbFunction:function(_a5){
return function(){
switch(arguments.length){
case 0:
return _a5();
case 1:
return _a5(arguments[0]);
case 2:
return _a5(arguments[0],arguments[1]);
case 3:
return _a5(arguments[0],arguments[1],arguments[2]);
}
var _a6=[];
for(var i=0;i<arguments.length;i++){
_a6.push("arguments["+i+"]");
}
return eval("(func("+_a6.join(",")+"))");
};
},methodcaller:function(_a8){
var _a9=MochiKit.Base.extend(null,arguments,1);
if(typeof (_a8)=="function"){
return function(obj){
return _a8.apply(obj,_a9);
};
}else{
return function(obj){
return obj[_a8].apply(obj,_a9);
};
}
},method:function(_ac,_ad){
var m=MochiKit.Base;
return m.bind.apply(this,m.extend([_ad,_ac],arguments,2));
},compose:function(f1,f2){
var _b1=[];
var m=MochiKit.Base;
if(arguments.length===0){
throw new TypeError("compose() requires at least one argument");
}
for(var i=0;i<arguments.length;i++){
var fn=arguments[i];
if(typeof (fn)!="function"){
throw new TypeError(m.repr(fn)+" is not a function");
}
_b1.push(fn);
}
return function(){
var _b5=arguments;
for(var i=_b1.length-1;i>=0;i--){
_b5=[_b1[i].apply(this,_b5)];
}
return _b5[0];
};
},bind:function(_b7,_b8){
if(typeof (_b7)=="string"){
_b7=_b8[_b7];
}
var _b9=_b7.im_func;
var _ba=_b7.im_preargs;
var _bb=_b7.im_self;
var m=MochiKit.Base;
if(typeof (_b7)=="function"&&typeof (_b7.apply)=="undefined"){
_b7=m._wrapDumbFunction(_b7);
}
if(typeof (_b9)!="function"){
_b9=_b7;
}
if(typeof (_b8)!="undefined"){
_bb=_b8;
}
if(typeof (_ba)=="undefined"){
_ba=[];
}else{
_ba=_ba.slice();
}
m.extend(_ba,arguments,2);
var _bd=function(){
var _be=arguments;
var me=arguments.callee;
if(me.im_preargs.length>0){
_be=m.concat(me.im_preargs,_be);
}
var _c0=me.im_self;
if(!_c0){
_c0=this;
}
return me.im_func.apply(_c0,_be);
};
_bd.im_self=_bb;
_bd.im_func=_b9;
_bd.im_preargs=_ba;
return _bd;
},bindLate:function(_c1,_c2){
var m=MochiKit.Base;
var _c4=arguments;
if(typeof (_c1)==="string"){
_c4=m.extend([m.forwardCall(_c1)],arguments,1);
return m.bind.apply(this,_c4);
}
return m.bind.apply(this,_c4);
},bindMethods:function(_c5){
var _c6=MochiKit.Base.bind;
for(var k in _c5){
var _c8=_c5[k];
if(typeof (_c8)=="function"){
_c5[k]=_c6(_c8,_c5);
}
}
},registerComparator:function(_c9,_ca,_cb,_cc){
MochiKit.Base.comparatorRegistry.register(_c9,_ca,_cb,_cc);
},_primitives:{"boolean":true,"string":true,"number":true},compare:function(a,b){
if(a==b){
return 0;
}
var _cf=(typeof (a)=="undefined"||a===null);
var _d0=(typeof (b)=="undefined"||b===null);
if(_cf&&_d0){
return 0;
}else{
if(_cf){
return -1;
}else{
if(_d0){
return 1;
}
}
}
var m=MochiKit.Base;
var _d2=m._primitives;
if(!(typeof (a) in _d2&&typeof (b) in _d2)){
try{
return m.comparatorRegistry.match(a,b);
}
catch(e){
if(e!=m.NotFound){
throw e;
}
}
}
if(a<b){
return -1;
}else{
if(a>b){
return 1;
}
}
var _d3=m.repr;
throw new TypeError(_d3(a)+" and "+_d3(b)+" can not be compared");
},compareDateLike:function(a,b){
return MochiKit.Base.compare(a.getTime(),b.getTime());
},compareArrayLike:function(a,b){
var _d8=MochiKit.Base.compare;
var _d9=a.length;
var _da=0;
if(_d9>b.length){
_da=1;
_d9=b.length;
}else{
if(_d9<b.length){
_da=-1;
}
}
for(var i=0;i<_d9;i++){
var cmp=_d8(a[i],b[i]);
if(cmp){
return cmp;
}
}
return _da;
},registerRepr:function(_dd,_de,_df,_e0){
MochiKit.Base.reprRegistry.register(_dd,_de,_df,_e0);
},repr:function(o){
if(typeof (o)=="undefined"){
return "undefined";
}else{
if(o===null){
return "null";
}
}
try{
if(typeof (o.__repr__)=="function"){
return o.__repr__();
}else{
if(typeof (o.repr)=="function"&&o.repr!=arguments.callee){
return o.repr();
}
}
return MochiKit.Base.reprRegistry.match(o);
}
catch(e){
if(typeof (o.NAME)=="string"&&(o.toString==Function.prototype.toString||o.toString==Object.prototype.toString)){
return o.NAME;
}
}
try{
var _e2=(o+"");
}
catch(e){
return "["+typeof (o)+"]";
}
if(typeof (o)=="function"){
_e2=_e2.replace(/^\s+/,"").replace(/\s+/g," ");
_e2=_e2.replace(/,(\S)/,", $1");
var idx=_e2.indexOf("{");
if(idx!=-1){
_e2=_e2.substr(0,idx)+"{...}";
}
}
return _e2;
},reprArrayLike:function(o){
var m=MochiKit.Base;
return "["+m.map(m.repr,o).join(", ")+"]";
},reprString:function(o){
return ("\""+o.replace(/(["\\])/g,"\\$1")+"\"").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\v]/g,"\\v").replace(/[\r]/g,"\\r");
},reprNumber:function(o){
return o+"";
},registerJSON:function(_e8,_e9,_ea,_eb){
MochiKit.Base.jsonRegistry.register(_e8,_e9,_ea,_eb);
},evalJSON:function(){
return eval("("+MochiKit.Base._filterJSON(arguments[0])+")");
},_filterJSON:function(s){
var m=s.match(/^\s*\/\*(.*)\*\/\s*$/);
if(m){
return m[1];
}
return s;
},serializeJSON:function(o){
var _ef=typeof (o);
if(_ef=="number"||_ef=="boolean"){
return o+"";
}else{
if(o===null){
return "null";
}else{
if(_ef=="string"){
var res="";
for(var i=0;i<o.length;i++){
var c=o.charAt(i);
if(c=="\""){
res+="\\\"";
}else{
if(c=="\\"){
res+="\\\\";
}else{
if(c=="\b"){
res+="\\b";
}else{
if(c=="\f"){
res+="\\f";
}else{
if(c=="\n"){
res+="\\n";
}else{
if(c=="\r"){
res+="\\r";
}else{
if(c=="\t"){
res+="\\t";
}else{
if(o.charCodeAt(i)<=31){
var hex=o.charCodeAt(i).toString(16);
if(hex.length<2){
hex="0"+hex;
}
res+="\\u00"+hex.toUpperCase();
}else{
res+=c;
}
}
}
}
}
}
}
}
}
return "\""+res+"\"";
}
}
}
var me=arguments.callee;
var _f5;
if(o === undefined) return "[UNDEFINED]"; // Kripken: Added this!
if(typeof (o.__json__)=="function"){
_f5=o.__json__();
if(o!==_f5){
return me(_f5);
}
}
if(typeof (o.json)=="function"){
_f5=o.json();
if(o!==_f5){
return me(_f5);
}
}
if(_ef!="function"&&typeof (o.length)=="number"){
var res=[];
for(var i=0;i<o.length;i++){
var val=me(o[i]);
if(typeof (val)!="string"){
continue;
}
res.push(val);
}
return "["+res.join(", ")+"]";
}
var m=MochiKit.Base;
try{
_f5=m.jsonRegistry.match(o);
if(o!==_f5){
return me(_f5);
}
}
catch(e){
if(e!=m.NotFound){
throw e;
}
}
if(_ef=="undefined"){
throw new TypeError("undefined can not be serialized as JSON");
}
if(_ef=="function"){
return null;
}
res=[];
for(var k in o){
var _f9;
if(typeof (k)=="number"){
_f9="\""+k+"\"";
}else{
if(typeof (k)=="string"){
_f9=me(k);
}else{
continue;
}
}
val=me(o[k]);
if(typeof (val)!="string"){
continue;
}
res.push(_f9+":"+val);
}
return "{"+res.join(", ")+"}";
},objEqual:function(a,b){
return (MochiKit.Base.compare(a,b)===0);
},arrayEqual:function(_fc,arr){
if(_fc.length!=arr.length){
return false;
}
return (MochiKit.Base.compare(_fc,arr)===0);
},concat:function(){
var _fe=[];
var _ff=MochiKit.Base.extend;
for(var i=0;i<arguments.length;i++){
_ff(_fe,arguments[i]);
}
return _fe;
},keyComparator:function(key){
var m=MochiKit.Base;
var _103=m.compare;
if(arguments.length==1){
return function(a,b){
return _103(a[key],b[key]);
};
}
var _106=m.extend(null,arguments);
return function(a,b){
var rval=0;
for(var i=0;(rval===0)&&(i<_106.length);i++){
var key=_106[i];
rval=_103(a[key],b[key]);
}
return rval;
};
},reverseKeyComparator:function(key){
var _10d=MochiKit.Base.keyComparator.apply(this,arguments);
return function(a,b){
return _10d(b,a);
};
},partial:function(func){
var m=MochiKit.Base;
return m.bind.apply(this,m.extend([func,undefined],arguments,1));
},listMinMax:function(_112,lst){
if(lst.length===0){
return null;
}
var cur=lst[0];
var _115=MochiKit.Base.compare;
for(var i=1;i<lst.length;i++){
var o=lst[i];
if(_115(o,cur)==_112){
cur=o;
}
}
return cur;
},objMax:function(){
return MochiKit.Base.listMinMax(1,arguments);
},objMin:function(){
return MochiKit.Base.listMinMax(-1,arguments);
},findIdentical:function(lst,_119,_11a,end){
if(typeof (end)=="undefined"||end===null){
end=lst.length;
}
if(typeof (_11a)=="undefined"||_11a===null){
_11a=0;
}
for(var i=_11a;i<end;i++){
if(lst[i]===_119){
return i;
}
}
return -1;
},mean:function(){
var sum=0;
var m=MochiKit.Base;
var args=m.extend(null,arguments);
var _120=args.length;
while(args.length){
var o=args.shift();
if(o&&typeof (o)=="object"&&typeof (o.length)=="number"){
_120+=o.length-1;
for(var i=o.length-1;i>=0;i--){
sum+=o[i];
}
}else{
sum+=o;
}
}
if(_120<=0){
throw new TypeError("mean() requires at least one argument");
}
return sum/_120;
},median:function(){
var data=MochiKit.Base.flattenArguments(arguments);
if(data.length===0){
throw new TypeError("median() requires at least one argument");
}
data.sort(compare);
if(data.length%2==0){
var _124=data.length/2;
return (data[_124]+data[_124-1])/2;
}else{
return data[(data.length-1)/2];
}
},findValue:function(lst,_126,_127,end){
if(typeof (end)=="undefined"||end===null){
end=lst.length;
}
if(typeof (_127)=="undefined"||_127===null){
_127=0;
}
var cmp=MochiKit.Base.compare;
for(var i=_127;i<end;i++){
if(cmp(lst[i],_126)===0){
return i;
}
}
return -1;
},nodeWalk:function(node,_12c){
var _12d=[node];
var _12e=MochiKit.Base.extend;
while(_12d.length){
var res=_12c(_12d.shift());
if(res){
_12e(_12d,res);
}
}
},nameFunctions:function(_130){
var base=_130.NAME;
if(typeof (base)=="undefined"){
base="";
}else{
base=base+".";
}
for(var name in _130){
var o=_130[name];
if(typeof (o)=="function"&&typeof (o.NAME)=="undefined"){
try{
o.NAME=base+name;
}
catch(e){
}
}
}
},queryString:function(_134,_135){
if(typeof (MochiKit.DOM)!="undefined"&&arguments.length==1&&(typeof (_134)=="string"||(typeof (_134.nodeType)!="undefined"&&_134.nodeType>0))){
var kv=MochiKit.DOM.formContents(_134);
_134=kv[0];
_135=kv[1];
}else{
if(arguments.length==1){
if(typeof (_134.length)=="number"&&_134.length==2){
return arguments.callee(_134[0],_134[1]);
}
var o=_134;
_134=[];
_135=[];
for(var k in o){
var v=o[k];
if(typeof (v)=="function"){
continue;
}else{
if(MochiKit.Base.isArrayLike(v)){
for(var i=0;i<v.length;i++){
_134.push(k);
_135.push(v[i]);
}
}else{
_134.push(k);
_135.push(v);
}
}
}
}
}
var rval=[];
var len=Math.min(_134.length,_135.length);
var _13d=MochiKit.Base.urlEncode;
for(var i=0;i<len;i++){
v=_135[i];
if(typeof (v)!="undefined"&&v!==null){
rval.push(_13d(_134[i])+"="+_13d(v));
}
}
return rval.join("&");
},parseQueryString:function(_13e,_13f){
var qstr=(_13e.charAt(0)=="?")?_13e.substring(1):_13e;
var _141=qstr.replace(/\+/g,"%20").split(/\&amp\;|\&\#38\;|\&#x26;|\&/);
var o={};
var _143;
if(typeof (decodeURIComponent)!="undefined"){
_143=decodeURIComponent;
}else{
_143=unescape;
}
if(_13f){
for(var i=0;i<_141.length;i++){
var pair=_141[i].split("=");
var name=_143(pair.shift());
if(!name){
continue;
}
var arr=o[name];
if(!(arr instanceof Array)){
arr=[];
o[name]=arr;
}
arr.push(_143(pair.join("=")));
}
}else{
for(var i=0;i<_141.length;i++){
pair=_141[i].split("=");
var name=pair.shift();
if(!name){
continue;
}
o[_143(name)]=_143(pair.join("="));
}
}
return o;
}});
MochiKit.Base.AdapterRegistry=function(){
this.pairs=[];
};
MochiKit.Base.AdapterRegistry.prototype={register:function(name,_149,wrap,_14b){
if(_14b){
this.pairs.unshift([name,_149,wrap]);
}else{
this.pairs.push([name,_149,wrap]);
}
},match:function(){
for(var i=0;i<this.pairs.length;i++){
var pair=this.pairs[i];
if(pair[1].apply(this,arguments)){
return pair[2].apply(this,arguments);
}
}
throw MochiKit.Base.NotFound;
},unregister:function(name){
for(var i=0;i<this.pairs.length;i++){
var pair=this.pairs[i];
if(pair[0]==name){
this.pairs.splice(i,1);
return true;
}
}
return false;
}};
MochiKit.Base._exportSymbols=function(_151,_152){
if(MochiKit.__export__===false||_152.__export__===false){
return;
}
for(var k in _152){
var v=_152[k];
if(v!=null){
var _155=(k[0]!=="_"&&k!=="toString");
if(v.__export__===true||(v.__export__!==false&&_155)){
_151[k]=_152[k];
}
}
}
};
MochiKit.Base._deprecated=function(_156,name,_158,_159,_15a){
if(typeof (_156)==="string"){
if(_156.indexOf("MochiKit.")===0){
_156=_156.substring(9);
}
_156=MochiKit[_156];
}
var _15b=_158.split(".")[1];
var _15c=_158.split(".")[2];
var func=function(){
var self=arguments.callee;
var msg=_156.NAME+"."+name+" is deprecated since version "+_159+". Use "+_158+" instead.";
if(self.logged!==true){
self.logged=true;
if(MochiKit.Logging){
MochiKit.Logging.logDebug(msg);
}else{
if(console&&console.log){
console.log(msg);
}
}
}
if(!MochiKit[_15b]){
throw new Error(msg);
}
return MochiKit[_15b][_15c].apply(this,arguments);
};
func.__export__=(_15a===true);
_156[name]=func;
};
MochiKit.Base.__new__=function(){
var m=this;
m.noop=m.operator.identity;
m._deprecated(m,"forward","MochiKit.Base.forwardCall","1.3");
m._deprecated(m,"find","MochiKit.Base.findValue","1.3");
if(typeof (encodeURIComponent)!="undefined"){
m.urlEncode=function(_161){
return encodeURIComponent(_161).replace(/\'/g,"%27");
};
}else{
m.urlEncode=function(_162){
return escape(_162).replace(/\+/g,"%2B").replace(/\"/g,"%22").rval.replace(/\'/g,"%27");
};
}
m.NamedError=function(name){
this.message=name;
this.name=name;
};
m.NamedError.prototype=new Error();
m.update(m.NamedError.prototype,{repr:function(){
if(this.message&&this.message!=this.name){
return this.name+"("+m.repr(this.message)+")";
}else{
return this.name+"()";
}
},toString:m.forwardCall("repr")});
m.NotFound=new m.NamedError("MochiKit.Base.NotFound");
m.listMax=m.partial(m.listMinMax,1);
m.listMin=m.partial(m.listMinMax,-1);
m.isCallable=m.typeMatcher("function");
m.isUndefined=m.typeMatcher("undefined");
m.merge=m.partial(m.update,null);
m.zip=m.partial(m.map,null);
m.average=m.mean;
m.comparatorRegistry=new m.AdapterRegistry();
m.registerComparator("dateLike",m.isDateLike,m.compareDateLike);
m.registerComparator("arrayLike",m.isArrayLike,m.compareArrayLike);
m.reprRegistry=new m.AdapterRegistry();
m.registerRepr("arrayLike",m.isArrayLike,m.reprArrayLike);
m.registerRepr("string",m.typeMatcher("string"),m.reprString);
m.registerRepr("numbers",m.typeMatcher("number","boolean"),m.reprNumber);
m.jsonRegistry=new m.AdapterRegistry();
m.nameFunctions(this);
};
MochiKit.Base.__new__();
if(MochiKit.__export__){
compare=MochiKit.Base.compare;
compose=MochiKit.Base.compose;
serializeJSON=MochiKit.Base.serializeJSON;
mean=MochiKit.Base.mean;
median=MochiKit.Base.median;
}
MochiKit.Base._exportSymbols(this,MochiKit.Base);
MochiKit.Base._module("Iter","1.5",["Base"]);
MochiKit.Base.update(MochiKit.Iter,{registerIteratorFactory:function(name,_165,_166,_167){
MochiKit.Iter.iteratorRegistry.register(name,_165,_166,_167);
},isIterable:function(o){
return o!=null&&(typeof (o.next)=="function"||typeof (o.iter)=="function");
},iter:function(_169,_16a){
var self=MochiKit.Iter;
if(arguments.length==2){
return self.takewhile(function(a){
return a!=_16a;
},_169);
}
if(typeof (_169.next)=="function"){
return _169;
}else{
if(typeof (_169.iter)=="function"){
return _169.iter();
}
}
try{
return self.iteratorRegistry.match(_169);
}
catch(e){
var m=MochiKit.Base;
if(e==m.NotFound){
e=new TypeError(typeof (_169)+": "+m.repr(_169)+" is not iterable");
}
throw e;
}
},count:function(n){
if(!n){
n=0;
}
var m=MochiKit.Base;
return {repr:function(){
return "count("+n+")";
},toString:m.forwardCall("repr"),next:m.counter(n)};
},cycle:function(p){
var self=MochiKit.Iter;
var m=MochiKit.Base;
var lst=[];
var _174=self.iter(p);
return {repr:function(){
return "cycle(...)";
},toString:m.forwardCall("repr"),next:function(){
try{
var rval=_174.next();
lst.push(rval);
return rval;
}
catch(e){
if(e!=self.StopIteration){
throw e;
}
if(lst.length===0){
this.next=function(){
throw self.StopIteration;
};
}else{
var i=-1;
this.next=function(){
i=(i+1)%lst.length;
return lst[i];
};
}
return this.next();
}
}};
},repeat:function(elem,n){
var m=MochiKit.Base;
if(typeof (n)=="undefined"){
return {repr:function(){
return "repeat("+m.repr(elem)+")";
},toString:m.forwardCall("repr"),next:function(){
return elem;
}};
}
return {repr:function(){
return "repeat("+m.repr(elem)+", "+n+")";
},toString:m.forwardCall("repr"),next:function(){
if(n<=0){
throw MochiKit.Iter.StopIteration;
}
n-=1;
return elem;
}};
},next:function(_17a){
return _17a.next();
},izip:function(p,q){
var m=MochiKit.Base;
var self=MochiKit.Iter;
var next=self.next;
var _180=m.map(self.iter,arguments);
return {repr:function(){
return "izip(...)";
},toString:m.forwardCall("repr"),next:function(){
return m.map(next,_180);
}};
},ifilter:function(pred,seq){
var m=MochiKit.Base;
seq=MochiKit.Iter.iter(seq);
if(pred===null){
pred=m.operator.truth;
}
return {repr:function(){
return "ifilter(...)";
},toString:m.forwardCall("repr"),next:function(){
while(true){
var rval=seq.next();
if(pred(rval)){
return rval;
}
}
return undefined;
}};
},ifilterfalse:function(pred,seq){
var m=MochiKit.Base;
seq=MochiKit.Iter.iter(seq);
if(pred===null){
pred=m.operator.truth;
}
return {repr:function(){
return "ifilterfalse(...)";
},toString:m.forwardCall("repr"),next:function(){
while(true){
var rval=seq.next();
if(!pred(rval)){
return rval;
}
}
return undefined;
}};
},islice:function(seq){
var self=MochiKit.Iter;
var m=MochiKit.Base;
seq=self.iter(seq);
var _18c=0;
var stop=0;
var step=1;
var i=-1;
if(arguments.length==2){
stop=arguments[1];
}else{
if(arguments.length==3){
_18c=arguments[1];
stop=arguments[2];
}else{
_18c=arguments[1];
stop=arguments[2];
step=arguments[3];
}
}
return {repr:function(){
return "islice("+["...",_18c,stop,step].join(", ")+")";
},toString:m.forwardCall("repr"),next:function(){
var rval;
while(i<_18c){
rval=seq.next();
i++;
}
if(_18c>=stop){
throw self.StopIteration;
}
_18c+=step;
return rval;
}};
},imap:function(fun,p,q){
var m=MochiKit.Base;
var self=MochiKit.Iter;
var _196=m.map(self.iter,m.extend(null,arguments,1));
var map=m.map;
var next=self.next;
return {repr:function(){
return "imap(...)";
},toString:m.forwardCall("repr"),next:function(){
return fun.apply(this,map(next,_196));
}};
},applymap:function(fun,seq,self){
seq=MochiKit.Iter.iter(seq);
var m=MochiKit.Base;
return {repr:function(){
return "applymap(...)";
},toString:m.forwardCall("repr"),next:function(){
return fun.apply(self,seq.next());
}};
},chain:function(p,q){
var self=MochiKit.Iter;
var m=MochiKit.Base;
if(arguments.length==1){
return self.iter(arguments[0]);
}
var _1a1=m.map(self.iter,arguments);
return {repr:function(){
return "chain(...)";
},toString:m.forwardCall("repr"),next:function(){
while(_1a1.length>1){
try{
var _1a2=_1a1[0].next();
return _1a2;
}
catch(e){
if(e!=self.StopIteration){
throw e;
}
_1a1.shift();
var _1a2=_1a1[0].next();
return _1a2;
}
}
if(_1a1.length==1){
var arg=_1a1.shift();
this.next=m.bind("next",arg);
return this.next();
}
throw self.StopIteration;
}};
},takewhile:function(pred,seq){
var self=MochiKit.Iter;
seq=self.iter(seq);
return {repr:function(){
return "takewhile(...)";
},toString:MochiKit.Base.forwardCall("repr"),next:function(){
var rval=seq.next();
if(!pred(rval)){
this.next=function(){
throw self.StopIteration;
};
this.next();
}
return rval;
}};
},dropwhile:function(pred,seq){
seq=MochiKit.Iter.iter(seq);
var m=MochiKit.Base;
var bind=m.bind;
return {"repr":function(){
return "dropwhile(...)";
},"toString":m.forwardCall("repr"),"next":function(){
while(true){
var rval=seq.next();
if(!pred(rval)){
break;
}
}
this.next=bind("next",seq);
return rval;
}};
},_tee:function(_1ad,sync,_1af){
sync.pos[_1ad]=-1;
var m=MochiKit.Base;
var _1b1=m.listMin;
return {repr:function(){
return "tee("+_1ad+", ...)";
},toString:m.forwardCall("repr"),next:function(){
var rval;
var i=sync.pos[_1ad];
if(i==sync.max){
rval=_1af.next();
sync.deque.push(rval);
sync.max+=1;
sync.pos[_1ad]+=1;
}else{
rval=sync.deque[i-sync.min];
sync.pos[_1ad]+=1;
if(i==sync.min&&_1b1(sync.pos)!=sync.min){
sync.min+=1;
sync.deque.shift();
}
}
return rval;
}};
},tee:function(_1b4,n){
var rval=[];
var sync={"pos":[],"deque":[],"max":-1,"min":-1};
if(arguments.length==1||typeof (n)=="undefined"||n===null){
n=2;
}
var self=MochiKit.Iter;
_1b4=self.iter(_1b4);
var _tee=self._tee;
for(var i=0;i<n;i++){
rval.push(_tee(i,sync,_1b4));
}
return rval;
},list:function(_1bb){
var rval;
if(_1bb instanceof Array){
return _1bb.slice();
}
if(typeof (_1bb)=="function"&&!(_1bb instanceof Function)&&typeof (_1bb.length)=="number"){
rval=[];
for(var i=0;i<_1bb.length;i++){
rval.push(_1bb[i]);
}
return rval;
}
var self=MochiKit.Iter;
_1bb=self.iter(_1bb);
var rval=[];
var _1bf;
try{
while(true){
_1bf=_1bb.next();
rval.push(_1bf);
}
}
catch(e){
if(e!=self.StopIteration){
throw e;
}
return rval;
}
return undefined;
},reduce:function(fn,_1c1,_1c2){
var i=0;
var x=_1c2;
var self=MochiKit.Iter;
_1c1=self.iter(_1c1);
if(arguments.length<3){
try{
x=_1c1.next();
}
catch(e){
if(e==self.StopIteration){
e=new TypeError("reduce() of empty sequence with no initial value");
}
throw e;
}
i++;
}
try{
while(true){
x=fn(x,_1c1.next());
}
}
catch(e){
if(e!=self.StopIteration){
throw e;
}
}
return x;
},range:function(){
var _1c6=0;
var stop=0;
var step=1;
if(arguments.length==1){
stop=arguments[0];
}else{
if(arguments.length==2){
_1c6=arguments[0];
stop=arguments[1];
}else{
if(arguments.length==3){
_1c6=arguments[0];
stop=arguments[1];
step=arguments[2];
}else{
throw new TypeError("range() takes 1, 2, or 3 arguments!");
}
}
}
if(step===0){
throw new TypeError("range() step must not be 0");
}
return {next:function(){
if((step>0&&_1c6>=stop)||(step<0&&_1c6<=stop)){
throw MochiKit.Iter.StopIteration;
}
var rval=_1c6;
_1c6+=step;
return rval;
},repr:function(){
return "range("+[_1c6,stop,step].join(", ")+")";
},toString:MochiKit.Base.forwardCall("repr")};
},sum:function(_1ca,_1cb){
if(typeof (_1cb)=="undefined"||_1cb===null){
_1cb=0;
}
var x=_1cb;
var self=MochiKit.Iter;
_1ca=self.iter(_1ca);
try{
while(true){
x+=_1ca.next();
}
}
catch(e){
if(e!=self.StopIteration){
throw e;
}
}
return x;
},exhaust:function(_1ce){
var self=MochiKit.Iter;
_1ce=self.iter(_1ce);
try{
while(true){
_1ce.next();
}
}
catch(e){
if(e!=self.StopIteration){
throw e;
}
}
},forEach:function(_1d0,func,obj){
var m=MochiKit.Base;
var self=MochiKit.Iter;
if(arguments.length>2){
func=m.bind(func,obj);
}
if(m.isArrayLike(_1d0)&&!self.isIterable(_1d0)){
try{
for(var i=0;i<_1d0.length;i++){
func(_1d0[i]);
}
}
catch(e){
if(e!=self.StopIteration){
throw e;
}
}
}else{
self.exhaust(self.imap(func,_1d0));
}
},every:function(_1d6,func){
var self=MochiKit.Iter;
try{
self.ifilterfalse(func,_1d6).next();
return false;
}
catch(e){
if(e!=self.StopIteration){
throw e;
}
return true;
}
},sorted:function(_1d9,cmp){
var rval=MochiKit.Iter.list(_1d9);
if(arguments.length==1){
cmp=MochiKit.Base.compare;
}
rval.sort(cmp);
return rval;
},reversed:function(_1dc){
var rval=MochiKit.Iter.list(_1dc);
rval.reverse();
return rval;
},some:function(_1de,func){
var self=MochiKit.Iter;
try{
self.ifilter(func,_1de).next();
return true;
}
catch(e){
if(e!=self.StopIteration){
throw e;
}
return false;
}
},iextend:function(lst,_1e2){
var m=MochiKit.Base;
var self=MochiKit.Iter;
if(m.isArrayLike(_1e2)&&!self.isIterable(_1e2)){
for(var i=0;i<_1e2.length;i++){
lst.push(_1e2[i]);
}
}else{
_1e2=self.iter(_1e2);
try{
while(true){
lst.push(_1e2.next());
}
}
catch(e){
if(e!=self.StopIteration){
throw e;
}
}
}
return lst;
},groupby:function(_1e6,_1e7){
var m=MochiKit.Base;
var self=MochiKit.Iter;
if(arguments.length<2){
_1e7=m.operator.identity;
}
_1e6=self.iter(_1e6);
var pk=undefined;
var k=undefined;
var v;
function fetch(){
v=_1e6.next();
k=_1e7(v);
}
function eat(){
var ret=v;
v=undefined;
return ret;
}
var _1ee=true;
var _1ef=m.compare;
return {repr:function(){
return "groupby(...)";
},next:function(){
while(_1ef(k,pk)===0){
fetch();
if(_1ee){
_1ee=false;
break;
}
}
pk=k;
return [k,{next:function(){
if(v==undefined){
fetch();
}
if(_1ef(k,pk)!==0){
throw self.StopIteration;
}
return eat();
}}];
}};
},groupby_as_array:function(_1f0,_1f1){
var m=MochiKit.Base;
var self=MochiKit.Iter;
if(arguments.length<2){
_1f1=m.operator.identity;
}
_1f0=self.iter(_1f0);
var _1f4=[];
var _1f5=true;
var _1f6;
var _1f7=m.compare;
while(true){
try{
var _1f8=_1f0.next();
var key=_1f1(_1f8);
}
catch(e){
if(e==self.StopIteration){
break;
}
throw e;
}
if(_1f5||_1f7(key,_1f6)!==0){
var _1fa=[];
_1f4.push([key,_1fa]);
}
_1fa.push(_1f8);
_1f5=false;
_1f6=key;
}
return _1f4;
},arrayLikeIter:function(_1fb){
var i=0;
return {repr:function(){
return "arrayLikeIter(...)";
},toString:MochiKit.Base.forwardCall("repr"),next:function(){
if(i>=_1fb.length){
throw MochiKit.Iter.StopIteration;
}
return _1fb[i++];
}};
},hasIterateNext:function(_1fd){
return (_1fd&&typeof (_1fd.iterateNext)=="function");
},iterateNextIter:function(_1fe){
return {repr:function(){
return "iterateNextIter(...)";
},toString:MochiKit.Base.forwardCall("repr"),next:function(){
var rval=_1fe.iterateNext();
if(rval===null||rval===undefined){
throw MochiKit.Iter.StopIteration;
}
return rval;
}};
}});
MochiKit.Iter.__new__=function(){
var m=MochiKit.Base;
if(typeof (StopIteration)!="undefined"){
this.StopIteration=StopIteration;
}else{
this.StopIteration=new m.NamedError("StopIteration");
}
this.iteratorRegistry=new m.AdapterRegistry();
this.registerIteratorFactory("arrayLike",m.isArrayLike,this.arrayLikeIter);
this.registerIteratorFactory("iterateNext",this.hasIterateNext,this.iterateNextIter);
m.nameFunctions(this);
};
MochiKit.Iter.__new__();
if(MochiKit.__export__){
reduce=MochiKit.Iter.reduce;
}
MochiKit.Base._exportSymbols(this,MochiKit.Iter);
MochiKit.Base._module("DateTime","1.5",["Base"]);
MochiKit.DateTime.isoDate=function(str){
str=str+"";
if(typeof (str)!="string"||str.length===0){
return null;
}
var iso=str.split("-");
if(iso.length===0){
return null;
}
var date=new Date(iso[0],iso[1]-1,iso[2]);
date.setFullYear(iso[0]);
date.setMonth(iso[1]-1);
date.setDate(iso[2]);
return date;
};
MochiKit.DateTime._isoRegexp=/(\d{4,})(?:-(\d{1,2})(?:-(\d{1,2})(?:[T ](\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d+))?)?(?:(Z)|([+-])(\d{1,2})(?::(\d{1,2}))?)?)?)?)?/;
MochiKit.DateTime.isoTimestamp=function(str){
str=str+"";
if(typeof (str)!="string"||str.length===0){
return null;
}
var res=str.match(MochiKit.DateTime._isoRegexp);
if(typeof (res)=="undefined"||res===null){
return null;
}
var year,_22f,day,hour,min,sec,msec;
year=parseInt(res[1],10);
if(typeof (res[2])=="undefined"||res[2]===""){
return new Date(year);
}
_22f=parseInt(res[2],10)-1;
day=parseInt(res[3],10);
if(typeof (res[4])=="undefined"||res[4]===""){
return new Date(year,_22f,day);
}
hour=parseInt(res[4],10);
min=parseInt(res[5],10);
sec=(typeof (res[6])!="undefined"&&res[6]!=="")?parseInt(res[6],10):0;
if(typeof (res[7])!="undefined"&&res[7]!==""){
msec=Math.round(1000*parseFloat("0."+res[7]));
}else{
msec=0;
}
if((typeof (res[8])=="undefined"||res[8]==="")&&(typeof (res[9])=="undefined"||res[9]==="")){
return new Date(year,_22f,day,hour,min,sec,msec);
}
var ofs;
if(typeof (res[9])!="undefined"&&res[9]!==""){
ofs=parseInt(res[10],10)*3600000;
if(typeof (res[11])!="undefined"&&res[11]!==""){
ofs+=parseInt(res[11],10)*60000;
}
if(res[9]=="-"){
ofs=-ofs;
}
}else{
ofs=0;
}
return new Date(Date.UTC(year,_22f,day,hour,min,sec,msec)-ofs);
};
MochiKit.DateTime.toISOTime=function(date,_237){
if(typeof (date)=="undefined"||date===null){
return null;
}
var hh=date.getHours();
var mm=date.getMinutes();
var ss=date.getSeconds();
var lst=[((_237&&(hh<10))?"0"+hh:hh),((mm<10)?"0"+mm:mm),((ss<10)?"0"+ss:ss)];
return lst.join(":");
};
MochiKit.DateTime.toISOTimestamp=function(date,_23d){
if(typeof (date)=="undefined"||date===null){
return null;
}
var sep=_23d?"T":" ";
var foot=_23d?"Z":"";
if(_23d){
date=new Date(date.getTime()+(date.getTimezoneOffset()*60000));
}
return MochiKit.DateTime.toISODate(date)+sep+MochiKit.DateTime.toISOTime(date,_23d)+foot;
};
MochiKit.DateTime.toISODate=function(date){
if(typeof (date)=="undefined"||date===null){
return null;
}
var _241=MochiKit.DateTime._padTwo;
var _242=MochiKit.DateTime._padFour;
return [_242(date.getFullYear()),_241(date.getMonth()+1),_241(date.getDate())].join("-");
};
MochiKit.DateTime.americanDate=function(d){
d=d+"";
if(typeof (d)!="string"||d.length===0){
return null;
}
var a=d.split("/");
return new Date(a[2],a[0]-1,a[1]);
};
MochiKit.DateTime._padTwo=function(n){
return (n>9)?n:"0"+n;
};
MochiKit.DateTime._padFour=function(n){
switch(n.toString().length){
case 1:
return "000"+n;
break;
case 2:
return "00"+n;
break;
case 3:
return "0"+n;
break;
case 4:
default:
return n;
}
};
MochiKit.DateTime.toPaddedAmericanDate=function(d){
if(typeof (d)=="undefined"||d===null){
return null;
}
var _248=MochiKit.DateTime._padTwo;
return [_248(d.getMonth()+1),_248(d.getDate()),d.getFullYear()].join("/");
};
MochiKit.DateTime.toAmericanDate=function(d){
if(typeof (d)=="undefined"||d===null){
return null;
}
return [d.getMonth()+1,d.getDate(),d.getFullYear()].join("/");
};
MochiKit.DateTime.__new__=function(){
MochiKit.Base.nameFunctions(this);
};
MochiKit.DateTime.__new__();
MochiKit.Base._exportSymbols(this,MochiKit.DateTime);
MochiKit.Base._module("Format","1.5",["Base"]);
MochiKit.Format._numberFormatter=function(_24a,_24b,_24c,_24d,_24e,_24f,_250,_251,_252){
return function(num){
num=parseFloat(num);
if(typeof (num)=="undefined"||num===null||isNaN(num)){
return _24a;
}
var _254=_24b;
var _255=_24c;
if(num<0){
num=-num;
}else{
_254=_254.replace(/-/,"");
}
var me=arguments.callee;
var fmt=MochiKit.Format.formatLocale(_24d);
if(_24e){
num=num*100;
_255=fmt.percent+_255;
}
num=MochiKit.Format.roundToFixed(num,_24f);
var _258=num.split(/\./);
var _259=_258[0];
var frac=(_258.length==1)?"":_258[1];
var res="";
while(_259.length<_250){
_259="0"+_259;
}
if(_251){
while(_259.length>_251){
var i=_259.length-_251;
res=fmt.separator+_259.substring(i,_259.length)+res;
_259=_259.substring(0,i);
}
}
res=_259+res;
if(_24f>0){
while(frac.length<_252){
frac=frac+"0";
}
res=res+fmt.decimal+frac;
}
return _254+res+_255;
};
};
MochiKit.Format.numberFormatter=function(_25d,_25e,_25f){
if(typeof (_25e)=="undefined"){
_25e="";
}
var _260=_25d.match(/((?:[0#]+,)?[0#]+)(?:\.([0#]+))?(%)?/);
if(!_260){
throw TypeError("Invalid pattern");
}
var _261=_25d.substr(0,_260.index);
var _262=_25d.substr(_260.index+_260[0].length);
if(_261.search(/-/)==-1){
_261=_261+"-";
}
var _263=_260[1];
var frac=(typeof (_260[2])=="string"&&_260[2]!="")?_260[2]:"";
var _265=(typeof (_260[3])=="string"&&_260[3]!="");
var tmp=_263.split(/,/);
var _267;
if(typeof (_25f)=="undefined"){
_25f="default";
}
if(tmp.length==1){
_267=null;
}else{
_267=tmp[1].length;
}
var _268=_263.length-_263.replace(/0/g,"").length;
var _269=frac.length-frac.replace(/0/g,"").length;
var _26a=frac.length;
var rval=MochiKit.Format._numberFormatter(_25e,_261,_262,_25f,_265,_26a,_268,_267,_269);
var m=MochiKit.Base;
if(m){
var fn=arguments.callee;
var args=m.concat(arguments);
rval.repr=function(){
return [self.NAME,"(",map(m.repr,args).join(", "),")"].join("");
};
}
return rval;
};
MochiKit.Format.formatLocale=function(_26f){
if(typeof (_26f)=="undefined"||_26f===null){
_26f="default";
}
if(typeof (_26f)=="string"){
var rval=MochiKit.Format.LOCALE[_26f];
if(typeof (rval)=="string"){
rval=arguments.callee(rval);
MochiKit.Format.LOCALE[_26f]=rval;
}
return rval;
}else{
return _26f;
}
};
MochiKit.Format.twoDigitAverage=function(_271,_272){
if(_272){
var res=_271/_272;
if(!isNaN(res)){
return MochiKit.Format.twoDigitFloat(res);
}
}
return "0";
};
MochiKit.Format.twoDigitFloat=function(_274){
var res=roundToFixed(_274,2);
if(res.indexOf(".00")>0){
return res.substring(0,res.length-3);
}else{
if(res.charAt(res.length-1)=="0"){
return res.substring(0,res.length-1);
}else{
return res;
}
}
};
MochiKit.Format.lstrip=function(str,_277){
str=str+"";
if(typeof (str)!="string"){
return null;
}
if(!_277){
return str.replace(/^\s+/,"");
}else{
return str.replace(new RegExp("^["+_277+"]+"),"");
}
};
MochiKit.Format.rstrip=function(str,_279){
str=str+"";
if(typeof (str)!="string"){
return null;
}
if(!_279){
return str.replace(/\s+$/,"");
}else{
return str.replace(new RegExp("["+_279+"]+$"),"");
}
};
MochiKit.Format.strip=function(str,_27b){
var self=MochiKit.Format;
return self.rstrip(self.lstrip(str,_27b),_27b);
};
MochiKit.Format.truncToFixed=function(_27d,_27e){
var _27f=MochiKit.Format._numberToFixed(_27d,_27e);
var _280=_27f.indexOf(".");
if(_280>0&&_280+_27e+1<_27f.length){
_27f=_27f.substring(0,_280+_27e+1);
_27f=MochiKit.Format._shiftNumber(_27f,0);
}
return _27f;
};
MochiKit.Format.roundToFixed=function(_281,_282){
var _283=MochiKit.Format._numberToFixed(_281,_282);
var _284=_283.indexOf(".");
if(_284>0&&_284+_282+1<_283.length){
var str=MochiKit.Format._shiftNumber(_283,_282);
str=MochiKit.Format._numberToFixed(Math.round(parseFloat(str)),0);
_283=MochiKit.Format._shiftNumber(str,-_282);
}
return _283;
};
MochiKit.Format._numberToFixed=function(_286,_287){
var str=_286.toString();
var _289=str.split(/[eE]/);
var exp=(_289.length===1)?0:parseInt(_289[1])||0;
var _28b=MochiKit.Format._shiftNumber(_289[0],exp);
_289=_28b.split(/\./);
var _28c=_289[0];
var frac=(_289.length===1)?"":_289[1];
while(frac.length<_287){
frac+="0";
}
if(frac.length>0){
return _28c+"."+frac;
}else{
return _28c;
}
};
MochiKit.Format._shiftNumber=function(num,exp){
var pos=num.indexOf(".");
if(pos<0){
pos=num.length;
}else{
num=num.substring(0,pos)+num.substring(pos+1);
}
pos+=exp;
while(pos<=0||(pos<=1&&num.charAt(0)==="-")){
if(num.charAt(0)==="-"){
num="-0"+num.substring(1);
}else{
num="0"+num;
}
pos++;
}
while(pos>num.length){
num+="0";
}
if(pos<num.length){
num=num.substring(0,pos)+"."+num.substring(pos);
}
while(/^0[^.]/.test(num)){
num=num.substring(1);
}
while(/^-0[^.]/.test(num)){
num="-"+num.substring(2);
}
return num;
};
MochiKit.Format.percentFormat=function(_291){
return MochiKit.Format.twoDigitFloat(100*_291)+"%";
};
MochiKit.Format.LOCALE={en_US:{separator:",",decimal:".",percent:"%"},de_DE:{separator:".",decimal:",",percent:"%"},pt_BR:{separator:".",decimal:",",percent:"%"},fr_FR:{separator:" ",decimal:",",percent:"%"},"default":"en_US",__export__:false};
MochiKit.Format.__new__=function(){
MochiKit.Base.nameFunctions(this);
var base=this.NAME+".";
var k,v,o;
for(k in this.LOCALE){
o=this.LOCALE[k];
if(typeof (o)=="object"){
o.repr=function(){
return this.NAME;
};
o.NAME=base+"LOCALE."+k;
}
}
};
MochiKit.Format.__new__();
MochiKit.Base._exportSymbols(this,MochiKit.Format);
MochiKit.Base._module("Text","1.5",["Base","Format"]);
MochiKit.Text.startsWith=function(_296,str){
return str!=null&&_296!=null&&str.indexOf(_296)==0;
};
MochiKit.Text.endsWith=function(_298,str){
return str!=null&&_298!=null&&str.lastIndexOf(_298)==Math.max(str.length-_298.length,0);
};
MochiKit.Text.contains=function(_29a,str){
return str!=null&&_29a!=null&&str.indexOf(_29a)>=0;
};
MochiKit.Text.padLeft=function(str,_29d,_29e){
str=str||"";
_29e=_29e||" ";
while(str.length<_29d){
str=_29e+str;
}
return str;
};
MochiKit.Text.padRight=function(str,_2a0,_2a1){
str=str||"";
_2a1=_2a1||" ";
while(str.length<_2a0){
str+=_2a1;
}
return str;
};
MochiKit.Text.truncate=function(str,_2a3,tail){
if(str==null||str.length<=_2a3||_2a3<0){
return str;
}else{
if(tail!=null){
str=str.slice(0,Math.max(0,_2a3-tail.length));
if(typeof (str)=="string"){
return str+tail;
}else{
return MochiKit.Base.extend(str,tail);
}
}else{
return str.slice(0,_2a3);
}
}
};
MochiKit.Text.split=function(str,_2a6,max){
if(str==null||str.length==0){
return str;
}
_2a6=_2a6||"\n";
var bits=str.split(_2a6);
if((typeof (max)=="undefined")||max>=bits.length-1){
return bits;
}
bits.splice(max,bits.length,bits.slice(max,bits.length).join(_2a6));
return bits;
};
MochiKit.Text.rsplit=function(str,_2aa,max){
if(str==null||str.length==0){
return str;
}
_2aa=_2aa||"\n";
var bits=str.split(_2aa);
if((typeof (max)=="undefined")||max>=bits.length-1){
return bits;
}
bits.splice(0,bits.length-max,bits.slice(0,bits.length-max).join(_2aa));
return bits;
};
MochiKit.Text.splitJoin=function(func,str,_2af){
if(str==null||str.length==0){
return str;
}
_2af=_2af||"\n";
return MochiKit.Base.map(func,str.split(_2af)).join(_2af);
};
MochiKit.Text.formatter=function(_2b0,_2b1){
if(typeof (_2b1)=="undefined"){
_2b1=MochiKit.Format.formatLocale();
}else{
if(typeof (_2b1)=="string"){
_2b1=MochiKit.Format.formatLocale(_2b1);
}
}
var _2b2=MochiKit.Text._parsePattern(_2b0);
return function(){
var _2b3=MochiKit.Base.extend([],arguments);
var res=[];
for(var i=0;i<_2b2.length;i++){
if(typeof (_2b2[i])=="string"){
res.push(_2b2[i]);
}else{
res.push(MochiKit.Text.formatValue(_2b2[i],_2b3,_2b1));
}
}
return res.join("");
};
};
MochiKit.Text.format=function(_2b6){
var func=MochiKit.Text.formatter(_2b6);
return func.apply(this,MochiKit.Base.extend([],arguments,1));
};
MochiKit.Text.formatValue=function(spec,_2b9,_2ba){
var self=MochiKit.Text;
if(typeof (spec)==="string"){
spec=self._parseFormatFlags(spec,0,spec.length-1);
}
for(var i=0;spec.path!=null&&i<spec.path.length;i++){
if(_2b9!=null){
_2b9=_2b9[spec.path[i]];
}
}
if(typeof (_2ba)=="undefined"){
_2ba=MochiKit.Format.formatLocale();
}else{
if(typeof (_2ba)=="string"){
_2ba=MochiKit.Format.formatLocale(_2ba);
}
}
var str="";
if(spec.numeric){
if(typeof (_2b9)!="number"||isNaN(_2b9)){
str="";
}else{
if(_2b9===Number.POSITIVE_INFINITY){
str="\u221e";
}else{
if(_2b9===Number.NEGATIVE_INFINITY){
str="-\u221e";
}else{
var sign=(spec.sign==="-")?"":spec.sign;
sign=(_2b9<0)?"-":sign;
_2b9=Math.abs(_2b9);
if(spec.format==="%"){
str=self._truncToPercent(_2b9,spec.precision);
}else{
if(spec.format==="d"){
str=MochiKit.Format.roundToFixed(_2b9,0);
}else{
if(spec.radix!=10){
str=Math.floor(_2b9).toString(spec.radix);
if(spec.format==="x"){
str=str.toLowerCase();
}else{
if(spec.format==="X"){
str=str.toUpperCase();
}
}
}else{
if(spec.precision>=0){
str=MochiKit.Format.roundToFixed(_2b9,spec.precision);
}else{
str=_2b9.toString();
}
}
}
}
if(spec.padding==="0"&&spec.format==="%"){
str=self.padLeft(str,spec.width-sign.length-1,"0");
}else{
if(spec.padding=="0"){
str=self.padLeft(str,spec.width-sign.length,"0");
}
}
str=self._localizeNumber(str,_2ba,spec.grouping);
str=sign+str;
}
}
}
if(str!==""&&spec.format==="%"){
str=str+_2ba.percent;
}
}else{
if(spec.format=="r"){
str=MochiKit.Base.repr(_2b9);
}else{
str=(_2b9==null)?"null":_2b9.toString();
}
str=self.truncate(str,spec.precision);
}
if(spec.align=="<"){
str=self.padRight(str,spec.width);
}else{
str=self.padLeft(str,spec.width);
}
return str;
};
MochiKit.Text._localizeNumber=function(num,_2c0,_2c1){
var _2c2=num.split(/\./);
var _2c3=_2c2[0];
var frac=(_2c2.length==1)?"":_2c2[1];
var res=(frac.length>0)?_2c0.decimal:"";
while(_2c1&&frac.length>3){
res=res+frac.substring(0,3)+_2c0.separator;
frac=frac.substring(3);
if(_2c3.charAt(0)=="0"){
_2c3=_2c3.substring(1);
}
}
if(frac.length>0){
res+=frac;
}
while(_2c1&&_2c3.length>3){
var pos=_2c3.length-3;
res=_2c0.separator+_2c3.substring(pos)+res;
_2c3=_2c3.substring((_2c3.charAt(0)=="0")?1:0,pos);
}
return _2c3+res;
};
MochiKit.Text._parsePattern=function(_2c7){
var self=MochiKit.Text;
var _2c9=[];
var _2ca=0;
var pos=0;
for(pos=0;pos<_2c7.length;pos++){
if(_2c7.charAt(pos)=="{"){
if(pos+1>=_2c7.length){
var msg="unescaped { char, should be escaped as {{";
throw new self.FormatPatternError(_2c7,pos,msg);
}else{
if(_2c7.charAt(pos+1)=="{"){
_2c9.push(_2c7.substring(_2ca,pos+1));
_2ca=pos+2;
pos++;
}else{
if(_2ca<pos){
_2c9.push(_2c7.substring(_2ca,pos));
}
_2ca=_2c7.indexOf("}",pos)+1;
if(_2ca<=0){
var msg="unmatched { char, not followed by a } char";
throw new self.FormatPatternError(_2c7,pos,msg);
}
_2c9.push(self._parseFormat(_2c7,pos+1,_2ca-1));
pos=_2ca-1;
}
}
}else{
if(_2c7.charAt(pos)=="}"){
if(pos+1>=_2c7.length||_2c7.charAt(pos+1)!="}"){
var msg="unescaped } char, should be escaped as }}";
throw new self.FormatPatternError(_2c7,pos,msg);
}
_2c9.push(_2c7.substring(_2ca,pos+1));
_2ca=pos+2;
pos++;
}
}
}
if(_2ca<pos){
_2c9.push(_2c7.substring(_2ca,pos));
}
return _2c9;
};
MochiKit.Text._parseFormat=function(_2cd,_2ce,_2cf){
var self=MochiKit.Text;
var text=_2cd.substring(_2ce,_2cf);
var info;
var pos=text.indexOf(":");
if(pos==0){
info=self._parseFormatFlags(_2cd,_2ce+1,_2cf);
info.path=[0];
}else{
if(pos>0){
info=self._parseFormatFlags(_2cd,_2ce+pos+1,_2cf);
info.path=text.substring(0,pos).split(".");
}else{
info=self._parseFormatFlags(_2cd,_2cf,_2cf);
info.path=text.split(".");
}
}
var _2d4=/^\d+$/;
for(var i=0;i<info.path.length;i++){
var e=info.path[i];
if(typeof (e)=="string"){
e=e.replace(/^\s+/,"").replace(/\s+$/,"");
if(e==""&&info.path.length==1){
e=0;
}else{
if(e==""){
var msg="format value path contains blanks";
throw new self.FormatPatternError(_2cd,_2ce,msg);
}else{
if(_2d4.test(e)){
e=parseInt(e);
}
}
}
}
info.path[i]=e;
}
if(info.path.length<0||typeof (info.path[0])!="number"){
info.path.unshift(0);
}
return info;
};
MochiKit.Text._parseFormatFlags=function(_2d8,_2d9,_2da){
var self=MochiKit.Text;
var info={numeric:false,format:"s",width:0,precision:-1,align:">",sign:"-",padding:" ",grouping:false};
var _2dd=_2d8.substring(_2d9,_2da).replace(/\s+$/,"");
while(_2dd.length>0){
switch(_2dd.charAt(0)){
case ">":
case "<":
info.align=_2dd.charAt(0);
_2dd=_2dd.substring(1);
break;
case "+":
case "-":
case " ":
info.sign=_2dd.charAt(0);
_2dd=_2dd.substring(1);
break;
case ",":
info.grouping=true;
_2dd=_2dd.substring(1);
break;
case ".":
var _2de=/^\d*/.exec(_2dd.substring(1))[0];
info.precision=parseInt(_2de);
_2dd=_2dd.substring(1+_2de.length);
break;
case "0":
info.padding=_2dd.charAt(0);
_2dd=_2dd.substring(1);
break;
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
var _2de=/^\d*/.exec(_2dd)[0];
info.width=parseInt(_2de);
_2dd=_2dd.substring(_2de.length);
break;
case "s":
case "r":
info.format=_2dd.charAt(0);
_2dd=_2dd.substring(1);
break;
case "b":
case "d":
case "o":
case "x":
case "X":
case "f":
case "%":
info.numeric=true;
info.format=_2dd.charAt(0);
info.radix=10;
if(info.format==="b"){
info.radix=2;
}else{
if(info.format==="o"){
info.radix=8;
}else{
if(info.format==="x"||info.format==="X"){
info.radix=16;
}
}
}
_2dd=_2dd.substring(1);
break;
default:
var msg="unsupported format flag: "+_2dd.charAt(0);
throw new self.FormatPatternError(_2d8,_2d9,msg);
}
}
return info;
};
MochiKit.Text._truncToPercent=function(_2e0,_2e1){
var str;
if(_2e1>=0){
str=MochiKit.Format.roundToFixed(_2e0,_2e1+2);
}else{
str=(_2e0==null)?"0":_2e0.toString();
}
var _2e3=str.indexOf(".");
if(_2e3<0){
str=str+"00";
}else{
if(_2e3+3>=str.length){
var _2e4=str.substring(_2e3+1);
while(_2e4.length<2){
_2e4=_2e4+"0";
}
str=str.substring(0,_2e3)+_2e4;
}else{
var _2e4=str.substring(_2e3+1);
str=str.substring(0,_2e3)+_2e4.substring(0,2)+"."+_2e4.substring(2);
}
}
while(str.length>1&&str.charAt(0)=="0"&&str.charAt(1)!="."){
str=str.substring(1);
}
return str;
};
MochiKit.Text.FormatPatternError=function(_2e5,pos,_2e7){
this.pattern=_2e5;
this.pos=pos;
this.message=_2e7;
};
MochiKit.Text.FormatPatternError.prototype=new MochiKit.Base.NamedError("MochiKit.Text.FormatPatternError");
if(MochiKit.__export__){
formatter=MochiKit.Text.formatter;
format=MochiKit.Text.format;
formatValue=MochiKit.Text.formatValue;
}
MochiKit.Base.nameFunctions(MochiKit.Text);
MochiKit.Base._exportSymbols(this,MochiKit.Text);
if(typeof (MochiKit)=="undefined"){
MochiKit={};
}
if(typeof (MochiKit.MochiKit)=="undefined"){
MochiKit.MochiKit={};
}
MochiKit.MochiKit.NAME="MochiKit.MochiKit";
MochiKit.MochiKit.VERSION="1.5";
MochiKit.MochiKit.__repr__=function(){
return "["+this.NAME+" "+this.VERSION+"]";
};
MochiKit.MochiKit.toString=function(){
return this.__repr__();
};
MochiKit.MochiKit.SUBMODULES=["Base","Iter","Logging","DateTime","Format","Text","Async","DOM","Selector","Style","LoggingPane","Color","Signal","Position","Visual","DragAndDrop","Sortable"];
(function(){
if(typeof (document)=="undefined"){
return;
}
var _875=document.getElementsByTagName("script");
var _876="http://www.w3.org/1999/xhtml";
var _877="http://www.w3.org/2000/svg";
var _878="http://www.w3.org/1999/xlink";
var _879="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
var base=null;
var _87b=null;
var _87c={};
var i;
var src;
for(i=0;i<_875.length;i++){
src=null;
switch(_875[i].namespaceURI){
case _877:
src=_875[i].getAttributeNS(_878,"href");
break;
default:
src=_875[i].getAttribute("src");
break;
}
if(!src){
continue;
}
_87c[src]=true;
if(src.match(/MochiKit.js(\?.*)?$/)){
base=src.substring(0,src.lastIndexOf("MochiKit.js"));
_87b=_875[i];
}
}
if(base===null){
return;
}
var _87f=MochiKit.MochiKit.SUBMODULES;
for(var i=0;i<_87f.length;i++){
if(MochiKit[_87f[i]]){
continue;
}
var uri=base+_87f[i]+".js";
if(uri in _87c){
continue;
}
if(_87b.namespaceURI==_877||_87b.namespaceURI==_879){
var s=document.createElementNS(_87b.namespaceURI,"script");
s.setAttribute("id","MochiKit_"+base+_87f[i]);
if(_87b.namespaceURI==_877){
s.setAttributeNS(_878,"href",uri);
}else{
s.setAttribute("src",uri);
}
s.setAttribute("type","application/x-javascript");
_87b.parentNode.appendChild(s);
}else{
document.write("<"+_87b.nodeName+" src=\""+uri+"\" type=\"text/javascript\"></script>");
}
}
})();



