data-forge
Version:
JavaScript data transformation and analysis toolkit inspired by Pandas and LINQ.
1 lines • 229 kB
JavaScript
var dataForge=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=2)}([function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=this&&this.__values||function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,u=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=u.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=u.return)&&r.call(u)}finally{if(i)throw i.error}}return o},a=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(o(arguments[t]));return e},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var c=r(7),l=r(8),f=r(9),h=r(10),p=r(11),d=r(12),y=r(13),m=r(14),D=r(15),v=r(36),g=r(16),w=r(17),b=r(18),E=r(40),F=r(42),C=r(19),x=r(5),A=r(20),S=r(21),_=r(22),B=s(r(23)),I=r(1),O=s(r(3)),k=s(r(26));O.default.extend(k.default);var j,N=r(4),M=r(2),P=s(r(75));!function(e){e.Start="start",e.End="end"}(j=t.WhichIndex||(t.WhichIndex={}));var T=function(){function e(t){this.configFn=null,this.content=null,this.indexedContent=null,t?N.isFunction(t)?this.configFn=t:N.isArray(t)||N.isFunction(t[Symbol.iterator])?this.content=e.initFromArray(t):this.content=e.initFromConfig(t):this.content=e.initEmpty()}return e.initFromArray=function(t){return{index:e.defaultCountIterable,values:t,pairs:new f.MultiIterable([e.defaultCountIterable,t]),isBaked:!0}},e.initEmpty=function(){return{index:e.defaultEmptyIterable,values:e.defaultEmptyIterable,pairs:e.defaultEmptyIterable,isBaked:!0}},e.checkIterable=function(e,t){if(N.isArray(e));else if(!N.isFunction(e[Symbol.iterator]))throw new Error("Expected '"+t+"' field of Series config object to be an array of values or an iterable of values.")},e.initFromConfig=function(t){var r,n,i,u=!1;return t.pairs&&(e.checkIterable(t.pairs,"pairs"),i=t.pairs),t.index?(e.checkIterable(t.index,"index"),r=t.index):r=i?new A.ExtractElementIterable(i,0):e.defaultCountIterable,t.values?(e.checkIterable(t.values,"values"),n=t.values):n=i?new A.ExtractElementIterable(i,1):e.defaultEmptyIterable,i||(i=new f.MultiIterable([r,n])),void 0!==t.baked&&(u=t.baked),{index:r,values:n,pairs:i,isBaked:u}},e.prototype.lazyInit=function(){null===this.content&&null!==this.configFn&&(this.content=e.initFromConfig(this.configFn()))},e.prototype.getContent=function(){return this.lazyInit(),this.content},e.prototype.getRowByIndex=function(e){if(!this.indexedContent){this.indexedContent=new Map;try{for(var t=u(this.getContent().pairs),r=t.next();!r.done;r=t.next()){var n=r.value;this.indexedContent.set(n[0],n[1])}}catch(e){i={error:e}}finally{try{r&&!r.done&&(o=t.return)&&o.call(t)}finally{if(i)throw i.error}}}return this.indexedContent.get(e);var i,o},e.prototype[Symbol.iterator]=function(){return this.getContent().values[Symbol.iterator]()},e.prototype.cast=function(){return this},e.prototype.getIndex=function(){var e=this;return new x.Index(function(){return{values:e.getContent().index}})},e.prototype.withIndex=function(t){var r=this;return N.isFunction(t)?new e(function(){return{values:r.getContent().values,index:r.select(t)}}):(e.checkIterable(t,"newIndex"),new e(function(){return{values:r.getContent().values,index:t}}))},e.prototype.resetIndex=function(){var t=this;return new e(function(){return{values:t.getContent().values}})},e.merge=function(t){var r=new Map,n=Array.from(t).length,i=0;try{for(var o=u(t),a=o.next();!a.done;a=o.next()){var s=a.value;try{for(var c=u(s.toPairs()),l=c.next();!l.done;l=c.next()){var f=l.value,h=f[0];r.has(h)||r.set(h,new Array(n)),r.get(h)[i]=f[1]}}catch(e){y={error:e}}finally{try{l&&!l.done&&(m=c.return)&&m.call(c)}finally{if(y)throw y.error}}++i}}catch(e){p={error:e}}finally{try{a&&!a.done&&(d=o.return)&&d.call(o)}finally{if(p)throw p.error}}var p,d,y,m,D=Array.from(r.keys()).map(function(e){return[e,r.get(e)]});return D.sort(function(e,t){return e[0]===t[0]?0:e[0]>t[0]?1:-1}),new e({pairs:D})},e.prototype.merge=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.merge([this].concat(t))},e.prototype.toArray=function(){var e,t,r=[];try{for(var n=u(this.getContent().values),i=n.next();!i.done;i=n.next()){var o=i.value;null!=o&&r.push(o)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},e.prototype.toPairs=function(){var e,t,r=[];try{for(var n=u(this.getContent().pairs),i=n.next();!i.done;i=n.next()){var o=i.value;void 0!==o[1]&&null!==o[1]&&r.push(o)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},e.prototype.toObject=function(e,t){if(!N.isFunction(e))throw new Error("Expected 'keySelector' parameter to Series.toObject to be a function.");if(!N.isFunction(t))throw new Error("Expected 'valueSelector' parameter to Series.toObject to be a function.");return N.toMap(this,e,t)},e.prototype.select=function(t){var r=this;if(!N.isFunction(t))throw new Error("Expected 'selector' parameter to 'Series.select' function to be a function.");return new e(function(){return{values:new h.SelectIterable(r.getContent().values,t),index:r.getContent().index}})},e.prototype.selectMany=function(t){var r=this;if(!N.isFunction(t))throw new Error("Expected 'selector' parameter to 'Series.selectMany' to be a function.");return new e(function(){return{pairs:new p.SelectManyIterable(r.getContent().pairs,function(e,r){var n,i,o=[];try{for(var a=u(t(e[1],r)),s=a.next();!s.done;s=a.next()){var c=s.value;o.push([e[0],c])}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return o})}})},e.prototype.window=function(t,r){var n=this;if(!N.isNumber(t))throw new Error("Expected 'period' parameter to 'Series.window' to be a number.");return new e(function(){return{pairs:new v.SeriesWindowIterable(n.getContent().pairs,t,r||j.End)}})},e.prototype.rollingWindow=function(t,r){var n=this;if(!N.isNumber(t))throw new Error("Expected 'period' parameter to 'Series.rollingWindow' to be a number.");return new e(function(){return{pairs:new E.SeriesRollingWindowIterable(n.getContent().pairs,t,r||j.End)}})},e.prototype.variableWindow=function(t){var r=this;if(!N.isFunction(t))throw new Error("Expected 'comparer' parameter to 'Series.variableWindow' to be a function.");return new e(function(){return{values:new F.SeriesVariableWindowIterable(r.getContent().pairs,t)}})},e.prototype.sequentialDistinct=function(e){if(e){if(!N.isFunction(e))throw new Error("Expected 'selector' parameter to 'Series.sequentialDistinct' to be a selector function that determines the value to compare for duplicates.")}else e=function(e){return e};return this.variableWindow(function(t,r){return e(t)===e(r)}).select(function(e){return[e.getIndex().first(),e.first()]}).withIndex(function(e){return e[0]}).select(function(e){return e[1]})},e.prototype.aggregate=function(e,t){if(N.isFunction(e)&&!t)return this.skip(1).aggregate(this.first(),e);if(!N.isFunction(t))throw new Error("Expected 'selector' parameter to aggregate to be a function.");var r,n,i=e;try{for(var o=u(this),a=o.next();!a.done;a=o.next()){i=t(i,a.value)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},e.prototype.amountRange=function(e,t){return this.rollingWindow(e,t).select(function(e){return e.max()-e.min()})},e.prototype.proportionRange=function(e,t){return this.rollingWindow(e,t).select(function(e){return(e.max()-e.min())/e.last()})},e.prototype.percentRange=function(e,t){return this.proportionRange(e,t).select(function(e){return 100*e})},e.prototype.amountChange=function(e,t){return this.rollingWindow(void 0===e?2:e,t).select(function(e){return e.last()-e.first()})},e.prototype.proportionChange=function(e,t){return this.rollingWindow(void 0===e?2:e,t).select(function(e){return(e.last()-e.first())/e.first()})},e.prototype.percentChange=function(e,t){return this.proportionChange(e,t).select(function(e){return 100*e})},e.prototype.proportionRank=function(e){if(void 0===e&&(e=2),!N.isNumber(e))throw new Error("Expected 'period' parameter to 'Series.proportionRank' to be a number that specifies the time period for the ranking.");return this.rollingWindow(e+1).select(function(t){var r=t.last();return t.head(-1).where(function(e){return e<r}).count()/e})},e.prototype.percentRank=function(e){if(void 0===e&&(e=2),!N.isNumber(e))throw new Error("Expected 'period' parameter to 'Series.percentRank' to be a number that specifies the time period for the ranking.");return this.proportionRank(e).select(function(e){return 100*e})},e.prototype.cumsum=function(){var t=this;return new e(function(){var e=0;return{pairs:t.toPairs().map(function(t){var r=o(t,2),n=r[0],i=r[1];return[n,e+=i]})}})},e.prototype.skip=function(t){var r=this;return new e(function(){return{values:new S.SkipIterable(r.getContent().values,t),index:new S.SkipIterable(r.getContent().index,t),pairs:new S.SkipIterable(r.getContent().pairs,t)}})},e.prototype.skipWhile=function(t){var r=this;if(!N.isFunction(t))throw new Error("Expected 'predicate' parameter to 'Series.skipWhile' function to be a predicate function that returns true/false.");return new e(function(){return{values:new _.SkipWhileIterable(r.getContent().values,t),pairs:new _.SkipWhileIterable(r.getContent().pairs,function(e){return t(e[1])})}})},e.prototype.skipUntil=function(e){if(!N.isFunction(e))throw new Error("Expected 'predicate' parameter to 'Series.skipUntil' function to be a predicate function that returns true/false.");return this.skipWhile(function(t){return!e(t)})},e.prototype.take=function(t){var r=this;if(!N.isNumber(t))throw new Error("Expected 'numRows' parameter to 'Series.take' function to be a number.");return new e(function(){return{index:new d.TakeIterable(r.getContent().index,t),values:new d.TakeIterable(r.getContent().values,t),pairs:new d.TakeIterable(r.getContent().pairs,t)}})},e.prototype.takeWhile=function(t){var r=this;if(!N.isFunction(t))throw new Error("Expected 'predicate' parameter to 'Series.takeWhile' function to be a predicate function that returns true/false.");return new e(function(){return{values:new y.TakeWhileIterable(r.getContent().values,t),pairs:new y.TakeWhileIterable(r.getContent().pairs,function(e){return t(e[1])})}})},e.prototype.takeUntil=function(e){if(!N.isFunction(e))throw new Error("Expected 'predicate' parameter to 'Series.takeUntil' function to be a predicate function that returns true/false.");return this.takeWhile(function(t){return!e(t)})},e.count=function(e){return e.count()},e.prototype.count=function(){var e,t,r=0;try{for(var n=u(this.getContent().values),i=n.next();!i.done;i=n.next()){i.value;++r}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},e.prototype.first=function(){try{for(var e=u(this),t=e.next();!t.done;t=e.next()){return t.value}}catch(e){r={error:e}}finally{try{t&&!t.done&&(n=e.return)&&n.call(e)}finally{if(r)throw r.error}}throw new Error("Series.first: No values in Series.");var r,n},e.prototype.last=function(){var e,t,r=null;try{for(var n=u(this),i=n.next();!i.done;i=n.next()){r=i.value}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}if(null===r)throw new Error("Series.last: No values in Series.");return r},e.prototype.at=function(e){if(!this.none())return this.getRowByIndex(e)},e.prototype.head=function(t){if(!N.isNumber(t))throw new Error("Expected 'numValues' parameter to 'Series.head' function to be a number.");if(0===t)return new e;var r=t<0?this.count()-Math.abs(t):t;return this.take(r)},e.prototype.tail=function(t){if(!N.isNumber(t))throw new Error("Expected 'numValues' parameter to 'Series.tail' function to be a number.");if(0===t)return new e;var r=t>0?this.count()-t:Math.abs(t);return this.skip(r)},e.prototype.where=function(t){var r=this;if(!N.isFunction(t))throw new Error("Expected 'predicate' parameter to 'Series.where' function to be a function.");return new e(function(){return{values:new m.WhereIterable(r.getContent().values,t),pairs:new m.WhereIterable(r.getContent().pairs,function(e){return t(e[1])})}})},e.prototype.forEach=function(e){if(!N.isFunction(e))throw new Error("Expected 'callback' parameter to 'Series.forEach' to be a function.");var t,r,n=0;try{for(var i=u(this),o=i.next();!o.done;o=i.next()){e(o.value,n++)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return this},e.prototype.all=function(e){if(!N.isFunction(e))throw new Error("Expected 'predicate' parameter to 'Series.all' to be a function.");var t,r,n=0;try{for(var i=u(this),o=i.next();!o.done;o=i.next()){if(!e(o.value))return!1;++n}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n>0},e.prototype.any=function(e){if(e&&!N.isFunction(e))throw new Error("Expected 'predicate' parameter to 'Series.any' to be a function.");var t,r;if(!e)return!this[Symbol.iterator]().next().done;try{for(var n=u(this),i=n.next();!i.done;i=n.next()){if(e(i.value))return!0}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return!1},e.prototype.none=function(e){if(e&&!N.isFunction(e))throw new Error("Expected 'predicate' parameter to 'Series.none' to be a function.");var t,r;if(!e)return this[Symbol.iterator]().next().done;try{for(var n=u(this),i=n.next();!i.done;i=n.next()){if(e(i.value))return!1}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return!0},e.prototype.startAt=function(t){var r=this;return new e(function(){var e=r.getIndex().getLessThan();return{index:new _.SkipWhileIterable(r.getContent().index,function(r){return e(r,t)}),pairs:new _.SkipWhileIterable(r.getContent().pairs,function(r){return e(r[0],t)})}})},e.prototype.endAt=function(t){var r=this;return new e(function(){var e=r.getIndex().getLessThanOrEqualTo();return{index:new y.TakeWhileIterable(r.getContent().index,function(r){return e(r,t)}),pairs:new y.TakeWhileIterable(r.getContent().pairs,function(r){return e(r[0],t)})}})},e.prototype.before=function(t){var r=this;return new e(function(){var e=r.getIndex().getLessThan();return{index:new y.TakeWhileIterable(r.getContent().index,function(r){return e(r,t)}),pairs:new y.TakeWhileIterable(r.getContent().pairs,function(r){return e(r[0],t)})}})},e.prototype.after=function(t){var r=this;return new e(function(){var e=r.getIndex().getLessThanOrEqualTo();return{index:new _.SkipWhileIterable(r.getContent().index,function(r){return e(r,t)}),pairs:new _.SkipWhileIterable(r.getContent().pairs,function(r){return e(r[0],t)})}})},e.prototype.between=function(e,t){return this.startAt(e).endAt(t)},e.prototype.toString=function(){for(var e=["__index__","__value__"],t=this.toPairs(),r=new B.default,n=0;n<t.length;++n){for(var i=t[n],u=0;u<i.length;++u){var o=i[u];r.cell(e[u],o)}r.newRow()}return r.toString()},e.parseInt=function(e,t){if(null!=e){if(!N.isString(e))throw new Error("Called Series.parseInts, expected all values in the series to be strings, instead found a '"+typeof e+"' at index "+t);if(0!==e.length)return parseInt(e)}},e.prototype.parseInts=function(){return this.select(e.parseInt)},e.parseFloat=function(e,t){if(null!=e){if(!N.isString(e))throw new Error("Called Series.parseFloats, expected all values in the series to be strings, instead found a '"+typeof e+"' at index "+t);if(0!==e.length)return parseFloat(e)}},e.prototype.parseFloats=function(){return this.select(e.parseFloat)},e.parseDate=function(e,t,r){if(null!=e){if(!N.isString(e))throw new Error("Called Series.parseDates, expected all values in the series to be strings, instead found a '"+typeof e+"' at index "+t);if(0!==e.length)return O.default(e,r).toDate()}},e.prototype.parseDates=function(t){if(t&&!N.isString(t))throw new Error("Expected optional 'formatString' parameter to Series.parseDates to be a string (if specified).");return this.select(function(r,n){return e.parseDate(r,n,t)})},e.toString=function(e,t){return void 0===e?void 0:null===e?null:t&&N.isDate(e)?O.default(e).format(t):t&&N.isNumber(e)?P.default(e).format(t):e.toString()},e.prototype.toStrings=function(t){if(t&&!N.isString(t))throw new Error("Expected optional 'formatString' parameter to Series.toStrings to be a string (if specified).");return this.select(function(r){return e.toString(r,t)})},e.prototype.bake=function(){return this.getContent().isBaked?this:new e({values:this.toArray(),pairs:this.toPairs(),baked:!0})},e.prototype.inflate=function(e){var t=this;if(e){if(!N.isFunction(e))throw new Error("Expected 'selector' parameter to Series.inflate to be a selector function.");return new I.DataFrame(function(){var r=t.getContent();return{values:new h.SelectIterable(r.values,e),index:r.index,pairs:new h.SelectIterable(r.pairs,function(t,r){return[t[0],e(t[1],r)]})}})}return new I.DataFrame(function(){var e=t.getContent();return{values:e.values,index:e.index,pairs:e.pairs}})},e.sum=function(e){return e.sum()},e.prototype.sum=function(){var e,t,r=0;try{for(var n=u(this),i=n.next();!i.done;i=n.next()){var o=i.value;null!=o&&(r+=o)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},e.average=function(e){return e.average()},e.prototype.average=function(){var e,t,r=0,n=0;try{for(var i=u(this),o=i.next();!o.done;o=i.next()){var a=o.value;null!=a&&(n+=1,r+=a)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return 0===n?0:r/n},e.median=function(e){return e.median()},e.prototype.median=function(){var e=this.where(function(e){return null!=e}),t=e.count();if(0===t)return 0;var r=e.orderBy(function(e){return e}).toArray();return t%2==0?(r[t/2-1]+r[t/2])/2:r[Math.floor(t/2)]},e.std=function(e){return e.std()},e.prototype.std=function(){var e,t,r=this.average(),n=0,i=0;try{for(var o=u(this),a=o.next();!a.done;a=o.next()){var s=a.value;if(null!=s){n+=1;var c=s-r;i+=c*c}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}return 0===n?0:Math.sqrt(i/n)},e.min=function(e){return e.min()},e.prototype.min=function(){var e,t,r;try{for(var n=u(this),i=n.next();!i.done;i=n.next()){var o=i.value;if(null!=o){var a=o;e=void 0===e?a:Math.min(e,a)}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return void 0===e?0:e},e.max=function(e){return e.max()},e.prototype.max=function(){var e,t,r;try{for(var n=u(this),i=n.next();!i.done;i=n.next()){var o=i.value;if(null!=o){var a=o;e=void 0===e?a:Math.max(e,a)}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return void 0===e?0:e},e.prototype.invert=function(){return this.select(function(e){return null==e?e:-e})},e.prototype.counter=function(e){return this.groupSequentialBy(e).selectMany(function(t,r){return e(t.first())?M.range(1,t.count()).withIndex(t.getIndex()).toPairs():M.replicate(0,t.count()).withIndex(t.getIndex()).toPairs()}).withIndex(function(e){return e[0]}).select(function(e){return e[1]})},e.prototype.reverse=function(){var t=this;return new e(function(){return{values:new g.ReverseIterable(t.getContent().values),index:new g.ReverseIterable(t.getContent().index),pairs:new g.ReverseIterable(t.getContent().pairs)}})},e.prototype.distinct=function(t){var r=this;return new e(function(){return{values:new b.DistinctIterable(r.getContent().values,t),pairs:new b.DistinctIterable(r.getContent().pairs,function(e){return t&&t(e[1])||e[1]})}})},e.prototype.groupBy=function(t){var r=this;if(!N.isFunction(t))throw new Error("Expected 'selector' parameter to 'Series.groupBy' to be a selector function that determines the value to group the series by.");return new e(function(){var n,i,o=[],a={},s=0;try{for(var c=u(r.getContent().pairs),l=c.next();!l.done;l=c.next()){var f=l.value,h=t(f[1],s);++s;var p=a[h];if(p)p.push(f);else{var d=[];d.push(f),o.push(d),a[h]=d}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}return{values:o.map(function(t){return new e({pairs:t})})}})},e.prototype.groupSequentialBy=function(e){if(e){if(!N.isFunction(e))throw new Error("Expected 'selector' parameter to 'Series.groupSequentialBy' to be a selector function that determines the value to group the series by.")}else e=function(e){return e};return this.variableWindow(function(t,r){return e(t)===e(r)})},e.concat=function(t){if(!N.isArray(t))throw new Error("Expected 'series' parameter to 'Series.concat' to be an array of series.");return new e(function(){var e=t.map(function(e){return e.getContent()});return{values:new D.ConcatIterable(e.map(function(e){return e.values})),pairs:new D.ConcatIterable(e.map(function(e){return e.pairs}))}})},e.prototype.concat=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i,o,a,s=[this];try{for(var c=u(t),l=c.next();!l.done;l=c.next()){var f=l.value;if(N.isArray(f))try{for(var h=u(f),p=h.next();!p.done;p=h.next()){var d=p.value;s.push(d)}}catch(e){o={error:e}}finally{try{p&&!p.done&&(a=h.return)&&a.call(h)}finally{if(o)throw o.error}}else s.push(f)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}return e.concat(s)},e.zip=function(t,r){var n=Array.from(t);if(0===n.length)return new e;var i=n[0];return i.none()?new e:new e(function(){var e=n;return{index:i.getContent().index,values:new w.ZipIterable(e.map(function(e){return e.getContent().values}),r)}})},e.prototype.zip=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t[t.length-1],i=[this].concat(t.slice(0,t.length-1));return e.zip(i,function(e){return n.apply(void 0,a(e))})},e.prototype.orderBy=function(e){var t=this.getContent();return new R({values:t.values,pairs:t.pairs,selector:e,direction:C.Direction.Ascending,parent:null})},e.prototype.orderByDescending=function(e){var t=this.getContent();return new R({values:t.values,pairs:t.pairs,selector:e,direction:C.Direction.Descending,parent:null})},e.prototype.union=function(e,t){if(t&&!N.isFunction(t))throw new Error("Expected optional 'selector' parameter to 'Series.union' to be a selector function.");return this.concat(e).distinct(t)},e.prototype.intersection=function(e,t,r){if(t){if(!N.isFunction(t))throw new Error("Expected optional 'outerSelector' parameter to 'Series.intersection' to be a function.")}else t=function(e){return e};if(r){if(!N.isFunction(r))throw new Error("Expected optional 'innerSelector' parameter to 'Series.intersection' to be a function.")}else r=function(e){return e};return this.where(function(n){var i=t(n);return e.where(function(e){return i===r(e)}).any()})},e.prototype.except=function(e,t,r){if(t){if(!N.isFunction(t))throw new Error("Expected optional 'outerSelector' parameter to 'Series.except' to be a function.")}else t=function(e){return e};if(r){if(!N.isFunction(r))throw new Error("Expected optional 'innerSelector' parameter to 'Series.except' to be a function.")}else r=function(e){return e};return this.where(function(n){var i=t(n);return e.where(function(e){return i===r(e)}).none()})},e.prototype.join=function(t,r,n,i){if(!N.isFunction(r))throw new Error("Expected 'outerKeySelector' parameter of 'Series.join' to be a selector function.");if(!N.isFunction(n))throw new Error("Expected 'innerKeySelector' parameter of 'Series.join' to be a selector function.");if(!N.isFunction(i))throw new Error("Expected 'resultSelector' parameter of 'Series.join' to be a selector function.");var o=this;return new e(function(){var e,a,s,c,l=t.groupBy(n).toObject(function(e){return n(e.first())},function(e){return e}),f=(o.getContent(),[]);try{for(var h=u(o),p=h.next();!p.done;p=h.next()){var d=p.value,y=l[r(d)];if(y)try{for(var m=u(y),D=m.next();!D.done;D=m.next()){var v=D.value;f.push(i(d,v))}}catch(e){s={error:e}}finally{try{D&&!D.done&&(c=m.return)&&c.call(m)}finally{if(s)throw s.error}}}}catch(t){e={error:t}}finally{try{p&&!p.done&&(a=h.return)&&a.call(h)}finally{if(e)throw e.error}}return{values:f}})},e.prototype.joinOuter=function(e,t,r,n){if(!N.isFunction(t))throw new Error("Expected 'outerKeySelector' parameter of 'Series.joinOuter' to be a selector function.");if(!N.isFunction(r))throw new Error("Expected 'innerKeySelector' parameter of 'Series.joinOuter' to be a selector function.");if(!N.isFunction(n))throw new Error("Expected 'resultSelector' parameter of 'Series.joinOuter' to be a selector function.");var i=this.except(e,t,r).select(function(e){return n(e,null)}).resetIndex(),u=e.except(this,r,t).select(function(e){return n(null,e)}).resetIndex(),o=this.join(e,t,r,n);return i.concat(o).concat(u).resetIndex()},e.prototype.joinOuterLeft=function(e,t,r,n){if(!N.isFunction(t))throw new Error("Expected 'outerKeySelector' parameter of 'Series.joinOuterLeft' to be a selector function.");if(!N.isFunction(r))throw new Error("Expected 'innerKeySelector' parameter of 'Series.joinOuterLeft' to be a selector function.");if(!N.isFunction(n))throw new Error("Expected 'resultSelector' parameter of 'Series.joinOuterLeft' to be a selector function.");var i=this.except(e,t,r).select(function(e){return n(e,null)}).resetIndex(),u=this.join(e,t,r,n);return i.concat(u).resetIndex()},e.prototype.joinOuterRight=function(e,t,r,n){if(!N.isFunction(t))throw new Error("Expected 'outerKeySelector' parameter of 'Series.joinOuterRight' to be a selector function.");if(!N.isFunction(r))throw new Error("Expected 'innerKeySelector' parameter of 'Series.joinOuterRight' to be a selector function.");if(!N.isFunction(n))throw new Error("Expected 'resultSelector' parameter of 'Series.joinOuterRight' to be a selector function.");var i=e.except(this,r,t).select(function(e){return n(null,e)}).resetIndex();return this.join(e,t,r,n).concat(i).resetIndex()},e.prototype.truncateStrings=function(e){if(!N.isNumber(e))throw new Error("Expected 'maxLength' parameter to 'Series.truncateStrings' to be a number.");return this.select(function(t){return N.isString(t)&&t.length>e?t.substring(0,e):t})},e.prototype.round=function(e){if(void 0!==e){if(!N.isNumber(e))throw new Error("Expected 'numDecimalPlaces' parameter to 'Series.round' to be a number.")}else e=2;return this.select(function(t){return N.isNumber(t)?parseFloat(t.toFixed(e)):t})},e.prototype.insertPair=function(t){if(!N.isArray(t))throw new Error("Expected 'pair' parameter to 'Series.insertPair' to be an array.");if(2!==t.length)throw new Error("Expected 'pair' parameter to 'Series.insertPair' to be an array with two elements. The first element is the index, the second is the value.");return new e({pairs:[t]}).concat(this)},e.prototype.appendPair=function(t){if(!N.isArray(t))throw new Error("Expected 'pair' parameter to 'Series.appendPair' to be an array.");if(2!==t.length)throw new Error("Expected 'pair' parameter to 'Series.appendPair' to be an array with two elements. The first element is the index, the second is the value.");return this.concat(new e({pairs:[t]}))},e.prototype.fillGaps=function(e,t){if(!N.isFunction(e))throw new Error("Expected 'comparer' parameter to 'Series.fillGaps' to be a comparer function that compares two values and returns a boolean.");if(!N.isFunction(t))throw new Error("Expected 'generator' parameter to 'Series.fillGaps' to be a generator function that takes two values and returns an array of generated pairs to span the gap.");return this.rollingWindow(2).selectMany(function(r){var n=r.toPairs(),i=n[0],u=n[1];if(!e(i,u))return[i];var o=t(i,u);if(!N.isArray(o))throw new Error("Expected return from 'generator' parameter to 'Series.fillGaps' to be an array of pairs, instead got a "+typeof o);return[i].concat(o)}).withIndex(function(e){return e[0]}).select(function(e){return e[1]}).concat(this.tail(1))},e.prototype.defaultIfEmpty=function(t){if(this.none()){if(t instanceof e)return t;if(N.isArray(t))return new e(t);throw new Error("Expected 'defaultSequence' parameter to 'Series.defaultIfEmpty' to be an array or a series.")}return this},e.prototype.detectTypes=function(){var e=this;return new I.DataFrame(function(){var t=e.count(),r=e.select(function(e){var t=typeof e;return"object"===t&&N.isDate(e)&&(t="date"),t}).aggregate({},function(e,t){var r=e[t];return r||(r={count:0},e[t]=r),++r.count,e});return{columnNames:["Type","Frequency"],rows:Object.keys(r).map(function(e){return[e,r[e].count/t*100]})}})},e.prototype.detectValues=function(){var e=this;return new I.DataFrame(function(){var t=e.count(),r=e.aggregate(new Map,function(e,t){var r=e.get(t);return r||(r={count:0,value:t},e.set(t,r)),++r.count,e});return{columnNames:["Value","Frequency"],rows:Array.from(r.keys()).map(function(e){var n=r.get(e);return[n.value,n.count/t*100]})}})},e.prototype.bucket=function(e){if(!N.isNumber(e))throw new Error("Expected 'numBuckets' parameter to 'Series.bucket' to be a number.");if(this.none())return new I.DataFrame;var t=this.min(),r=(this.max()-t)/(e-1);return this.select(function(e){var n=Math.floor((e-t)/r),i=n*r+t;return{Value:e,Bucket:n,Min:i,Mid:i+.5*r,Max:i+r}}).inflate()},e.prototype.getTypeCode=function(){return"series"},e.defaultCountIterable=new l.CountIterable,e.defaultEmptyIterable=new c.EmptyIterable,e}();t.Series=T;var R=function(e){function t(r){for(var n,i,o=this,a=[],s=[],c=0,l=r.parent,f=[];null!==l;)f.push(l),l=l.config.parent;f.reverse();try{for(var h=u(f),p=h.next();!p.done;p=h.next()){var d=p.value.config;a.push(t.makeSortSpec(c,d.selector,d.direction)),s.push(t.makeSortSpec(c,t.makePairsSelector(d.selector),d.direction)),++c}}catch(e){n={error:e}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return a.push(t.makeSortSpec(c,r.selector,r.direction)),s.push(t.makeSortSpec(c,t.makePairsSelector(r.selector),r.direction)),(o=e.call(this,{values:new C.OrderedIterable(r.values,a),pairs:new C.OrderedIterable(r.pairs,s)})||this).config=r,o}return i(t,e),t.makeSortSpec=function(e,t,r){return{sortLevel:e,selector:t,direction:r}},t.makePairsSelector=function(e){return function(t,r){return e(t[1],r)}},t.prototype.thenBy=function(e){return new t({values:this.config.values,pairs:this.config.pairs,selector:e,direction:C.Direction.Ascending,parent:this})},t.prototype.thenByDescending=function(e){return new t({values:this.config.values,pairs:this.config.pairs,selector:e,direction:C.Direction.Descending,parent:this})},t}(T)},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=this&&this.__values||function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,u=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=u.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=u.return)&&r.call(u)}finally{if(i)throw i.error}}return o},a=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(o(arguments[t]));return e},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var c=r(7),l=r(8),f=r(9),h=r(10),p=r(11),d=r(12),y=r(13),m=r(14),D=r(15),v=r(56),g=r(16),w=r(17),b=r(58),E=r(18),F=r(60),C=r(62),x=r(19),A=r(5),S=r(20),_=r(21),B=r(22),I=r(64),O=r(66),k=r(68),j=s(r(23)),N=s(r(3)),M=r(0),P=r(70),T=r(4),R=s(r(24)),L=s(r(25)),W=function(){function e(t){this.configFn=null,this.content=null,this.indexedContent=null,t?T.isFunction(t)?this.configFn=t:T.isArray(t)||T.isFunction(t[Symbol.iterator])?this.content=e.initFromArray(t):this.content=e.initFromConfig(t):this.content=e.initEmpty()}return e.initFromArray=function(t){var r=t[Symbol.iterator]().next(),n=r.done?[]:Object.keys(r.value);return{index:e.defaultCountIterable,values:t,pairs:new f.MultiIterable([e.defaultCountIterable,t]),isBaked:!0,columnNames:n}},e.initEmpty=function(){return{index:e.defaultEmptyIterable,values:e.defaultEmptyIterable,pairs:e.defaultEmptyIterable,isBaked:!0,columnNames:[]}},e.initColumnNames=function(e,t){var r=[],n={},i=Array.from(e).map(function(e){return e.toString()});try{for(var o=u(i),a=o.next();!a.done;a=o.next()){var s=a.value;void 0===n[m=void 0!==t&&t?s:s.toLowerCase()]?n[m]=1:n[m]+=1}}catch(e){c={error:e}}finally{try{a&&!a.done&&(l=o.return)&&l.call(o)}finally{if(c)throw c.error}}var c,l,f,h,p={};try{for(var d=u(i),y=d.next();!y.done;y=d.next()){var m;s=y.value;if(n[m=void 0!==t&&t?s:s.toLowerCase()]>1){var D=1;void 0!==p[m]&&(D=p[m]),r.push(s+"."+D),p[m]=D+1}else r.push(s)}}catch(e){f={error:e}}finally{try{y&&!y.done&&(h=d.return)&&h.call(d)}finally{if(f)throw f.error}}return r},e.checkIterable=function(e,t){if(T.isArray(e));else if(!T.isFunction(e[Symbol.iterator]))throw new Error("Expected '"+t+"' field of DataFrame config object to be an array of values or an iterable of values.")},e.initFromConfig=function(t){var r,n,i,o,a,s,c=!1;if(t.pairs&&(e.checkIterable(t.pairs,"pairs"),i=t.pairs),t.columns){var p=t.columns;if(T.isArray(p)||T.isFunction(p[Symbol.iterator])){var d=p;o=Array.from(d).map(function(e){return e.name}),p=T.toMap(d,function(e){return e.name},function(e){return e.series})}else{if(!T.isObject(p))throw new Error("Expected 'columns' member of 'config' parameter to DataFrame constructor to be an object with fields that define columns.");o=Object.keys(p)}var y=[];try{for(var m=u(o),D=m.next();!D.done;D=m.next()){var v=D.value;e.checkIterable(p[v],v),y.push(p[v])}}catch(e){a={error:e}}finally{try{D&&!D.done&&(s=m.return)&&s.call(m)}finally{if(a)throw a.error}}n=new b.CsvRowsIterable(o,new f.MultiIterable(y))}else t.columnNames&&(o=this.initColumnNames(t.columnNames,t.caseSensitive)),t.rows?(t.columnNames||(o=new h.SelectIterable(new l.CountIterable,function(e){return"Column."+e.toString()})),e.checkIterable(t.rows,"rows"),n=new b.CsvRowsIterable(o,t.rows)):t.values?(e.checkIterable(t.values,"values"),n=t.values,t.columnNames||(o=new P.ColumnNamesIterable(n,t.considerAllRows||!1))):i?(n=new S.ExtractElementIterable(i,1),t.columnNames||(o=new P.ColumnNamesIterable(n,t.considerAllRows||!1))):(n=e.defaultEmptyIterable,t.columnNames||(o=e.defaultEmptyIterable));return t.index?(e.checkIterable(t.index,"index"),r=t.index):r=i?new S.ExtractElementIterable(i,0):e.defaultCountIterable,i||(i=new f.MultiIterable([r,n])),void 0!==t.baked&&(c=t.baked),{index:r,values:n,pairs:i,isBaked:c,columnNames:o}},e.prototype.lazyInit=function(){null===this.content&&null!==this.configFn&&(this.content=e.initFromConfig(this.configFn()))},e.prototype.getContent=function(){return this.lazyInit(),this.content},e.prototype.getRowByIndex=function(e){if(!this.indexedContent){this.indexedContent=new Map;try{for(var t=u(this.getContent().pairs),r=t.next();!r.done;r=t.next()){var n=r.value;this.indexedContent.set(n[0],n[1])}}catch(e){i={error:e}}finally{try{r&&!r.done&&(o=t.return)&&o.call(t)}finally{if(i)throw i.error}}}return this.indexedContent.get(e);var i,o},e.prototype[Symbol.iterator]=function(){return this.getContent().values[Symbol.iterator]()},e.prototype.getColumnNames=function(){return Array.from(this.getContent().columnNames)},e.prototype.getColumns=function(){var e=this;return new M.Series(function(){return{values:e.getColumnNames().map(function(t){var r=e.getSeries(t).skipWhile(function(e){return null==e}),n=r.any()?r.first():void 0;return{name:t,type:T.determineType(n),series:r}})}})},e.prototype.cast=function(){return this},e.prototype.getIndex=function(){var e=this;return new A.Index(function(){return{values:e.getContent().index}})},e.prototype.setIndex=function(e){if(!T.isString(e))throw new Error("Expected 'columnName' parameter to 'DataFrame.setIndex' to be a string that specifies the name of the column to set as the index for the dataframe.");return this.withIndex(this.getSeries(e))},e.prototype.withIndex=function(t){var r=this;return T.isFunction(t)?new e(function(){var e=r.getContent();return{columnNames:e.columnNames,values:e.values,index:r.deflate(t)}}):(e.checkIterable(t,"newIndex"),new e(function(){var e=r.getContent();return{columnNames:e.columnNames,values:e.values,index:t}}))},e.prototype.resetIndex=function(){var t=this;return new e(function(){var e=t.getContent();return{columnNames:e.columnNames,values:e.values}})},e.prototype.getSeries=function(e){var t=this;if(!T.isString(e))throw new Error("Expected 'columnName' parameter to 'DataFrame.getSeries' function to be a string that specifies the name of the column to retreive.");return new M.Series(function(){return{values:new h.SelectIterable(t.getContent().values,function(t){return t[e]}),index:t.getContent().index}})},e.prototype.hasSeries=function(e){var t,r,n=e.toLowerCase();try{for(var i=u(this.getColumnNames()),o=i.next();!o.done;o=i.next()){if(o.value.toLowerCase()===n)return!0}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return!1},e.prototype.expectSeries=function(e){if(!this.hasSeries(e))throw new Error("Expected dataframe to contain series with column name: '"+e+"'.");return this.getSeries(e)},e.prototype.withSeries=function(t,r){var n=this;if(T.isObject(t)){if(!T.isUndefined(r))throw new Error("Expected 'series' parameter to 'DataFrame.withSeries' to not be set when 'columnNameOrSpec is an object.")}else{if(!T.isString(t))throw new Error("Expected 'columnNameOrSpec' parameter to 'DataFrame.withSeries' function to be a string that specifies the column to set or replace.");if(!T.isFunction(r)&&!T.isObject(r))throw new Error("Expected 'series' parameter to 'DataFrame.withSeries' to be a Series object or a function that takes a dataframe and produces a Series.")}if(T.isObject(t)){var i=t,o=Object.keys(i),a=this;try{for(var s=u(o),c=s.next();!c.done;c=s.next()){var l=c.value;a=a.withSeries(l,i[l])}}catch(e){f={error:e}}finally{try{c&&!c.done&&(p=s.return)&&p.call(s)}finally{if(f)throw f.error}}return a.cast()}var f,p,d=t;if(this.none()){return(T.isFunction(r)?r(this):r).inflate(function(e){var t={};return t[d]=e,t}).cast()}return new e(function(){var e;e=T.isFunction(r)?r(n):r;var t=T.toMap2(e.toPairs(),function(e){return e[0]},function(e){return e[1]});return{columnNames:T.makeDistinct(n.getColumnNames().concat([d])),index:n.getContent().index,pairs:new h.SelectIterable(n.getContent().pairs,function(e){var r=e[0],n=e[1],i=Object.assign({},n);return i[d]=t.get(r),[r,i]})}})},e.merge=function(t){var r=new Map;try{for(var n=u(t),i=n.next();!i.done;i=n.next()){var o=i.value;try{for(var a=u(o.toPairs()),s=a.next();!s.done;s=a.next()){var c=s.value,l=c[0];if(r.has(l))r.set(l,Object.assign(r.get(l),c[1]));else{var f=Object.assign({},c[1]);r.set(l,f)}}}catch(e){d={error:e}}finally{try{s&&!s.done&&(y=a.return)&&y.call(a)}finally{if(d)throw d.error}}}}catch(e){h={error:e}}finally{try{i&&!i.done&&(p=n.return)&&p.call(n)}finally{if(h)throw h.error}}var h,p,d,y,m=Array.from(t).map(function(e){return e.getColumnNames()}).reduce(function(e,t){return e.concat(t)},[]),D=T.makeDistinct(m),v=Array.from(r.keys()).map(function(e){return[e,r.get(e)]});return v.sort(function(e,t){return e[0]===t[0]?0:e[0]>t[0]?1:-1}),new e({columnNames:D,pairs:v})},e.prototype.merge=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.merge([this].concat(t))},e.prototype.ensureSeries=function(e,t){if(T.isObject(e)){if(!T.isUndefined(t))throw new Error("Expected 'series' parameter to 'DataFrame.ensureSeries' to not be set when 'columnNameOrSpec is an object.")}else{if(!T.isString(e))throw new Error("Expected 'columnNameOrSpec' parameter to 'DataFrame.ensureSeries' function to be a string that specifies the column to set or replace.");if(!T.isFunction(t)&&!T.isObject(t))throw new Error("Expected 'series' parameter to 'DataFrame.ensureSeries' to be a Series object or a function that takes a dataframe and produces a Series.")}if(T.isObject(e)){var r=e,n=Object.keys(e),i=this;try{for(var o=u(n),a=o.next();!a.done;a=o.next()){var s=a.value;i=i.ensureSeries(s,r[s])}}catch(e){c={error:e}}finally{try{a&&!a.done&&(l=o.return)&&l.call(o)}finally{if(c)throw c.error}}return i}var c,l,f=e;return this.hasSeries(f)?this:this.withSeries(f,t)},e.prototype.subset=function(t){var r=this;if(!T.isArray(t))throw new Error("Expected 'columnNames' parameter to 'DataFrame.subset' to be an array of column names to keep.");return new e(function(){var e=r.getContent();return{columnNames:t,index:e.index,values:new h.SelectIterable(e.values,function(e){var r,n,i={};try{for(var o=u(t),a=o.next();!a.done;a=o.next()){var s=a.value;i[s]=e[s]}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}),pairs:new h.SelectIterable(e.pairs,function(e){var r,n,i={},o=e[1];try{for(var a=u(t),s=a.next();!s.done;s=a.next()){var c=s.value;i[c]=o[c]}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return[e[0],i]})}})},e.prototype.dropSeries=function(t){var r=this;if(!T.isArray(t)){if(!T.isString(t))throw new Error("'DataFrame.dropSeries' expected either a string or an array or strings.");t=[t]}return new e(function(){var e,n,i=r.getContent(),o=[];try{for(var a=u(i.columnNames),s=a.next();!s.done;s=a.next()){var c=s.value;-1===t.indexOf(c)&&o.push(c)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return{columnNames:o,index:i.index,values:new h.SelectIterable(i.values,function(e){var r,n,i=Object.assign({},e);try{for(var o=u(t),a=o.next();!a.done;a=o.next()){delete i[a.value]}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}),pairs:new h.SelectIterable(i.pairs,function(e){var r,n,i=Object.assign({},e[1]);try{for(var o=u(t),a=o.next();!a.done;a=o.next()){delete i[a.value]}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return[e[0],i]})}})},e.prototype.reorderSeries=function(t){var r,n,i=this;if(!T.isArray(t))throw new Error("Expected parameter 'columnNames' to 'DataFrame.reorderSeries' to be an array with column names.");try{for(var o=u(t),a=o.next();!a.done;a=o.next()){var s=a.value;if(!T.isString(s))throw new Error("Expected parameter 'columnNames' to 'DataFrame.reorderSeries' to be an array with column names.")}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return new e(function(){var e=i.getContent();return{columnNames:t,index:e.index,values:new h.SelectIterable(e.values,function(e){var r,n,i={};try{for(var o=u(t),a=o.next();!a.done;a=o.next()){var s=a.value;i[s]=e[s]}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}),pairs:new h.SelectIterable(e.pairs,function(e){var r,n,i=e[1],o={};try{for(var a=u(t),s=a.next();!s.done;s=a.next()){var c=s.value;o[c]=i[c]}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return[e[0],o]})}})},e.prototype.bringToFront=function(t){var r,n,i=this;if(T.isArray(t))try{for(var o=u(t),a=o.next();!a.done;a=o.next()){var s=a.value;if(!T.isString(s))throw new Error("Expect 'columnOrColumns' parameter to 'DataFrame.bringToFront' function to specify a column or columns via a string or an array of strings.")}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}else{if(!T.isString(t))throw new Error("Expect 'columnOrColumns' parameter to 'DataFrame.bringToFront' function to specify a column or columns via a string or an array of strings.");t=[t]}return new e(function(){var e=i.getContent(),r=Array.from(e.columnNames),n=[];try{for(var o=u(t),a=o.next();!a.done;a=o.next()){var s=a.value;-1!==r.indexOf(s)&&n.push(s)}}catch(e){c={error:e}}finally{try{a&&!a.done&&(l=o.return)&&l.call(o)}finally{if(c)throw c.error}}var c,l,f,h,p=[];try{for(var d=u(r),y=d.next();!y.done;y=d.next()){var m=y.value;-1===t.indexOf(m)&&p.push(m)}}catch(e){f={error:e}}finally{try{y&&!y.done&&(h=d.return)&&h.call(d)}finally{if(f)throw f.error}}return{columnNames:n.concat(p),index:e.index,values:e.values,pairs:e.pairs}})},e.prototype.bringToBack=function(t){var r,n,i=this;if(T.isArray(t))try{for(var o=u(t),a=o.next();!a.done;a=o.next()){var s=a.value;if(!T.isString(s))throw new Error("Expect 'columnOrColumns' parameter to 'DataFrame.bringToBack' function to specify a column or columns via a string or an array of strings.")}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}else{if(!T.isString(t))throw new Error("Expect 'columnOrColumns' parameter to 'DataFrame.bringToBack' function to specify a column or columns via a string or an array of strings.");t=[t]}return new e(function(){var e=i.getContent(),r=Array.from(e.columnNames),n=[];try{for(var o=u(t),a=o.next();!a.done;a=o.next()){var s=a.value;-1!==r.indexOf(s)&&n.push(s)}}catch(e){c={error:e}}finally{try{a&&!a.done&&(l=o.return)&&l.call(o)}finally{if(c)throw c.error}}var c,l,f,h,p=[];try{for(var d=u(r),y=d.next();!y.done;y=d.next()){var m=y.value;-1===t.indexOf(m)&&p.push(m)}}catch(e){f={error:e}}finally{try{y&&!y.done&&(h=d.return)&&h.call(d)}finally{if(f)throw f.error}}return{columnNames:p.concat(n),index:e.index,values:e.values,pairs:e.pairs}})},e.prototype.renameSeries=function(t){var r=this;if(!T.isObject(t))throw new Error("Expected parameter 'newColumnNames' to 'DataFrame.renameSeries' to be an array with column names.");var n,i,o=Object.keys(t);try{for(var a=u(o),s=a.next();!s.done;s=a.next()){var c=s.value;if(!T.isString(c))throw new Error("Expected existing column name '"+c+"' of 'newColumnNames' parameter to 'DataFrame.renameSeries' to be a string.");if(!T.isString(t[c]))throw new Error("Expected new column name '"+t[c]+"' for existing column '"+c+"' of 'newColumnNames' parameter to 'DataFrame.renameSeries' to be a string.")}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return new e(function(){var e,n,i=r.getContent(),a=[];try{for(var s=u(i.columnNames),c=s.next();!c.done;c=s.next()){var l=c.value;-1===o.indexOf(l)?a.push(l):a.push(t[l])}}catch(t){e={error:t}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}function f(e){var r,n,i=Object.assign({},e);try{for(var a=u(o),s=a.next();!s.done;s=a.next()){var c=s.value;i[t[c]]=i[c],delete i[c]}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i}return{columnNames:a,index:i.index,values:new h.SelectIterable(i.values,f),pairs:new h.SelectIterable(i.pairs,function(e){return[e[0],f(e[1])]})}})},e.prototype.toArray=function(){var e,t,r=[];try{for(var n=u(this.getContent().values),i=n.next();!i.done;i=n.next()){var o=i.value;null!=o&&r.push(o)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},e.prototype.toPairs=function(){var e,t,r=[];try{for(var n=u(this.getContent().pairs),i=n.next();!i.done;i=n.next()){var o=i.value;null!=o[1]&&null!==o[1]&&r.push(o)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},e.prototype.toObject=function(e,t){if(!T.isFunction(e))throw new Error("Expected 'keySelector' parameter to DataFrame.toObject to be a function.");if(!T.isFunction(t))throw new Error("Expected 'valueSelector' parameter to DataFrame.toObject to be a function.");return T.toMap(this,e,t)},e.prototype.toRows=function(){var e,t,r=this.getColumnNames(),n=[];try{for(var i=u(this.getContent().values),o=i.next();!o.done;o=i.next()){for(var a=o.value,s=[],c=0;c<r.length;++c)s.push(a[r[c]]);n.push(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return n},e.prototype.select=function(t){var r=this;if(!T.isFunction(t))throw new Error("Expected 'selector' parameter to 'DataFrame.select' function to be a function.");return new e(function(){var e=r.getContent();return{values:new h.SelectIterable(e.values,t),index:e.index}})},e.prototype.selectMany=function(t){var r=this;if(!T.isFunction(t))throw new Error("Expected 'selector' parameter to 'DataFrame.selectMany' to be a function.");return new e(function(){return{pairs:new p.SelectManyIterable(r.getContent().pairs,function(e,r){var n,i,o=[];try{for(var a=u(t(e[1],r)),s=a.next();