/** * Miso.Dataset - v0.2.1 - 6/29/2012 * http://github.com/misoproject/dataset * Copyright (c) 2012 Alex Graul, Irene Ros; * Dual Licensed: MIT, GPL * https://github.com/misoproject/dataset/blob/master/LICENSE-MIT * https://github.com/misoproject/dataset/blob/master/LICENSE-GPL */ (function(a,b){function z(a,b){this._d=a,this._isUTC=!!b}function A(a){return a<0?Math.ceil(a):Math.floor(a)}function B(a){var b=this._data={},c=a.years||a.y||0,d=a.months||a.M||0,e=a.weeks||a.w||0,f=a.days||a.d||0,g=a.hours||a.h||0,h=a.minutes||a.m||0,i=a.seconds||a.s||0,j=a.milliseconds||a.ms||0;this._milliseconds=j+i*1e3+h*6e4+g*36e5,this._days=f+e*7,this._months=d+c*12,b.milliseconds=j%1e3,i+=A(j/1e3),b.seconds=i%60,h+=A(i/60),b.minutes=h%60,g+=A(h/60),b.hours=g%24,f+=A(g/24),f+=e*7,b.days=f%30,d+=A(f/30),b.months=d%12,c+=A(d/12),b.years=c}function C(a,b){var c=a+"";while(c.length11?"pm":"am";case"A":return o?o(h,i,!0):h>11?"PM":"AM";case"H":return h;case"HH":return C(h,2);case"h":return h%12||12;case"hh":return C(h%12||12,2);case"m":return i;case"mm":return C(i,2);case"s":return j;case"ss":return C(j,2);case"S":return~~(l/100);case"SS":return C(~~(l/10),2);case"SSS":return C(l,3);case"Z":return(m<0?"-":"+")+C(~~(Math.abs(m)/60),2)+":"+C(~~(Math.abs(m)%60),2);case"ZZ":return(m<0?"-":"+")+C(~~(10*Math.abs(m)/6),4);case"L":case"LL":case"LLL":case"LLLL":case"LT":return G(b,moment.longDateFormat[c]);default:return c.replace(/(^\[)|(\\)|\]$/g,"")}}var d=b.month(),e=b.date(),f=b.year(),g=b.day(),h=b.hours(),i=b.minutes(),j=b.seconds(),l=b.milliseconds(),m=-b.zone(),n=moment.ordinal,o=moment.meridiem;return c.replace(k,p)}function H(a){switch(a){case"DDDD":return o;case"YYYY":return p;case"S":case"SS":case"SSS":case"DDD":return n;case"MMM":case"MMMM":case"ddd":case"dddd":case"a":case"A":return q;case"Z":case"ZZ":return r;case"T":return s;case"MM":case"DD":case"dd":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return m;default:return new RegExp(a.replace("\\",""))}}function I(a,b,c,d){var e;switch(a){case"M":case"MM":c[1]=b==null?0:~~b-1;break;case"MMM":case"MMMM":for(e=0;e<12;e++)if(moment.monthsParse[e].test(b)){c[1]=e;break}break;case"D":case"DD":case"DDD":case"DDDD":c[2]=~~b;break;case"YY":b=~~b,c[0]=b+(b>70?1900:2e3);break;case"YYYY":c[0]=~~Math.abs(b);break;case"a":case"A":d.isPm=(b+"").toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":c[3]=~~b;break;case"m":case"mm":c[4]=~~b;break;case"s":case"ss":c[5]=~~b;break;case"S":case"SS":case"SSS":c[6]=~~(("0."+b)*1e3);break;case"Z":case"ZZ":d.isUTC=!0,e=(b+"").match(w),e&&e[1]&&(d.tzh=~~e[1]),e&&e[2]&&(d.tzm=~~e[2]),e&&e[0]==="+"&&(d.tzh=-d.tzh,d.tzm=-d.tzm)}}function J(b,c){var d=[0,0,1,0,0,0,0],e={tzh:0,tzm:0},f=c.match(k),g,h;for(g=0;g0,N.apply({},i)}function P(a,b){moment.fn[a]=function(a){var c=this._isUTC?"UTC":"";return a!=null?(this._d["set"+c+b](a),this):this._d["get"+c+b]()}}function Q(a){moment.duration.fn[a]=function(){return this._data[a]}}function R(a,b){moment.duration.fn["as"+a]=function(){return+this/b}}var moment,c="1.6.2",d=Math.round,e,f={},g="en",h=typeof module!="undefined",i="months|monthsShort|monthsParse|weekdays|weekdaysShort|longDateFormat|calendar|relativeTime|ordinal|meridiem".split("|"),j=/^\/?Date\((\-?\d+)/i,k=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|dddd?|do?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|SS?S?|zz?|ZZ?|LT|LL?L?L?)/g,l=/([0-9a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)/gi,m=/\d\d?/,n=/\d{1,3}/,o=/\d{3}/,p=/\d{4}/,q=/[0-9a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+/i,r=/Z|[\+\-]\d\d:?\d\d/i,s=/T/i,t=/^\s*\d{4}-\d\d-\d\d(T(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,u="YYYY-MM-DDTHH:mm:ssZ",v=[["HH:mm:ss.S",/T\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/T\d\d:\d\d:\d\d/],["HH:mm",/T\d\d:\d\d/],["HH",/T\d\d/]],w=/([\+\-]|\d\d)/gi,x="Month|Date|Hours|Minutes|Seconds|Milliseconds".split("|"),y={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6};moment=function(c,d){if(c===null||c==="")return null;var e,f,g;return moment.isMoment(c)?(e=new a(+c._d),g=c._isUTC):d?E(d)?e=L(c,d):e=J(c,d):(f=j.exec(c),e=c===b?new a:f?new a(+f[1]):c instanceof a?c:E(c)?F(c):typeof c=="string"?M(c):new a(c)),new z(e,g)},moment.utc=function(b,c){return E(b)?new z(new a(a.UTC.apply({},b)),!0):c&&b?moment(b+" +0000",c+" Z").utc():moment(b&&!r.exec(b)?b+"+0000":b).utc()},moment.unix=function(a){return moment(a*1e3)},moment.duration=function(a,b){var c=moment.isDuration(a),d=typeof a=="number",e=c?a._data:d?{}:a;return d&&(b?e[b]=a:e.milliseconds=a),new B(e)},moment.humanizeDuration=function(a,b,c){return moment.duration(a,b===!0?null:b).humanize(b===!0?!0:c)},moment.version=c,moment.defaultFormat=u,moment.lang=function(a,b){var c,d,e=[];if(!a)return g;if(b){for(c=0;c<12;c++)e[c]=new RegExp("^"+b.months[c]+"|^"+b.monthsShort[c].replace(".",""),"i");b.monthsParse=b.monthsParse||e,f[a]=b}if(f[a]){for(c=0;cc?1:0}function Z(a,b){return n[b]}function $(a){return"\\"+s[a]}function _(a){return q[a]}function ba(a,b){return function(c,d,e){return a.call(b,c,d,e)}}function bb(){}function bd(a,b){var c=n.length;return n[c]="'+\n_.escape("+b+") +\n'",m+c}function be(a,b){var c=n.length;return n[c]="'+\n((__t = ("+b+")) == null ? '' : __t) +\n'",m+c}function bf(a,b){var c=n.length;return n[c]="';\n"+b+";\n__p += '",m+c}function br(a,b,c,d){if(!a)return c;var e=a.length,f=arguments.length<3;d&&(b=ba(b,d));if(e===e>>>0){e&&f&&(c=a[--e]);while(e--)c=b(c,a[e],e,a);return c}var g,h=cw(a);e=h.length,e&&f&&(c=a[h[--e]]);while(e--)g=h[e],c=b(c,a[g],g,a);return c}function bu(a,b,c){if(typeof b=="string"){var d=b;b=function(a){return a[d]}}else c&&(b=ba(b,c));var e=bg(a,b).sort(Y),f=e.length;while(f--)e[f]=e[f].value;return e}function bv(a){if(!a)return[];if(a.toArray&&G.call(a.toArray)==w)return a.toArray();var b=a.length;return b===b>>>0?F.call(a):cz(a)}function bw(a){var b=[];if(!a)return b;var c=-1,d=a.length;while(++c-1})&&b.push(c);return b}function bD(a,b,c){if(a){var d=a.length;return b==null||c?a[d-1]:F.call(a,-b||d)}}function bE(a,b,c){if(!a)return-1;var d=a.length;c&&typeof c=="number"&&(d=(c<0?Math.max(0,d+c):Math.min(c,d-1))+1);while(d--)if(a[d]===b)return d;return-1}function bF(a,b,c){var d=-Infinity,e=d;if(!a)return e;var f,g=-1,h=a.length;if(!b){while(++ge&&(e=a[g]);return e}c&&(b=ba(b,c));while(++gd&&(d=f,e=a[g]);return e}function bG(a,b,c){var d=Infinity,e=d;if(!a)return e;var f,g=-1,h=a.length;if(!b){while(++g>>1,c(a[e])>>1,a[e]>>0?a.length:cw(a).length}function cA(a){return a==null?"":(a+"").replace(i,_)}function cB(a){return a}function cC(a){bl(ce(a),function(b){var c=N[b]=a[b];O.prototype[b]=function(){var a=[this._wrapped];arguments.length&&E.apply(a,arguments);var b=c.apply(N,a);return this._chain&&(b=new O(b),b._chain=!0),b}})}function cD(){return a._=f,this}function cE(a,b){if(!a)return null;var c=a[b];return G.call(c)==w?a[b]():c}function cF(a,b,c){c||(c={});var d,e,f,g=N.templateSettings,i=c.escape,k=c.evaluate,m=c.interpolate,p=c.variable;return i==null&&(i=g.escape),k==null&&(k=g.evaluate),m==null&&(m=g.interpolate),i&&(a=a.replace(i,bd)),m&&(e=a!=(a=a.replace(m,be))),k&&(d=a!=(a=a.replace(k,bf))),a="__p='"+a.replace(j,$).replace(h,Z)+"';\n",n.length=0,p||(p=g.variable,a="with ("+p+" || {}) {\n"+a+"\n}\n"),a="function("+p+") {\n"+"var __p"+(e?", __t":"")+(d?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+a+"return __p\n}",o&&(a+="\n//@ sourceURL=/lodash/template/source["+l++ +"]"),f=Function("_","return "+a)(N),b?f(b):(f.source=a,f)}function cG(a,b,c){var d=-1;if(c)while(++d/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:"obj"};var P=cF("var index, result<% if (init) { %> = <%= init %><% } %>;\n<%= exit %>;\n<%= top %>;\n<% if (arrayBranch) { %>var length = <%= firstArg %>.length; index = -1; <% if (objectBranch) { %>\nif (length === length >>> 0) {<% } %>\n <%= arrayBranch.beforeLoop %>;\n while (<%= arrayBranch.loopExp %>) {\n <%= arrayBranch.inLoop %>;\n } <% if (objectBranch) { %>\n}\n<% }}if (objectBranch) { if (arrayBranch) { %>else {\n<% } if (!hasDontEnumBug) { %> var skipProto = typeof <%= iteratedObject %> == 'function';\n<% } %> <%= objectBranch.beforeLoop %>;\n for (<%= objectBranch.loopExp %>) { \n<% if (hasDontEnumBug) { if (useHas) { %> if (<%= hasExp %>) {\n <% } %> <%= objectBranch.inLoop %>;<% if (useHas) { %>\n }<% } } else { %> if (!(skipProto && index == 'prototype')<% if (useHas) { %> && <%= hasExp %><% } %>) {\n <%= objectBranch.inLoop %>;\n } <% } %>\n } <% if (hasDontEnumBug) { %>\n var ctor = <%= iteratedObject %>.constructor;\n <% for (var k = 0; k < 7; k++) { %>\n index = '<%= shadowed[k] %>';\n if (<% if (shadowed[k] == 'constructor') { %>!(ctor && ctor.prototype === <%= iteratedObject %>) && <% } %><%= hasExp %>) {\n <%= objectBranch.inLoop %>;\n }<% } } if (arrayBranch) { %>\n}<% }} %>\n<%= bottom %>;\nreturn result"),Q={args:"collection, callback, thisArg",init:"collection",top:"if (!callback) {\n callback = identity\n}\nelse if (thisArg) {\n callback = iteratorBind(callback, thisArg)\n}",inLoop:"callback(collection[index], index, collection)"},R={init:"true",inLoop:"if (!callback(collection[index], index, collection)) return !result"},S={args:"object",init:"object",top:"for (var source, sourceIndex = 1, length = arguments.length; sourceIndex < length; sourceIndex++) {\n source = arguments[sourceIndex];\n"+(d?" if (source) {":""),loopExp:"index in source",useHas:!1,inLoop:"object[index] = source[index]",bottom:(d?" }\n":"")+"}"},T={init:"[]",inLoop:"callback(collection[index], index, collection) && result.push(collection[index])"},U={top:"if (thisArg) callback = iteratorBind(callback, thisArg)"},V={inLoop:{object:Q.inLoop}},W={init:"",exit:"if (!collection) return []",beforeLoop:{array:"result = Array(length)",object:"result = []"},inLoop:{array:"result[index] = callback(collection[index], index, collection)",object:"result.push(callback(collection[index], index, collection))"}},bc=X({args:"object",exit:"if (!objectTypes[typeof object] || object === null) throw TypeError()",init:"[]",inLoop:"result.push(index)"}),bg=X(W,{args:"collection, callback",inLoop:{array:"result[index] = {\n criteria: callback(collection[index], index, collection),\n value: collection[index]\n}",object:"result.push({\n criteria: callback(collection[index], index, collection),\n value: collection[index]\n})"}}),bh=X({args:"collection, target",init:"false",inLoop:"if (collection[index] === target) return true"}),bi=X(Q,R),bj=X(Q,T),bk=X(Q,U,{init:"",inLoop:"if (callback(collection[index], index, collection)) return collection[index]"}),bl=X(Q,U),bm=X(Q,{init:"{}",top:"var prop, isFunc = typeof callback == 'function';\nif (isFunc && thisArg) callback = iteratorBind(callback, thisArg)",inLoop:"prop = isFunc\n ? callback(collection[index], index, collection)\n : collection[index][callback];\n(hasOwnProperty.call(result, prop) ? result[prop] : result[prop] = []).push(collection[index])"}),bn=X(W,{args:"collection, methodName",top:"var args = slice.call(arguments, 2),\n isFunc = typeof methodName == 'function'",inLoop:{array:"result[index] = (isFunc ? methodName : collection[index][methodName]).apply(collection[index], args)",object:"result.push((isFunc ? methodName : collection[index][methodName]).apply(collection[index], args))"}}),bo=X(Q,W),bp=X(W,{args:"collection, property",inLoop:{array:"result[index] = collection[index][property]",object:"result.push(collection[index][property])"}}),bq=X({args:"collection, callback, accumulator, thisArg",init:"accumulator",top:"var noaccum = arguments.length < 3;\nif (thisArg) callback = iteratorBind(callback, thisArg)",beforeLoop:{array:"if (noaccum) result = collection[++index]"},inLoop:{array:"result = callback(result, collection[index], index, collection)",object:"result = noaccum\n ? (noaccum = false, collection[index])\n : callback(result, collection[index], index, collection)"}}),bs=X(Q,T,{inLoop:"!"+T.inLoop}),bt=X(Q,R,{init:"false",inLoop:R.inLoop.replace("!","")}),ca=X(S,{inLoop:"if (object[index] == null)"+S.inLoop}),cb=X(S),cc=X(Q,U,V,{useHas:!1}),cd=X(Q,U,V),ce=X({args:"object",init:"[]",useHas:!1,inLoop:"if (toString.call(object[index]) == funcClass) result.push(index)",bottom:"result.sort()"}),cg=function(a){return G.call(a)=="[object Arguments]"};cg(arguments)||(cg=function(a){return!!a&&!!D.call(a,"callee")});var ch=I||function(a){return G.call(a)==t},cl=X({args:"value",init:"true",top:"var className = toString.call(value);\nif (className == arrayClass || className == stringClass) return !value.length",inLoop:{object:"return false"}}),cw=K?function(a){return typeof a=="function"?bc(a):K(a)}:bc,cz=X({args:"object",init:"[]",inLoop:"result.push(object[index])"});N.VERSION="0.3.2",N.after=bP,N.bind=bQ,N.bindAll=bR,N.chain=cI,N.clone=b_,N.compact=bw,N.compose=bS,N.contains=bh,N.debounce=bT,N.defaults=ca,N.defer=bV,N.delay=bU,N.difference=bx,N.escape=cA,N.every=bi,N.extend=cb,N.filter=bj,N.find=bk,N.first=by,N.flatten=bz,N.forEach=bl,N.forIn=cc,N.forOwn=cd,N.functions=ce,N.groupBy=bm,N.has=cf,N.identity=cB,N.indexOf=bA,N.initial=bB,N.intersection=bC,N.invoke=bn,N.isArguments=cg,N.isArray=ch,N.isBoolean=ci,N.isDate=cj,N.isElement=ck,N.isEmpty=cl,N.isEqual=cm,N.isFinite=cn,N.isFunction=co,N.isNaN=cq,N.isNull=cr,N.isNumber=cs,N.isObject=cp,N.isRegExp=ct,N.isString=cu,N.isUndefined=cv,N.keys=cw,N.last=bD,N.lastIndexOf=bE,N.map=bo,N.max=bF,N.memoize=bW,N.min=bG,N.mixin=cC,N.noConflict=cD,N.once=bX,N.partial=bY,N.pick=cx,N.pluck=bp,N.range=bH,N.reduce=bq,N.reduceRight=br,N.reject=bs,N.rest=bI,N.result=cE,N.shuffle=bJ,N.size=cy,N.some=bt,N.sortBy=bu,N.sortedIndex=bK,N.tap=cJ,N.template=cF,N.throttle=bZ,N.times=cG,N.toArray=bv,N.union=bL,N.uniq=bM,N.uniqueId=cH,N.values=cz,N.without=bN,N.wrap=b$,N.zip=bO,N.all=bi,N.any=bt,N.collect=bo,N.detect=bk,N.each=bl,N.foldl=bq,N.foldr=br,N.head=by,N.include=bh,N.inject=bq,N.methods=ce,N.select=bj,N.tail=bI,N.take=by,N.unique=bM,N._iteratorTemplate=P,N._shimKeys=bc,O.prototype=N.prototype,cC(N),O.prototype.chain=cK,O.prototype.value=cL,bl(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=A[a];O.prototype[a]=function(){var a=this._wrapped;return b.apply(a,arguments),a.length===0&&delete a[0],this._chain&&(a=new O(a),a._chain=!0),a}}),bl(["concat","join","slice"],function(a){var b=A[a];O.prototype[a]=function(){var a=this._wrapped,c=b.apply(a,arguments);return this._chain&&(c=new O(c),c._chain=!0),c}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(a._=N,define(function(){return N})):c?typeof module=="object"&&module&&module.exports==c?(module.exports=N)._=N:c._=N:a._=N}(this),function(){var a=this.math={};a.mean=a.ave=a.average=function(b,c){return a.sum(b,c)/_(b).size()},a.median=function(b){var c=(b.length+1)/2,d=a.sort(b);return d.length%2?d[c-1]:(d[c-1.5]+d[c-.5])/2},a.pow=function(a,b){if(_.isNumber(a))return Math.pow(a,b);if(_.isArray(a))return _.map(a,function(a){return _.pow(a,b)})},a.scale=function(a,b){var b=b||1,c=_.max(a);return _.map(a,function(a){return a*(b/c)})},a.slope=function(a,b){return(b[1]-a[1])/(b[0]-a[0])},a.sort=function(a){return a.sort(function(a,b){return a-b})},a.stdDeviation=a.sigma=function(a){return Math.sqrt(_(a).variance())},a.sum=function(a,b){if(_.isArray(a)&&typeof a[0]=="number")var c=a;else var b=b||"value",c=_(a).pluck(b);var d=0;for(var e=0,f=c.length;e1?h.call(arguments,0):c,--f||i.resolveWith(i,b)}}function m(a){return function(b){e[a]=arguments.length>1?h.call(arguments,0):b,i.notifyWith(k,e)}}var b=h.call(arguments,0),c=0,d=b.length,e=new Array(d),f=d,g=d,i=d<=1&&a&&j(a.promise)?a:n.Deferred(),k=i.promise();if(d>1){for(;cb?1:0},numeric:function(a){return _.isNaN(Number(a))?null:Number(a)}},string:{name:"string",coerce:function(a){return a==null?null:a.toString()},test:function(a){return a===null||typeof a=="undefined"||typeof a=="string"},compare:function(a,b){return a==null&&b!=null?-1:a!=null&&b==null?1:ab?1:0},numeric:function(a){return _.isNaN(+a)||a===null?null:_.isNumber(+a)?+a:null}},"boolean":{name:"boolean",regexp:/^(true|false)$/,coerce:function(a){return a==="false"?!1:Boolean(a)},test:function(a){return a===null||typeof a=="undefined"||typeof a=="boolean"||this.regexp.test(a)?!0:!1},compare:function(a,b){return a==null&&b!=null?-1:a!=null&&b==null?1:a==null&&b==null?0:a===b?0:ab?1:0},numeric:function(a){return a.valueOf()}}}}(this,_),function(a,_){var b=a.Miso||(a.Miso={});b.Event=function(a){_.isArray(a)||(a=[a]),this.deltas=a},_.extend(b.Event.prototype,{affectedColumns:function(){var a=[];return _.each(this.deltas,function(b){b.old=b.old||[],b.changed=b.changed||[],a=_.chain(a).union(_.keys(b.old),_.keys(b.changed)).reject(function(a){return a==="_id"}).value()}),a}}),_.extend(b.Event,{isRemove:function(a){return _.isUndefined(a.changed)||_.keys(a.changed).length===0?!0:!1},isAdd:function(a){return _.isUndefined(a.old)||_.keys(a.old).length===0?!0:!1},isUpdate:function(a){return!this.isRemove(a)&&!this.isAdd(a)?!0:!1}}),b.Events={},b.Events.bind=function(a,b,c){var d=this._callbacks||(this._callbacks={}),e=d[a]||(d[a]={}),f=e.tail||(e.tail=e.next={});return f.callback=b,f.context=c,e.tail=f.next={},this},b.Events.unbind=function(a,b){var c,d,e;if(!a)this._callbacks=null;else if(c=this._callbacks)if(!b)c[a]={};else if(d=c[a])while((e=d)&&(d=d.next)){if(d.callback!==b)continue;e.next=d.next,d.context=d.callback=null;break}return this},b.Events.trigger=function(a){var b,c,d,e,f,g=["all",a];if(!(c=this._callbacks))return this;while(f=g.pop()){if(!(b=c[f]))continue;e=f==="all"?arguments:Array.prototype.slice.call(arguments,1);while(b=b.next)(d=b.callback)&&d.apply(b.context||this,e)}return this},b.Events._buildEvent=function(a){return new b.Event(a)}}(this,_),function(a,_){var b=a.Miso||{};b.Builder={detectColumnType:function(a,c){var d=_.inject(c.slice(0,5),function(a,c){var d=b.typeOf(c);return c!==""&&a.indexOf(d)===-1&&!_.isNull(c)&&a.push(d),a},[]);return d.length===1?a.type=d[0]:a.type="mixed",a},detectColumnTypes:function(a,c){_.each(c,function(c,d){var e=a.column(d);if(e.type){e.force=!0;return}b.Builder.detectColumnType(e,c)},this)},cacheRows:function(a){b.Builder.clearRowCache(a),_.each(a._columns[a._columnPositionByName._id].data,function(b,c){a._rowPositionById[b]=c,a._rowIdByPosition.push(b)},a);var c=_.uniq(_.map(a._columns,function(a){return a.data.length}));if(c.length>1)throw new Error("Row lengths need to be the same. Empty values should be set to null."+_.map(a._columns,function(a){return a.data+"|||"}));a.length=c[0]},clearRowCache:function(a){a._rowPositionById={},a._rowIdByPosition=[]},cacheColumns:function(a){a._columnPositionByName={},_.each(a._columns,function(b,c){a._columnPositionByName[b.name]=c})}},Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){for(var c=b||0,d=this.length;c0&&(a=this.numericAt(c));return b.types[this.type].coerce(a,this)},_min:function(){var a=Infinity;for(var c=0;c=0;c--)a.apply(b||this,[this.rowByPosition(c),c])},eachColumn:function(a,b){var c=this.columnNames();for(var d=0;d=0)f(b,a-1),b--};if(c>2){g(c),d=c-1;while(d>1)e(d,0),d--,f(0,d)}else this.comparator(this.rowByPosition(0),this.rowByPosition(1))>0&&e(0,1);return this.comparator(this.rowByPosition(this.length-2),this.rowByPosition(this.length-1))>0&&e(this.length-1,this.length-2),this.syncable&&b.silent&&this.trigger("sort"),this},toJSON:function(){var a=[];for(var b=0;b0&&_.times(a,function(){b.push(_.uniqueId())}),this.addColumn({name:"_id",type:"number",data:b});if(this._columnPositionByName._id!==0){var c=this._columns[this._columnPositionByName._id],d=this._columnPositionByName._id;this._columns.splice(d,1),this._columns.unshift(c),this._columnPositionByName._id=0,_.each(this._columnPositionByName,function(a,b){b!=="_id"&&this._columnPositionByName[b]1&&(f=b),a},{}),new Error('You have more than one column named "'+f+'"')}_.each(a.table.rows,function(a){a=a.c;for(e=0;e0){var n=0,o=0,p=d.length;while(n