UNPKG

sequency

Version:

Functional sequences for processing iterable data in JavaScript

1 lines 26.7 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Sequency",[],t):"object"==typeof exports?exports.Sequency=t():e.Sequency=t()}(window,function(){return n=[function(W,e,t){Object.defineProperty(e,"__esModule",{value:!0}),e.range=e.generateSequence=e.extendSequence=e.isSequence=e.createSequence=e.asSequence=e.emptySequence=e.sequenceOf=void 0;var n=t(1),r=t(2),o=t(3),i=t(4),u=t(5),a=t(6),f=t(7),l=t(8),c=t(9),d=t(10),s=t(11),v=t(12),p=t(13),h=t(14),y=t(15),x=t(16),_=t(17),O=t(18),M=t(19),b=t(20),j=t(21),S=t(22),P=t(23),m=t(24),g=t(25),w=t(26),N=t(27),I=t(28),T=t(29),k=t(30),C=t(31),L=t(32),z=t(33),R=t(34),G=t(35),J=t(36),U=t(37),Z=t(38),H=t(39),K=t(40),Q=t(41),V=t(42),X=t(43),Y=t(44),$=t(45),ee=t(46),te=t(47),ne=t(48),re=t(49),oe=t(50),ie=t(51),ue=t(52),ae=t(53),fe=t(54),le=t(55),ce=t(56),de=t(58),se=t(59),ve=t(60),pe=t(61),he=t(62),ye=t(63),xe=t(64),_e=t(65),Oe=t(66),Me=t(67),be=t(68),je=t(69),Se=t(70),Pe=t(71),me=t(72),ge=t(73),q=function(e){this.iterator=e};function F(n,e){e.forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){n.prototype[e]=t.prototype[e]})})}function A(){return E([])}function E(e){if(null===e)throw new Error("Cannot create sequence for input: null");if(void 0===e)throw new Error("Cannot create sequence for input: undefined");if(null==e[Symbol.iterator])throw new Error("Cannot create sequence for non-iterable input: "+e);return B(e[Symbol.iterator]())}function B(e){return new q(e)}function D(e,t){if("function"==typeof e&&null==t)return B(new me.default(e));e="function"==typeof e?e():e;return null!=e?B(new ge.default(e,t)):A()}F(q,[n.All,r.Any,o.AsIterable,i.Associate,u.AssociateBy,a.Average,f.Chunk,l.Contains,c.Count,d.Distinct,s.DistinctBy,v.Drop,p.DropWhile,h.ElementAt,y.ElementAtOrElse,x.ElementAtOrNull,_.Filter,O.FilterIndexed,M.FilterNot,b.FilterNotNull,j.First,S.FirstOrNull,P.FlatMap,m.Flatten,g.Fold,w.FoldIndexed,N.ForEach,I.ForEachIndexed,T.GroupBy,k.IndexOf,C.IndexOfFirst,L.IndexOfLast,z.JoinToString,R.Last,G.LastOrNull,J.Map,U.MapIndexed,Z.MapNotNull,H.Max,K.MaxBy,Q.MaxWith,V.Merge,X.Min,Y.MinBy,$.Minus,ee.MinWith,te.None,ne.OnEach,re.Partition,oe.Plus,ie.Reduce,ue.ReduceIndexed,ae.Reverse,fe.Single,le.SingleOrNull,ce.Sorted,de.SortedBy,se.SortedByDescending,ve.SortedDescending,pe.SortedWith,he.Sum,ye.SumBy,xe.Take,_e.TakeWhile,Oe.ToArray,Me.ToMap,be.ToSet,je.Unzip,Se.WithIndex,Pe.Zip]),e.sequenceOf=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return E(e)},e.emptySequence=A,e.asSequence=E,e.createSequence=B,e.isSequence=function(e){return e instanceof q},e.extendSequence=function(e){F(q,[e])},e.generateSequence=D,e.range=function(e,t,n){if(void 0===n&&(n=1),t<e)throw new Error("start [".concat(e,"] must be lower then endInclusive [").concat(t,"]"));var r=e;return D(function(){try{return r<=t?r:void 0}finally{r+=n}})}},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.All=void 0,n.prototype.all=function(e){for(var t=this.iterator.next();!t.done;t=this.iterator.next())if(!e(t.value))return!1;return!0},t.All=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.Any=void 0,n.prototype.any=function(e){if(null==e)return!this.iterator.next().done;for(var t=this.iterator.next();!t.done;t=this.iterator.next())if(e(t.value))return!0;return!1},t.Any=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.AsIterable=void 0,n.prototype.asIterable=function(){var e=this.iterator,t={};return t[Symbol.iterator]=function(){return e},t},t.AsIterable=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.Associate=void 0,n.prototype.associate=function(e){for(var t=new Map,n=this.iterator.next();!n.done;n=this.iterator.next()){var r=e(n.value);t.set(r[0],r[1])}return t},t.Associate=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.AssociateBy=void 0,n.prototype.associateBy=function(t,e){for(var n="function"==typeof t?t:function(e){return e[t]},r=new Map,o=null!=e?e:function(e){return e},i=this.iterator.next();!i.done;i=this.iterator.next()){var u=n(i.value),a=o(i.value);r.set(u,a)}return r},t.AssociateBy=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.Average=void 0,n.prototype.average=function(){for(var e=0,t=0,n=this.iterator.next();!n.done;n=this.iterator.next())e+=n.value,t++;return 0===t?Number.NaN:e/t},t.Average=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.Chunk=void 0,n.prototype.chunk=function(e){if(e<1)throw new Error("chunkSize must be > 0 but is "+e);for(var t=[],n=0,r=this.iterator.next();!r.done;r=this.iterator.next()){var o=Math.floor(n/e);null==t[o]?t[o]=[r.value]:t[o].push(r.value),n++}return t},t.Chunk=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.Contains=void 0,n.prototype.contains=function(e){for(var t=this.iterator.next();!t.done;t=this.iterator.next())if(e===t.value)return!0;return!1},t.Contains=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.Count=void 0,n.prototype.count=function(e){var t=0;if(null==e)for(var n=this.iterator.next();!n.done;n=this.iterator.next())t++;else for(n=this.iterator.next();!n.done;n=this.iterator.next())e(n.value)&&t++;return t},t.Count=n},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.Distinct=void 0;var r=n(0),o=(i.prototype.next=function(e){for(var t=this.iterator.next();!t.done;t=this.iterator.next()){var n=this.set.size;if(this.set.add(t.value),this.set.size>n)return{done:!1,value:t.value}}return this.set.clear(),{done:!0,value:void 0}},i);function i(e){this.iterator=e,this.set=new Set}function u(){}u.prototype.distinct=function(){return(0,r.createSequence)(new o(this.iterator))},t.Distinct=u},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.DistinctBy=void 0;var r=n(0),o=(i.prototype.next=function(e){for(var t=this.iterator.next();!t.done;t=this.iterator.next()){var n=this.selector(t.value),r=this.set.size;if(this.set.add(n),this.set.size>r)return{done:!1,value:t.value}}return this.set.clear(),{done:!0,value:void 0}},i);function i(e,t){this.iterator=e,this.selector=t,this.set=new Set}function u(){}u.prototype.distinctBy=function(e){return(0,r.createSequence)(new o(this.iterator,e))},t.DistinctBy=u},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.Drop=void 0,n.prototype.drop=function(t){return this.withIndex().dropWhile(function(e){return e.index<t}).map(function(e){return e.value})},t.Drop=n},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.DropWhile=void 0;var r=n(0),o=(i.prototype.next=function(e){for(var t=this.iterator.next();!t.done;t=this.iterator.next()){if(!this.dropping)return{done:!1,value:t.value};if(!this.predicate(t.value))return{done:this.dropping=!1,value:t.value}}return{done:!0,value:void 0}},i);function i(e,t){this.iterator=e,this.predicate=t,this.dropping=!0}function u(){}u.prototype.dropWhile=function(e){return(0,r.createSequence)(new o(this.iterator,e))},t.DropWhile=u},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.ElementAt=void 0,n.prototype.elementAt=function(e){for(var t=0,n=this.iterator.next();!n.done;n=this.iterator.next()){if(t===e)return n.value;t++}throw new Error("Index out of bounds: "+e)},t.ElementAt=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.ElementAtOrElse=void 0,n.prototype.elementAtOrElse=function(e,t){for(var n=0,r=this.iterator.next();!r.done;r=this.iterator.next()){if(n===e)return r.value;n++}return t(e)},t.ElementAtOrElse=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.ElementAtOrNull=void 0,n.prototype.elementAtOrNull=function(e){for(var t=0,n=this.iterator.next();!n.done;n=this.iterator.next()){if(t===e)return n.value;t++}return null},t.ElementAtOrNull=n},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.Filter=void 0;var r=n(0),o=(i.prototype.next=function(e){for(var t=this.iterator.next();!t.done;t=this.iterator.next())if(this.predicate(t.value))return{done:!1,value:t.value};return{done:!0,value:void 0}},i);function i(e,t){this.predicate=e,this.iterator=t}function u(){}u.prototype.filter=function(e){return(0,r.createSequence)(new o(e,this.iterator))},t.Filter=u},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.FilterIndexed=void 0,n.prototype.filterIndexed=function(t){return this.withIndex().filter(function(e){return t(e.index,e.value)}).map(function(e){return e.value})},t.FilterIndexed=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.FilterNot=void 0,n.prototype.filterNot=function(t){return this.filter(function(e){return!t(e)})},t.FilterNot=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.FilterNotNull=void 0,n.prototype.filterNotNull=function(){return this.filter(function(e){return null!==e})},t.FilterNotNull=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.First=void 0,n.prototype.first=function(e){if(null!=e)return this.filter(e).first();e=this.iterator.next();if(e.done)throw new Error("No such element");return e.value},t.First=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.FirstOrNull=void 0,n.prototype.firstOrNull=function(e){if(null!=e)return this.filter(e).firstOrNull();e=this.iterator.next();return e.done?null:e.value},n.prototype.find=function(e){return this.firstOrNull(e)},t.FirstOrNull=n},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.FlatMap=void 0;var r=n(0),o=(i.prototype.next=function(e){if(null!=this.current){var t=this.current.next();if(!t.done)return t}var t=this.iterator.next();return t.done?{done:!0,value:void 0}:(t=this.transform(t.value),this.current=t.iterator,this.next())},i);function i(e,t){this.transform=e,this.iterator=t}function u(){}u.prototype.flatMap=function(e){return(0,r.createSequence)(new o(e,this.iterator))},t.FlatMap=u},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.Flatten=void 0;var r=n(0);function o(){}o.prototype.flatten=function(){return this.flatMap(function(e){return(0,r.isSequence)(e)?e:(0,r.asSequence)(e)})},t.Flatten=o},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.Fold=void 0,n.prototype.fold=function(e,t){for(var n=e,r=this.iterator.next();!r.done;r=this.iterator.next())n=t(n,r.value);return n},t.Fold=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.FoldIndexed=void 0,n.prototype.foldIndexed=function(e,t){for(var n=e,r=0,o=this.iterator.next();!o.done;o=this.iterator.next())n=t(r,n,o.value),r++;return n},t.FoldIndexed=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.ForEach=void 0,n.prototype.forEach=function(e){for(var t=this.iterator.next();!t.done;t=this.iterator.next())e(t.value)},t.ForEach=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.ForEachIndexed=void 0,n.prototype.forEachIndexed=function(t){this.withIndex().forEach(function(e){return t(e.index,e.value)})},t.ForEachIndexed=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.GroupBy=void 0,n.prototype.groupBy=function(e){for(var t=new Map,n=this.iterator.next();!n.done;n=this.iterator.next()){var r=e(n.value),o=t.get(r);null==o?t.set(r,[n.value]):o.push(n.value)}return t},t.GroupBy=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.IndexOf=void 0,n.prototype.indexOf=function(e){for(var t=0,n=this.iterator.next();!n.done;n=this.iterator.next()){if(e===n.value)return t;t++}return-1},t.IndexOf=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.IndexOfFirst=void 0,n.prototype.indexOfFirst=function(e){for(var t=0,n=this.iterator.next();!n.done;n=this.iterator.next()){if(e(n.value))return t;t++}return-1},t.IndexOfFirst=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.IndexOfLast=void 0,n.prototype.indexOfLast=function(e){for(var t=0,n=-1,r=this.iterator.next();!r.done;r=this.iterator.next())e(r.value)&&(n=t),t++;return n},t.IndexOfLast=n},function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var d={value:"",separator:", ",prefix:"",postfix:"",limit:-1,truncated:"...",transform:t.JoinToString=void 0};function n(){}n.prototype.joinToString=function(e){for(var t=(e=void 0===e?d:e).value,n=e.separator,r=void 0===n?d.separator:n,n=e.prefix,n=void 0===n?d.prefix:n,o=e.postfix,o=void 0===o?d.postfix:o,i=e.limit,u=void 0===i?d.limit:i,i=e.truncated,i=void 0===i?d.truncated:i,e=e.transform,a=void 0===e?d.transform:e,f="".concat(void 0===t?d.value:t).concat(n),l=0,c=this.iterator.next();!c.done&&(1<++l&&(f+=r),u<0||l<=u);c=this.iterator.next())f+=(null!=a?a:String)(c.value);return 0<=u&&u<l&&(f+=i),f+=o},n.prototype.joinTo=function(e){return this.joinToString(e=void 0===e?d:e)},t.JoinToString=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.Last=void 0,n.prototype.last=function(e){if(null!=e)return this.filter(e).last();for(var t,n=!0,r=this.iterator.next();!r.done;r=this.iterator.next())t=r.value,n=!1;if(n)throw new Error("No such element");return t},t.Last=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.LastOrNull=void 0,n.prototype.lastOrNull=function(e){if(null!=e)return this.filter(e).lastOrNull();for(var t=null,n=this.iterator.next();!n.done;n=this.iterator.next())t=n.value;return t},n.prototype.findLast=function(e){return this.lastOrNull(e)},t.LastOrNull=n},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.Map=void 0;var r=n(0),o=(i.prototype.next=function(e){var t=this.iterator.next();return t.done?{done:!0,value:void 0}:{done:!1,value:this.transform(t.value)}},i);function i(e,t){this.transform=e,this.iterator=t}function u(){}u.prototype.map=function(e){return(0,r.createSequence)(new o(e,this.iterator))},t.Map=u},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.MapIndexed=void 0,n.prototype.mapIndexed=function(t){return this.withIndex().map(function(e){return t(e.index,e.value)})},t.MapIndexed=n},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.MapNotNull=void 0;var r=n(0);function o(){}o.prototype.mapNotNull=function(t){return this.flatMap(function(e){e=t(e);return null!==e?(0,r.sequenceOf)(e):(0,r.emptySequence)()})},t.MapNotNull=o},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.Max=void 0,n.prototype.max=function(){for(var e=null,t=this.iterator.next();!t.done;t=this.iterator.next())(null==e||t.value>e)&&(e=t.value);return e},t.Max=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.MaxBy=void 0,n.prototype.maxBy=function(e){for(var t=null,n=null,r=this.iterator.next();!r.done;r=this.iterator.next()){var o=e(r.value);(null==n||n<o)&&(n=o,t=r.value)}return t},t.MaxBy=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.MaxWith=void 0,n.prototype.maxWith=function(e){for(var t=null,n=this.iterator.next();!n.done;n=this.iterator.next())(null==t||0<e(n.value,t))&&(t=n.value);return t},t.MaxWith=n},function(e,t,n){var i=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||((r=r||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},u=(Object.defineProperty(t,"__esModule",{value:!0}),t.Merge=void 0,n(0));function r(){}r.prototype.merge=function(e,r,t){void 0===t&&(t=!1);var o=((0,u.isSequence)(e)?e:(0,u.asSequence)(e)).toArray(),e=this.toArray().map(function(e){var t=r(e),n=(0,u.asSequence)(o).find(function(e){return r(e)===t});return null!=n?(o=o.filter(function(e){return e!==n}),n):e});return t?(0,u.asSequence)(i(i([],o,!0),e,!0)):(0,u.asSequence)(i(i([],e,!0),o,!0))},t.Merge=r},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.Min=void 0,n.prototype.min=function(){for(var e=null,t=this.iterator.next();!t.done;t=this.iterator.next())(null==e||t.value<e)&&(e=t.value);return e},t.Min=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.MinBy=void 0,n.prototype.minBy=function(e){for(var t=null,n=null,r=this.iterator.next();!r.done;r=this.iterator.next()){var o=e(r.value);(null==n||o<n)&&(n=o,t=r.value)}return t},t.MinBy=n},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.Minus=void 0;var r=n(0);function o(){}o.prototype.minus=function(t){var n;return(0,r.isSequence)(t)?(n=t.toArray(),this.filter(function(e){return n.indexOf(e)<0})):t instanceof Array?this.filter(function(e){return t.indexOf(e)<0}):this.filter(function(e){return e!==t})},t.Minus=o},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.MinWith=void 0,n.prototype.minWith=function(e){for(var t=null,n=this.iterator.next();!n.done;n=this.iterator.next())(null==t||e(n.value,t)<0)&&(t=n.value);return t},t.MinWith=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.None=void 0,n.prototype.none=function(e){var t;if(null==e)return null!=(t=null==(t=this.iterator.next())?void 0:t.done)&&t;for(var n=this.iterator.next();!n.done;n=this.iterator.next())if(e(n.value))return!1;return!0},t.None=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.OnEach=void 0,n.prototype.onEach=function(t){return this.map(function(e){return t(e),e})},t.OnEach=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.Partition=void 0,n.prototype.partition=function(e){for(var t=[],n=[],r=this.iterator.next();!r.done;r=this.iterator.next())(e(r.value)?t:n).push(r.value);return{true:t,false:n}},t.Partition=n},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.Plus=void 0;var r=n(0),o=(i.prototype.next=function(e){var t=this.first.next();if(!t.done)return{done:!1,value:t.value};t=this.second.next();return t.done?{done:!0,value:void 0}:{done:!1,value:t.value}},i);function i(e,t){this.first=e,this.second=t}function u(){}u.prototype.plus=function(e){return(0,r.isSequence)(e)?(0,r.createSequence)(new o(this.iterator,e.iterator)):(e=(e instanceof Array?e:[e])[Symbol.iterator](),(0,r.createSequence)(new o(this.iterator,e)))},t.Plus=u},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.Reduce=void 0,n.prototype.reduce=function(e){var t=this.iterator.next();if(t.done)throw new Error("Cannot reduce empty sequence");for(var n=t.value,r=this.iterator.next();!r.done;r=this.iterator.next())n=e(n,r.value);return n},t.Reduce=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.ReduceIndexed=void 0,n.prototype.reduceIndexed=function(e){var t=this.iterator.next();if(t.done)throw new Error("Cannot reduce empty sequence");for(var n=1,r=t.value,o=this.iterator.next();!o.done;o=this.iterator.next())r=e(n,r,o.value),n++;return r},t.ReduceIndexed=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.Reverse=void 0,n.prototype.reverse=function(){return this.withIndex().sortedByDescending(function(e){return e.index}).map(function(e){return e.value})},t.Reverse=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.Single=void 0,n.prototype.single=function(e){if(null!=e)return this.filter(e).single();e=this.iterator.next();if(e.done)throw new Error("No such element");if(this.iterator.next().done)return e.value;throw new Error("Expect single element")},t.Single=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.SingleOrNull=void 0,n.prototype.singleOrNull=function(e){if(null!=e)return this.filter(e).singleOrNull();e=this.iterator.next();return!e.done&&this.iterator.next().done?e.value:null},t.SingleOrNull=n},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.Sorted=void 0;var r=n(0),o=n(57);function i(){}i.prototype.sorted=function(e){for(var t=[],n=this.iterator.next();!n.done;n=this.iterator.next())t.push(n.value);null==e?t.sort():(e=e((0,o.default)()),t.sort(e));e=t[Symbol.iterator]();return(0,r.createSequence)(e)},t.Sorted=i},function(e,t){function i(o){return Object.assign(o,{reversed:function(){return i(function(e,t){return-1*o(e,t)})},then:function(r){return i(function(e,t){var n=o(e,t);return 0!==n?n:r(e,t)})},thenDescending:function(e){return this.then(i(e).reversed())},thenBy:function(e){var n=u(e);return this.then(function(e,t){return a(n(e),n(t))})},thenByDescending:function(e){var n=u(e);return this.then(i(function(e,t){return a(n(e),n(t))}).reversed())}})}function n(e){var n=u(e);return i(function(e,t){return a(n(e),n(t))})}function r(e){var n=u(e);return i(function(e,t){return a(n(t),n(e))})}function u(t){return"function"==typeof t?t:function(e){return e[t]}}function a(e,t){return e<t?-1:t<e?1:0}function o(){return i(a)}function f(){return i(a).reversed()}function l(){return i(function(e,t){return null===e?1:null===t?-1:0})}function c(){return i(function(e,t){return null===e?-1:null===t?1:0})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return{compare:i,compareBy:n,compareByDescending:r,naturalOrder:o,reverseOrder:f,nullsFirst:c,nullsLast:l}}},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.SortedBy=void 0,n.prototype.sortedBy=function(t){return this.sorted(function(e){return e.compareBy(t)})},t.SortedBy=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.SortedByDescending=void 0,n.prototype.sortedByDescending=function(t){return this.sorted(function(e){return e.compareByDescending(t)})},t.SortedByDescending=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.SortedDescending=void 0,n.prototype.sortedDescending=function(){return this.sorted(function(e){return e.reverseOrder()})},t.SortedDescending=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.SortedWith=void 0,n.prototype.sortedWith=function(t){return this.sorted(function(e){return e.compare(t)})},t.SortedWith=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.Sum=void 0,n.prototype.sum=function(){for(var e=0,t=this.iterator.next();!t.done;t=this.iterator.next())e+=t.value;return e},t.Sum=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.SumBy=void 0,n.prototype.sumBy=function(e){for(var t=0,n=this.iterator.next();!n.done;n=this.iterator.next())t+=e(n.value);return t},t.SumBy=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.Take=void 0,n.prototype.take=function(t){return this.withIndex().takeWhile(function(e){return e.index<t}).map(function(e){return e.value})},t.Take=n},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.TakeWhile=void 0;var r=n(0),o=(i.prototype.next=function(e){var t=this.iterator.next();if(!t.done&&this.predicate(t.value))return{done:!1,value:t.value};return{done:!0,value:void 0}},i);function i(e,t){this.iterator=e,this.predicate=t}function u(){}u.prototype.takeWhile=function(e){return(0,r.createSequence)(new o(this.iterator,e))},t.TakeWhile=u},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.ToArray=void 0,n.prototype.toArray=function(e){for(var t=e||[],n=this.iterator.next();!n.done;n=this.iterator.next())t.push(n.value);return t},n.prototype.toList=function(e){return this.toArray(e)},t.ToArray=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.ToMap=void 0,n.prototype.toMap=function(e){for(var t=e||new Map,n=this.iterator.next();!n.done;n=this.iterator.next()){var r=n.value,o=r[0],r=r[1];t.set(o,r)}return t},t.ToMap=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.ToSet=void 0,n.prototype.toSet=function(e){for(var t=e||new Set,n=this.iterator.next();!n.done;n=this.iterator.next())t.add(n.value);return t},t.ToSet=n},function(e,t){function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.Unzip=void 0,n.prototype.unzip=function(){for(var e=[],t=[],n=this.iterator.next();!n.done;n=this.iterator.next()){var r=n.value,o=r[0],r=r[1];e.push(o),t.push(r)}return[e,t]},t.Unzip=n},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.WithIndex=void 0;var r=n(0),o=(i.prototype.next=function(e){var t=this.iterator.next();return t.done?{done:!0,value:void 0}:(this.index++,{done:!1,value:{index:this.index,value:t.value}})},i);function i(e){this.iterator=e,this.index=-1}function u(){}u.prototype.withIndex=function(){return(0,r.createSequence)(new o(this.iterator))},t.WithIndex=u},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.Zip=void 0;var r=n(0),o=(i.prototype.next=function(e){var t=this.iterator1.next(),n=this.iterator2.next();return t.done||n.done?{done:!0,value:void 0}:{done:!1,value:[t.value,n.value]}},i);function i(e,t){this.iterator1=e,this.iterator2=t}function u(){}u.prototype.zip=function(e){return(0,r.createSequence)(new o(this.iterator,e.iterator))},t.Zip=u},function(e,t){function n(e){this.nextFunction=e}Object.defineProperty(t,"__esModule",{value:!0}),n.prototype.next=function(e){var t=this.nextFunction();return{done:null==t,value:t}},t.default=n},function(e,t){function n(e,t){this.seed=e,this.nextFunction=t}Object.defineProperty(t,"__esModule",{value:!0}),n.prototype.next=function(e){if(null==this.prevItem)return this.prevItem=this.seed,{done:!1,value:this.seed};var t=this.nextFunction(this.prevItem);return null==t?{done:!0,value:void 0}:{done:!1,value:this.prevItem=t}},t.default=n}],r={},o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0);function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}var n,r});