UNPKG

@paraboly/pwc-multi-filter

Version:

A wrapper over pwc-tabview and pwc-filter. Provides means of dynamically managing multiple filters via a single component.

1 lines 37.6 kB
System.register([],(function(e){"use strict";return{execute:function(){e({c:r,r:i});var t=e("a",typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{});function r(e,t){return t={exports:{}},e(t,t.exports),t.exports}var n=r((function(e){(function(t,r){var n={Identity:function(e){return e},True:function(){return true},Blank:function(){}};var i={Boolean:typeof true,Number:typeof 0,String:typeof"",Object:typeof{},Undefined:typeof r,Function:typeof function(){}};var u={"":n.Identity};var o={createLambda:function(e){if(e==null)return n.Identity;if(typeof e===i.String){var t=u[e];if(t!=null){return t}if(e.indexOf("=>")===-1){var r=new RegExp("[$]+","g");var o=0;var a;while((a=r.exec(e))!=null){var f=a[0].length;if(f>o){o=f}}var c=[];for(var s=1;s<=o;s++){var l="";for(var h=0;h<s;h++){l+="$"}c.push(l)}var p=Array.prototype.join.call(c,",");t=new Function(p,"return "+e);u[e]=t;return t}else{var v=e.match(/^[(\s]*([^()]*?)[)\s]*=>(.*)/);t=new Function(v[1],"return "+v[2]);u[e]=t;return t}}return e},isIEnumerable:function(e){if(typeof Enumerator!==i.Undefined){try{new Enumerator(e);return true}catch(t){}}return false},defineProperty:Object.defineProperties!=null?function(e,t,r){Object.defineProperty(e,t,{enumerable:false,configurable:true,writable:true,value:r})}:function(e,t,r){e[t]=r},compare:function(e,t){return e===t?0:e>t?1:-1},dispose:function(e){if(e!=null)e.dispose()},hasNativeIteratorSupport:function(){return typeof Symbol!=="undefined"&&typeof Symbol.iterator!=="undefined"}};var a={Before:0,Running:1,After:2};var f=function(e,t,r){var n=new c;var i=a.Before;this.current=n.current;this.moveNext=function(){try{switch(i){case a.Before:i=a.Running;e();case a.Running:if(t.apply(n)){return true}else{this.dispose();return false}case a.After:return false}}catch(r){this.dispose();throw r}};this.dispose=function(){if(i!=a.Running)return;try{r()}finally{i=a.After}}};var c=function(){var e=null;this.current=function(){return e};this.yieldReturn=function(t){e=t;return true};this.yieldBreak=function(){return false}};var s=function(e){this.getEnumerator=e};s.Utils={};s.Utils.createLambda=function(e){return o.createLambda(e)};s.Utils.createEnumerable=function(e){return new s(e)};s.Utils.createEnumerator=function(e,t,r){return new f(e,t,r)};s.Utils.extendTo=function(e){var t=e.prototype;var r;if(e===Array){r=v.prototype;o.defineProperty(t,"getSource",(function(){return this}))}else{r=s.prototype;o.defineProperty(t,"getEnumerator",(function(){return s.from(this).getEnumerator()}))}for(var n in r){var i=r[n];if(t[n]==i)continue;if(t[n]!=null){n=n+"ByLinq";if(t[n]==i)continue}if(i instanceof Function){o.defineProperty(t,n,i)}}};s.choice=function(){var e=arguments;return new s((function(){return new f((function(){e=e[0]instanceof Array?e[0]:e[0].getEnumerator!=null?e[0].toArray():e}),(function(){return this.yieldReturn(e[Math.floor(Math.random()*e.length)])}),n.Blank)}))};s.cycle=function(){var e=arguments;return new s((function(){var t=0;return new f((function(){e=e[0]instanceof Array?e[0]:e[0].getEnumerator!=null?e[0].toArray():e}),(function(){if(t>=e.length)t=0;return this.yieldReturn(e[t++])}),n.Blank)}))};s.empty=function(){return new s((function(){return new f(n.Blank,(function(){return false}),n.Blank)}))};s.from=function(e){if(e==null){return s.empty()}if(e instanceof s){return e}if(typeof e==i.Number||typeof e==i.Boolean){return s.repeat(e,1)}if(typeof e==i.String){return new s((function(){var t=0;return new f(n.Blank,(function(){return t<e.length?this.yieldReturn(e.charAt(t++)):false}),n.Blank)}))}if(typeof e!=i.Function){if(typeof e.length==i.Number){return new v(e)}if(typeof Symbol!=="undefined"&&typeof e[Symbol.iterator]!=="undefined"){return new s((function(){return new f(n.Blank,(function(){var t=e.next();return t.done?false:this.yieldReturn(t.value)}),n.Blank)}))}if(!(e instanceof Object)&&o.isIEnumerable(e)){return new s((function(){var t=true;var r;return new f((function(){r=new Enumerator(e)}),(function(){if(t)t=false;else r.moveNext();return r.atEnd()?false:this.yieldReturn(r.item())}),n.Blank)}))}if(typeof Windows===i.Object&&typeof e.first===i.Function){return new s((function(){var t=true;var r;return new f((function(){r=e.first()}),(function(){if(t)t=false;else r.moveNext();return r.hasCurrent?this.yieldReturn(r.current):this.yieldBreak()}),n.Blank)}))}}return new s((function(){var t=[];var r=0;return new f((function(){for(var r in e){var n=e[r];if(!(n instanceof Function)&&Object.prototype.hasOwnProperty.call(e,r)){t.push({key:r,value:n})}}}),(function(){return r<t.length?this.yieldReturn(t[r++]):false}),n.Blank)}))},s.make=function(e){return s.repeat(e,1)};s.matches=function(e,t,r){if(r==null)r="";if(t instanceof RegExp){r+=t.ignoreCase?"i":"";r+=t.multiline?"m":"";t=t.source}if(r.indexOf("g")===-1)r+="g";return new s((function(){var i;return new f((function(){i=new RegExp(t,r)}),(function(){var t=i.exec(e);return t?this.yieldReturn(t):false}),n.Blank)}))};s.range=function(e,t,r){if(r==null)r=1;return new s((function(){var i;var u=0;return new f((function(){i=e-r}),(function(){return u++<t?this.yieldReturn(i+=r):this.yieldBreak()}),n.Blank)}))};s.rangeDown=function(e,t,r){if(r==null)r=1;return new s((function(){var i;var u=0;return new f((function(){i=e+r}),(function(){return u++<t?this.yieldReturn(i-=r):this.yieldBreak()}),n.Blank)}))};s.rangeTo=function(e,t,r){if(r==null)r=1;if(e<t){return new s((function(){var i;return new f((function(){i=e-r}),(function(){var e=i+=r;return e<=t?this.yieldReturn(e):this.yieldBreak()}),n.Blank)}))}else{return new s((function(){var i;return new f((function(){i=e+r}),(function(){var e=i-=r;return e>=t?this.yieldReturn(e):this.yieldBreak()}),n.Blank)}))}};s.repeat=function(e,t){if(t!=null)return s.repeat(e).take(t);return new s((function(){return new f(n.Blank,(function(){return this.yieldReturn(e)}),n.Blank)}))};s.repeatWithFinalize=function(e,t){e=o.createLambda(e);t=o.createLambda(t);return new s((function(){var r;return new f((function(){r=e()}),(function(){return this.yieldReturn(r)}),(function(){if(r!=null){t(r);r=null}}))}))};s.generate=function(e,t){if(t!=null)return s.generate(e).take(t);e=o.createLambda(e);return new s((function(){return new f(n.Blank,(function(){return this.yieldReturn(e())}),n.Blank)}))};s.toInfinity=function(e,t){if(e==null)e=0;if(t==null)t=1;return new s((function(){var r;return new f((function(){r=e-t}),(function(){return this.yieldReturn(r+=t)}),n.Blank)}))};s.toNegativeInfinity=function(e,t){if(e==null)e=0;if(t==null)t=1;return new s((function(){var r;return new f((function(){r=e+t}),(function(){return this.yieldReturn(r-=t)}),n.Blank)}))};s.unfold=function(e,t){t=o.createLambda(t);return new s((function(){var r=true;var i;return new f(n.Blank,(function(){if(r){r=false;i=e;return this.yieldReturn(i)}i=t(i);return this.yieldReturn(i)}),n.Blank)}))};s.defer=function(e){return new s((function(){var t;return new f((function(){t=s.from(e()).getEnumerator()}),(function(){return t.moveNext()?this.yieldReturn(t.current()):this.yieldBreak()}),(function(){o.dispose(t)}))}))};s.prototype.traverseBreadthFirst=function(e,t){var r=this;e=o.createLambda(e);t=o.createLambda(t);return new s((function(){var n;var i=0;var u=[];return new f((function(){n=r.getEnumerator()}),(function(){while(true){if(n.moveNext()){u.push(n.current());return this.yieldReturn(t(n.current(),i))}var r=s.from(u).selectMany((function(t){return e(t)}));if(!r.any()){return false}else{i++;u=[];o.dispose(n);n=r.getEnumerator()}}}),(function(){o.dispose(n)}))}))};s.prototype.traverseDepthFirst=function(e,t){var r=this;e=o.createLambda(e);t=o.createLambda(t);return new s((function(){var n=[];var i;return new f((function(){i=r.getEnumerator()}),(function(){while(true){if(i.moveNext()){var r=t(i.current(),n.length);n.push(i);i=s.from(e(i.current())).getEnumerator();return this.yieldReturn(r)}if(n.length<=0)return false;o.dispose(i);i=n.pop()}}),(function(){try{o.dispose(i)}finally{s.from(n).forEach((function(e){e.dispose()}))}}))}))};s.prototype.flatten=function(){var e=this;return new s((function(){var t;var r=null;return new f((function(){t=e.getEnumerator()}),(function(){while(true){if(r!=null){if(r.moveNext()){return this.yieldReturn(r.current())}else{r=null}}if(t.moveNext()){if(t.current()instanceof Array){o.dispose(r);r=s.from(t.current()).selectMany(n.Identity).flatten().getEnumerator();continue}else{return this.yieldReturn(t.current())}}return false}}),(function(){try{o.dispose(t)}finally{o.dispose(r)}}))}))};s.prototype.pairwise=function(e){var t=this;e=o.createLambda(e);return new s((function(){var r;return new f((function(){r=t.getEnumerator();r.moveNext()}),(function(){var t=r.current();return r.moveNext()?this.yieldReturn(e(t,r.current())):false}),(function(){o.dispose(r)}))}))};s.prototype.scan=function(e,t){var r;if(t==null){t=o.createLambda(e);r=false}else{t=o.createLambda(t);r=true}var n=this;return new s((function(){var i;var u;var a=true;return new f((function(){i=n.getEnumerator()}),(function(){if(a){a=false;if(!r){if(i.moveNext()){return this.yieldReturn(u=i.current())}}else{return this.yieldReturn(u=e)}}return i.moveNext()?this.yieldReturn(u=t(u,i.current())):false}),(function(){o.dispose(i)}))}))};s.prototype.select=function(e){e=o.createLambda(e);if(e.length<=1){return new d(this,null,e)}else{var t=this;return new s((function(){var r;var n=0;return new f((function(){r=t.getEnumerator()}),(function(){return r.moveNext()?this.yieldReturn(e(r.current(),n++)):false}),(function(){o.dispose(r)}))}))}};s.prototype.selectMany=function(e,t){var n=this;e=o.createLambda(e);if(t==null)t=function(e,t){return t};t=o.createLambda(t);return new s((function(){var i;var u=r;var a=0;return new f((function(){i=n.getEnumerator()}),(function(){if(u===r){if(!i.moveNext())return false}do{if(u==null){var n=e(i.current(),a++);u=s.from(n).getEnumerator()}if(u.moveNext()){return this.yieldReturn(t(i.current(),u.current()))}o.dispose(u);u=null}while(i.moveNext());return false}),(function(){try{o.dispose(i)}finally{o.dispose(u)}}))}))};s.prototype.where=function(e){e=o.createLambda(e);if(e.length<=1){return new y(this,e)}else{var t=this;return new s((function(){var r;var n=0;return new f((function(){r=t.getEnumerator()}),(function(){while(r.moveNext()){if(e(r.current(),n++)){return this.yieldReturn(r.current())}}return false}),(function(){o.dispose(r)}))}))}};s.prototype.choose=function(e){e=o.createLambda(e);var t=this;return new s((function(){var r;var n=0;return new f((function(){r=t.getEnumerator()}),(function(){while(r.moveNext()){var t=e(r.current(),n++);if(t!=null){return this.yieldReturn(t)}}return this.yieldBreak()}),(function(){o.dispose(r)}))}))};s.prototype.ofType=function(e){var t;switch(e){case Number:t=i.Number;break;case String:t=i.String;break;case Boolean:t=i.Boolean;break;case Function:t=i.Function;break;default:t=null;break}return t===null?this.where((function(t){return t instanceof e})):this.where((function(e){return typeof e===t}))};s.prototype.zip=function(){var e=arguments;var t=o.createLambda(arguments[arguments.length-1]);var r=this;if(arguments.length==2){var n=arguments[0];return new s((function(){var e;var i;var u=0;return new f((function(){e=r.getEnumerator();i=s.from(n).getEnumerator()}),(function(){if(e.moveNext()&&i.moveNext()){return this.yieldReturn(t(e.current(),i.current(),u++))}return false}),(function(){try{o.dispose(e)}finally{o.dispose(i)}}))}))}else{return new s((function(){var n;var i=0;return new f((function(){var t=s.make(r).concat(s.from(e).takeExceptLast().select(s.from)).select((function(e){return e.getEnumerator()})).toArray();n=s.from(t)}),(function(){if(n.all((function(e){return e.moveNext()}))){var e=n.select((function(e){return e.current()})).toArray();e.push(i++);return this.yieldReturn(t.apply(null,e))}else{return this.yieldBreak()}}),(function(){s.from(n).forEach(o.dispose)}))}))}};s.prototype.merge=function(){var e=arguments;var t=this;return new s((function(){var r;var n=-1;return new f((function(){r=s.make(t).concat(s.from(e).select(s.from)).select((function(e){return e.getEnumerator()})).toArray()}),(function(){while(r.length>0){n=n>=r.length-1?0:n+1;var e=r[n];if(e.moveNext()){return this.yieldReturn(e.current())}else{e.dispose();r.splice(n--,1)}}return this.yieldBreak()}),(function(){s.from(r).forEach(o.dispose)}))}))};s.prototype.join=function(e,t,i,u,a){t=o.createLambda(t);i=o.createLambda(i);u=o.createLambda(u);a=o.createLambda(a);var c=this;return new s((function(){var l;var h;var p=null;var v=0;return new f((function(){l=c.getEnumerator();h=s.from(e).toLookup(i,n.Identity,a)}),(function(){while(true){if(p!=null){var e=p[v++];if(e!==r){return this.yieldReturn(u(l.current(),e))}e=null;v=0}if(l.moveNext()){var n=t(l.current());p=h.get(n).toArray()}else{return false}}}),(function(){o.dispose(l)}))}))};s.prototype.groupJoin=function(e,t,r,i,u){t=o.createLambda(t);r=o.createLambda(r);i=o.createLambda(i);u=o.createLambda(u);var a=this;return new s((function(){var c=a.getEnumerator();var l=null;return new f((function(){c=a.getEnumerator();l=s.from(e).toLookup(r,n.Identity,u)}),(function(){if(c.moveNext()){var e=l.get(t(c.current()));return this.yieldReturn(i(c.current(),e))}return false}),(function(){o.dispose(c)}))}))};s.prototype.all=function(e){e=o.createLambda(e);var t=true;this.forEach((function(r){if(!e(r)){t=false;return false}}));return t};s.prototype.any=function(e){e=o.createLambda(e);var t=this.getEnumerator();try{if(arguments.length==0)return t.moveNext();while(t.moveNext()){if(e(t.current()))return true}return false}finally{o.dispose(t)}};s.prototype.isEmpty=function(){return!this.any()};s.prototype.concat=function(){var e=this;if(arguments.length==1){var t=arguments[0];return new s((function(){var r;var n;return new f((function(){r=e.getEnumerator()}),(function(){if(n==null){if(r.moveNext())return this.yieldReturn(r.current());n=s.from(t).getEnumerator()}if(n.moveNext())return this.yieldReturn(n.current());return false}),(function(){try{o.dispose(r)}finally{o.dispose(n)}}))}))}else{var r=arguments;return new s((function(){var t;return new f((function(){t=s.make(e).concat(s.from(r).select(s.from)).select((function(e){return e.getEnumerator()})).toArray()}),(function(){while(t.length>0){var e=t[0];if(e.moveNext()){return this.yieldReturn(e.current())}else{e.dispose();t.splice(0,1)}}return this.yieldBreak()}),(function(){s.from(t).forEach(o.dispose)}))}))}};s.prototype.insert=function(e,t){var r=this;return new s((function(){var n;var i;var u=0;var a=false;return new f((function(){n=r.getEnumerator();i=s.from(t).getEnumerator()}),(function(){if(u==e&&i.moveNext()){a=true;return this.yieldReturn(i.current())}if(n.moveNext()){u++;return this.yieldReturn(n.current())}if(!a&&i.moveNext()){return this.yieldReturn(i.current())}return false}),(function(){try{o.dispose(n)}finally{o.dispose(i)}}))}))};s.prototype.alternate=function(e){var t=this;return new s((function(){var r;var n;var i;var u;return new f((function(){if(e instanceof Array||e.getEnumerator!=null){i=s.from(s.from(e).toArray())}else{i=s.make(e)}n=t.getEnumerator();if(n.moveNext())r=n.current()}),(function(){while(true){if(u!=null){if(u.moveNext()){return this.yieldReturn(u.current())}else{u=null}}if(r==null&&n.moveNext()){r=n.current();u=i.getEnumerator();continue}else if(r!=null){var e=r;r=null;return this.yieldReturn(e)}return this.yieldBreak()}}),(function(){try{o.dispose(n)}finally{o.dispose(u)}}))}))};s.prototype.contains=function(e,t){t=o.createLambda(t);var r=this.getEnumerator();try{while(r.moveNext()){if(t(r.current())===e)return true}return false}finally{o.dispose(r)}};s.prototype.defaultIfEmpty=function(e){var t=this;if(e===r)e=null;return new s((function(){var r;var n=true;return new f((function(){r=t.getEnumerator()}),(function(){if(r.moveNext()){n=false;return this.yieldReturn(r.current())}else if(n){n=false;return this.yieldReturn(e)}return false}),(function(){o.dispose(r)}))}))};s.prototype.distinct=function(e){return this.except(s.empty(),e)};s.prototype.distinctUntilChanged=function(e){e=o.createLambda(e);var t=this;return new s((function(){var r;var n;return new f((function(){r=t.getEnumerator()}),(function(){while(r.moveNext()){var t=e(r.current());if(n===t){continue}n=t;return this.yieldReturn(r.current())}return this.yieldBreak()}),(function(){o.dispose(r)}))}))};s.prototype.except=function(e,t){t=o.createLambda(t);var r=this;return new s((function(){var n;var i;return new f((function(){n=r.getEnumerator();i=new m(t);s.from(e).forEach((function(e){i.add(e)}))}),(function(){while(n.moveNext()){var e=n.current();if(!i.contains(e)){i.add(e);return this.yieldReturn(e)}}return false}),(function(){o.dispose(n)}))}))};s.prototype.intersect=function(e,t){t=o.createLambda(t);var r=this;return new s((function(){var n;var i;var u;return new f((function(){n=r.getEnumerator();i=new m(t);s.from(e).forEach((function(e){i.add(e)}));u=new m(t)}),(function(){while(n.moveNext()){var e=n.current();if(!u.contains(e)&&i.contains(e)){u.add(e);return this.yieldReturn(e)}}return false}),(function(){o.dispose(n)}))}))};s.prototype.sequenceEqual=function(e,t){t=o.createLambda(t);var r=this.getEnumerator();try{var n=s.from(e).getEnumerator();try{while(r.moveNext()){if(!n.moveNext()||t(r.current())!==t(n.current())){return false}}if(n.moveNext())return false;return true}finally{o.dispose(n)}}finally{o.dispose(r)}};s.prototype.union=function(e,t){t=o.createLambda(t);var n=this;return new s((function(){var i;var u;var a;return new f((function(){i=n.getEnumerator();a=new m(t)}),(function(){var t;if(u===r){while(i.moveNext()){t=i.current();if(!a.contains(t)){a.add(t);return this.yieldReturn(t)}}u=s.from(e).getEnumerator()}while(u.moveNext()){t=u.current();if(!a.contains(t)){a.add(t);return this.yieldReturn(t)}}return false}),(function(){try{o.dispose(i)}finally{o.dispose(u)}}))}))};s.prototype.orderBy=function(e){return new l(this,e,false)};s.prototype.orderByDescending=function(e){return new l(this,e,true)};s.prototype.reverse=function(){var e=this;return new s((function(){var t;var r;return new f((function(){t=e.toArray();r=t.length}),(function(){return r>0?this.yieldReturn(t[--r]):false}),n.Blank)}))};s.prototype.shuffle=function(){var e=this;return new s((function(){var t;return new f((function(){t=e.toArray()}),(function(){if(t.length>0){var e=Math.floor(Math.random()*t.length);return this.yieldReturn(t.splice(e,1)[0])}return false}),n.Blank)}))};s.prototype.weightedSample=function(e){e=o.createLambda(e);var t=this;return new s((function(){var r;var i=0;return new f((function(){r=t.choose((function(t){var r=e(t);if(r<=0)return null;i+=r;return{value:t,bound:i}})).toArray()}),(function(){if(r.length>0){var e=Math.floor(Math.random()*i)+1;var t=-1;var n=r.length;while(n-t>1){var u=Math.floor((t+n)/2);if(r[u].bound>=e){n=u}else{t=u}}return this.yieldReturn(r[n].value)}return this.yieldBreak()}),n.Blank)}))};s.prototype.groupBy=function(e,t,r,n){var i=this;e=o.createLambda(e);t=o.createLambda(t);if(r!=null)r=o.createLambda(r);n=o.createLambda(n);return new s((function(){var u;return new f((function(){u=i.toLookup(e,t,n).toEnumerable().getEnumerator()}),(function(){while(u.moveNext()){return r==null?this.yieldReturn(u.current()):this.yieldReturn(r(u.current().key(),u.current()))}return false}),(function(){o.dispose(u)}))}))};s.prototype.partitionBy=function(e,t,r,n){var i=this;e=o.createLambda(e);t=o.createLambda(t);n=o.createLambda(n);var u;if(r==null){u=false;r=function(e,t){return new g(e,t)}}else{u=true;r=o.createLambda(r)}return new s((function(){var a;var c;var l;var h=[];return new f((function(){a=i.getEnumerator();if(a.moveNext()){c=e(a.current());l=n(c);h.push(t(a.current()))}}),(function(){var i;while((i=a.moveNext())==true){if(l===n(e(a.current()))){h.push(t(a.current()))}else break}if(h.length>0){var o=u?r(c,s.from(h)):r(c,h);if(i){c=e(a.current());l=n(c);h=[t(a.current())]}else h=[];return this.yieldReturn(o)}return false}),(function(){o.dispose(a)}))}))};s.prototype.buffer=function(e){var t=this;return new s((function(){var r;return new f((function(){r=t.getEnumerator()}),(function(){var t=[];var n=0;while(r.moveNext()){t.push(r.current());if(++n>=e)return this.yieldReturn(t)}if(t.length>0)return this.yieldReturn(t);return false}),(function(){o.dispose(r)}))}))};s.prototype.aggregate=function(e,t,r){r=o.createLambda(r);return r(this.scan(e,t,r).last())};s.prototype.average=function(e){e=o.createLambda(e);var t=0;var r=0;this.forEach((function(n){t+=e(n);++r}));return t/r};s.prototype.count=function(e){e=e==null?n.True:o.createLambda(e);var t=0;this.forEach((function(r,n){if(e(r,n))++t}));return t};s.prototype.max=function(e){if(e==null)e=n.Identity;return this.select(e).aggregate((function(e,t){return e>t?e:t}))};s.prototype.min=function(e){if(e==null)e=n.Identity;return this.select(e).aggregate((function(e,t){return e<t?e:t}))};s.prototype.maxBy=function(e){e=o.createLambda(e);return this.aggregate((function(t,r){return e(t)>e(r)?t:r}))};s.prototype.minBy=function(e){e=o.createLambda(e);return this.aggregate((function(t,r){return e(t)<e(r)?t:r}))};s.prototype.sum=function(e){if(e==null)e=n.Identity;return this.select(e).aggregate(0,(function(e,t){return e+t}))};s.prototype.elementAt=function(e){var t;var r=false;this.forEach((function(n,i){if(i==e){t=n;r=true;return false}}));if(!r)throw new Error("index is less than 0 or greater than or equal to the number of elements in source.");return t};s.prototype.elementAtOrDefault=function(e,t){if(t===r)t=null;var n;var i=false;this.forEach((function(t,r){if(r==e){n=t;i=true;return false}}));return!i?t:n};s.prototype.first=function(e){if(e!=null)return this.where(e).first();var t;var r=false;this.forEach((function(e){t=e;r=true;return false}));if(!r)throw new Error("first:No element satisfies the condition.");return t};s.prototype.firstOrDefault=function(e,t){if(e!==r){if(typeof e===i.Function||typeof o.createLambda(e)===i.Function){return this.where(e).firstOrDefault(r,t)}t=e}var n;var u=false;this.forEach((function(e){n=e;u=true;return false}));return!u?t:n};s.prototype.last=function(e){if(e!=null)return this.where(e).last();var t;var r=false;this.forEach((function(e){r=true;t=e}));if(!r)throw new Error("last:No element satisfies the condition.");return t};s.prototype.lastOrDefault=function(e,t){if(e!==r){if(typeof e===i.Function||typeof o.createLambda(e)===i.Function){return this.where(e).lastOrDefault(r,t)}t=e}var n;var u=false;this.forEach((function(e){u=true;n=e}));return!u?t:n};s.prototype.single=function(e){if(e!=null)return this.where(e).single();var t;var r=false;this.forEach((function(e){if(!r){r=true;t=e}else throw new Error("single:sequence contains more than one element.")}));if(!r)throw new Error("single:No element satisfies the condition.");return t};s.prototype.singleOrDefault=function(e,t){if(t===r)t=null;if(e!=null)return this.where(e).singleOrDefault(null,t);var n;var i=false;this.forEach((function(e){if(!i){i=true;n=e}else throw new Error("single:sequence contains more than one element.")}));return!i?t:n};s.prototype.skip=function(e){var t=this;return new s((function(){var r;var n=0;return new f((function(){r=t.getEnumerator();while(n++<e&&r.moveNext()){}}),(function(){return r.moveNext()?this.yieldReturn(r.current()):false}),(function(){o.dispose(r)}))}))};s.prototype.skipWhile=function(e){e=o.createLambda(e);var t=this;return new s((function(){var r;var n=0;var i=false;return new f((function(){r=t.getEnumerator()}),(function(){while(!i){if(r.moveNext()){if(!e(r.current(),n++)){i=true;return this.yieldReturn(r.current())}continue}else return false}return r.moveNext()?this.yieldReturn(r.current()):false}),(function(){o.dispose(r)}))}))};s.prototype.take=function(e){var t=this;return new s((function(){var r;var n=0;return new f((function(){r=t.getEnumerator()}),(function(){return n++<e&&r.moveNext()?this.yieldReturn(r.current()):false}),(function(){o.dispose(r)}))}))};s.prototype.takeWhile=function(e){e=o.createLambda(e);var t=this;return new s((function(){var r;var n=0;return new f((function(){r=t.getEnumerator()}),(function(){return r.moveNext()&&e(r.current(),n++)?this.yieldReturn(r.current()):false}),(function(){o.dispose(r)}))}))};s.prototype.takeExceptLast=function(e){if(e==null)e=1;var t=this;return new s((function(){if(e<=0)return t.getEnumerator();var r;var n=[];return new f((function(){r=t.getEnumerator()}),(function(){while(r.moveNext()){if(n.length==e){n.push(r.current());return this.yieldReturn(n.shift())}n.push(r.current())}return false}),(function(){o.dispose(r)}))}))};s.prototype.takeFromLast=function(e){if(e<=0||e==null)return s.empty();var t=this;return new s((function(){var r;var n;var i=[];return new f((function(){r=t.getEnumerator()}),(function(){while(r.moveNext()){if(i.length==e)i.shift();i.push(r.current())}if(n==null){n=s.from(i).getEnumerator()}return n.moveNext()?this.yieldReturn(n.current()):false}),(function(){o.dispose(n)}))}))};s.prototype.indexOf=function(e){var t=null;if(typeof e===i.Function){this.forEach((function(r,n){if(e(r,n)){t=n;return false}}))}else{this.forEach((function(r,n){if(r===e){t=n;return false}}))}return t!==null?t:-1};s.prototype.lastIndexOf=function(e){var t=-1;if(typeof e===i.Function){this.forEach((function(r,n){if(e(r,n))t=n}))}else{this.forEach((function(r,n){if(r===e)t=n}))}return t};s.prototype.cast=function(){return this};s.prototype.asEnumerable=function(){return s.from(this)};s.prototype.toArray=function(){var e=[];this.forEach((function(t){e.push(t)}));return e};s.prototype.toLookup=function(e,t,n){e=o.createLambda(e);t=o.createLambda(t);n=o.createLambda(n);var i=new m(n);this.forEach((function(n){var u=e(n);var o=t(n);var a=i.get(u);if(a!==r)a.push(o);else i.add(u,[o])}));return new w(i)};s.prototype.toObject=function(e,t){e=o.createLambda(e);t=o.createLambda(t);var r={};this.forEach((function(n){r[e(n)]=t(n)}));return r};s.prototype.toDictionary=function(e,t,r){e=o.createLambda(e);t=o.createLambda(t);r=o.createLambda(r);var n=new m(r);this.forEach((function(r){n.add(e(r),t(r))}));return n};s.prototype.toJSONString=function(e,t){if(typeof JSON===i.Undefined||JSON.stringify==null){throw new Error("toJSONString can't find JSON.stringify. This works native JSON support Browser or include json2.js")}return JSON.stringify(this.toArray(),e,t)};s.prototype.toJoinedString=function(e,t){if(e==null)e="";if(t==null)t=n.Identity;return this.select(t).toArray().join(e)};s.prototype.doAction=function(e){var t=this;e=o.createLambda(e);return new s((function(){var r;var n=0;return new f((function(){r=t.getEnumerator()}),(function(){if(r.moveNext()){e(r.current(),n++);return this.yieldReturn(r.current())}return false}),(function(){o.dispose(r)}))}))};s.prototype.forEach=function(e){e=o.createLambda(e);var t=0;var r=this.getEnumerator();try{while(r.moveNext()){if(e(r.current(),t++)===false)break}}finally{o.dispose(r)}};s.prototype.write=function(e,t){if(e==null)e="";t=o.createLambda(t);var r=true;this.forEach((function(n){if(r)r=false;else document.write(e);document.write(t(n))}))};s.prototype.writeLine=function(e){e=o.createLambda(e);this.forEach((function(t){document.writeln(e(t)+"<br />")}))};s.prototype.force=function(){var e=this.getEnumerator();try{while(e.moveNext()){}}finally{o.dispose(e)}};s.prototype.letBind=function(e){e=o.createLambda(e);var t=this;return new s((function(){var r;return new f((function(){r=s.from(e(t)).getEnumerator()}),(function(){return r.moveNext()?this.yieldReturn(r.current()):false}),(function(){o.dispose(r)}))}))};s.prototype.share=function(){var e=this;var t;var r=false;return new p((function(){return new f((function(){if(t==null){t=e.getEnumerator()}}),(function(){if(r)throw new Error("enumerator is disposed");return t.moveNext()?this.yieldReturn(t.current()):false}),n.Blank)}),(function(){r=true;o.dispose(t)}))};s.prototype.memoize=function(){var e=this;var t;var r;var i=false;return new p((function(){var u=-1;return new f((function(){if(r==null){r=e.getEnumerator();t=[]}}),(function(){if(i)throw new Error("enumerator is disposed");u++;if(t.length<=u){return r.moveNext()?this.yieldReturn(t[u]=r.current()):false}return this.yieldReturn(t[u])}),n.Blank)}),(function(){i=true;o.dispose(r);t=null}))};if(o.hasNativeIteratorSupport()){s.prototype[Symbol.iterator]=function(){return{enumerator:this.getEnumerator(),next:function(){if(this.enumerator.moveNext()){return{done:false,value:this.enumerator.current()}}else{return{done:true}}}}}}s.prototype.catchError=function(e){e=o.createLambda(e);var t=this;return new s((function(){var r;return new f((function(){r=t.getEnumerator()}),(function(){try{return r.moveNext()?this.yieldReturn(r.current()):false}catch(t){e(t);return false}}),(function(){o.dispose(r)}))}))};s.prototype.finallyAction=function(e){e=o.createLambda(e);var t=this;return new s((function(){var r;return new f((function(){r=t.getEnumerator()}),(function(){return r.moveNext()?this.yieldReturn(r.current()):false}),(function(){try{o.dispose(r)}finally{e()}}))}))};s.prototype.log=function(e){e=o.createLambda(e);return this.doAction((function(t){if(typeof console!==i.Undefined){console.log(e(t))}}))};s.prototype.trace=function(e,t){if(e==null)e="Trace";t=o.createLambda(t);return this.doAction((function(r){if(typeof console!==i.Undefined){console.log(e,t(r))}}))};var l=function(e,t,r,n){this.source=e;this.keySelector=o.createLambda(t);this.descending=r;this.parent=n};l.prototype=new s;l.prototype.createOrderedEnumerable=function(e,t){return new l(this.source,e,t,this)};l.prototype.thenBy=function(e){return this.createOrderedEnumerable(e,false)};l.prototype.thenByDescending=function(e){return this.createOrderedEnumerable(e,true)};l.prototype.getEnumerator=function(){var e=this;var t;var r;var i=0;return new f((function(){t=[];r=[];e.source.forEach((function(e,n){t.push(e);r.push(n)}));var n=h.create(e,null);n.GenerateKeys(t);r.sort((function(e,t){return n.compare(e,t)}))}),(function(){return i<r.length?this.yieldReturn(t[r[i++]]):false}),n.Blank)};var h=function(e,t,r){this.keySelector=e;this.descending=t;this.child=r;this.keys=null};h.create=function(e,t){var r=new h(e.keySelector,e.descending,t);if(e.parent!=null)return h.create(e.parent,r);return r};h.prototype.GenerateKeys=function(e){var t=e.length;var r=this.keySelector;var n=new Array(t);for(var i=0;i<t;i++)n[i]=r(e[i]);this.keys=n;if(this.child!=null)this.child.GenerateKeys(e)};h.prototype.compare=function(e,t){var r=o.compare(this.keys[e],this.keys[t]);if(r==0){if(this.child!=null)return this.child.compare(e,t);return o.compare(e,t)}return this.descending?-r:r};var p=function(e,t){this.dispose=t;s.call(this,e)};p.prototype=new s;var v=function(e){this.getSource=function(){return e}};v.prototype=new s;v.prototype.any=function(e){return e==null?this.getSource().length>0:s.prototype.any.apply(this,arguments)};v.prototype.count=function(e){return e==null?this.getSource().length:s.prototype.count.apply(this,arguments)};v.prototype.elementAt=function(e){var t=this.getSource();return 0<=e&&e<t.length?t[e]:s.prototype.elementAt.apply(this,arguments)};v.prototype.elementAtOrDefault=function(e,t){if(t===r)t=null;var n=this.getSource();return 0<=e&&e<n.length?n[e]:t};v.prototype.first=function(e){var t=this.getSource();return e==null&&t.length>0?t[0]:s.prototype.first.apply(this,arguments)};v.prototype.firstOrDefault=function(e,t){if(e!==r){return s.prototype.firstOrDefault.apply(this,arguments)}t=e;var n=this.getSource();return n.length>0?n[0]:t};v.prototype.last=function(e){var t=this.getSource();return e==null&&t.length>0?t[t.length-1]:s.prototype.last.apply(this,arguments)};v.prototype.lastOrDefault=function(e,t){if(e!==r){return s.prototype.lastOrDefault.apply(this,arguments)}t=e;var n=this.getSource();return n.length>0?n[n.length-1]:t};v.prototype.skip=function(e){var t=this.getSource();return new s((function(){var r;return new f((function(){r=e<0?0:e}),(function(){return r<t.length?this.yieldReturn(t[r++]):false}),n.Blank)}))};v.prototype.takeExceptLast=function(e){if(e==null)e=1;return this.take(this.getSource().length-e)};v.prototype.takeFromLast=function(e){return this.skip(this.getSource().length-e)};v.prototype.reverse=function(){var e=this.getSource();return new s((function(){var t;return new f((function(){t=e.length}),(function(){return t>0?this.yieldReturn(e[--t]):false}),n.Blank)}))};v.prototype.sequenceEqual=function(e,t){if((e instanceof v||e instanceof Array)&&t==null&&s.from(e).count()!=this.count()){return false}return s.prototype.sequenceEqual.apply(this,arguments)};v.prototype.toJoinedString=function(e,t){var r=this.getSource();if(t!=null||!(r instanceof Array)){return s.prototype.toJoinedString.apply(this,arguments)}if(e==null)e="";return r.join(e)};v.prototype.getEnumerator=function(){var e=this.getSource();var t=-1;return{current:function(){return e[t]},moveNext:function(){return++t<e.length},dispose:n.Blank}};var y=function(e,t){this.prevSource=e;this.prevPredicate=t};y.prototype=new s;y.prototype.where=function(e){e=o.createLambda(e);if(e.length<=1){var t=this.prevPredicate;var r=function(r){return t(r)&&e(r)};return new y(this.prevSource,r)}else{return s.prototype.where.call(this,e)}};y.prototype.select=function(e){e=o.createLambda(e);return e.length<=1?new d(this.prevSource,this.prevPredicate,e):s.prototype.select.call(this,e)};y.prototype.getEnumerator=function(){var e=this.prevPredicate;var t=this.prevSource;var r;return new f((function(){r=t.getEnumerator()}),(function(){while(r.moveNext()){if(e(r.current())){return this.yieldReturn(r.current())}}return false}),(function(){o.dispose(r)}))};var d=function(e,t,r){this.prevSource=e;this.prevPredicate=t;this.prevSelector=r};d.prototype=new s;d.prototype.where=function(e){e=o.createLambda(e);return e.length<=1?new y(this,e):s.prototype.where.call(this,e)};d.prototype.select=function(e){e=o.createLambda(e);if(e.length<=1){var t=this.prevSelector;var r=function(r){return e(t(r))};return new d(this.prevSource,this.prevPredicate,r)}else{return s.prototype.select.call(this,e)}};d.prototype.getEnumerator=function(){var e=this.prevPredicate;var t=this.prevSelector;var r=this.prevSource;var n;return new f((function(){n=r.getEnumerator()}),(function(){while(n.moveNext()){if(e==null||e(n.current())){return this.yieldReturn(t(n.current()))}}return false}),(function(){o.dispose(n)}))};var m=function(){var e=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var t=function(e){if(e===null)return"null";if(e===r)return"undefined";return typeof e.toString===i.Function?e.toString():Object.prototype.toString.call(e)};var u=function(e,t){this.key=e;this.value=t;this.prev=null;this.next=null};var o=function(){this.first=null;this.last=null};o.prototype={addLast:function(e){if(this.last!=null){this.last.next=e;e.prev=this.last;this.last=e}else this.first=this.last=e},replace:function(e,t){if(e.prev!=null){e.prev.next=t;t.prev=e.prev}else this.first=t;if(e.next!=null){e.next.prev=t;t.next=e.next}else this.last=t},remove:function(e){if(e.prev!=null)e.prev.next=e.next;else this.first=e.next;if(e.next!=null)e.next.prev=e.prev;else this.last=e.prev}};var a=function(e){this.countField=0;this.entryList=new o;this.buckets={};this.compareSelector=e==null?n.Identity:e};a.prototype={add:function(r,n){var i=this.compareSelector(r);var o=t(i);var a=new u(r,n);if(e(this.buckets,o)){var f=this.buckets[o];for(var c=0;c<f.length;c++){if(this.compareSelector(f[c].key)===i){this.entryList.replace(f[c],a);f[c]=a;return}}f.push(a)}else{this.buckets[o]=[a]}this.countField++;this.entryList.addLast(a)},get:function(n){var i=this.compareSelector(n);var u=t(i);if(!e(this.buckets,u))return r;var o=this.buckets[u];for(var a=0;a<o.length;a++){var f=o[a];if(this.compareSelector(f.key)===i)return f.value}return r},set:function(r,n){var i=this.compareSelector(r);var o=t(i);if(e(this.buckets,o)){var a=this.buckets[o];for(var f=0;f<a.length;f++){if(this.compareSelector(a[f].key)===i){var c=new u(r,n);this.entryList.replace(a[f],c);a[f]=c;return true}}}return false},contains:function(r){var n=this.compareSelector(r);var i=t(n);if(!e(this.buckets,i))return false;var u=this.buckets[i];for(var o=0;o<u.length;o++){if(this.compareSelector(u[o].key)===n)return true}return false},clear:function(){this.countField=0;this.buckets={};this.entryList=new o},remove:function(r){var n=this.compareSelector(r);var i=t(n);if(!e(this.buckets,i))return;var u=this.buckets[i];for(var o=0;o<u.length;o++){if(this.compareSelector(u[o].key)===n){this.entryList.remove(u[o]);u.splice(o,1);if(u.length==0)delete this.buckets[i];this.countField--;return}}},count:function(){return this.countField},toEnumerable:function(){var e=this;return new s((function(){var t;return new f((function(){t=e.entryList.first}),(function(){if(t!=null){var e={key:t.key,value:t.value};t=t.next;return this.yieldReturn(e)}return false}),n.Blank)}))}};return a}();var w=function(e){this.count=function(){return e.count()};this.get=function(t){return s.from(e.get(t))};this.contains=function(t){return e.contains(t)};this.toEnumerable=function(){return e.toEnumerable().select((function(e){return new g(e.key,e.value)}))}};var g=function(e,t){this.key=function(){return e};v.call(this,t)};g.prototype=new v;if(typeof r===i.Function&&r.amd){r("linqjs",[],(function(){return s}))}else if("object"!==i.Undefined&&e.exports){e.exports=s}else{t.Enumerable=s}})(t)}));e("E",n);function i(e){return e?typeof e==="string"?JSON.parse(e):e:[]}}}}));