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