ix
Version:
The Interactive Extensions for JavaScript
45 lines (43 loc) • 22.7 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory(global.Ix = global.Ix || {}));
}(this, (function (exports) {function h(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}var k="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};
function aa(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");}var l=aa(this);function p(a,b){if(b)a:{var c=l;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];if(!(e in c))break a;c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&k(c,a,{configurable:!0,writable:!0,value:b})}}
p("Symbol",function(a){function b(f){if(this instanceof b)throw new TypeError("Symbol is not a constructor");return new c(d+(f||"")+"_"+e++,f)}function c(f,g){this.T=f;k(this,"description",{configurable:!0,writable:!0,value:g})}if(a)return a;c.prototype.toString=function(){return this.T};var d="jscomp_symbol_"+(1E9*Math.random()>>>0)+"_",e=0;return b});
p("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),c=0;c<b.length;c++){var d=l[b[c]];"function"===typeof d&&"function"!=typeof d.prototype[a]&&k(d.prototype,a,{configurable:!0,writable:!0,value:function(){return ba(h(this))}})}return a});p("Symbol.asyncIterator",function(a){return a?a:Symbol("Symbol.asyncIterator")});
function ba(a){a={next:a};a[Symbol.iterator]=function(){return this};return a}function r(a){function b(d){return a.next(d)}function c(d){return a.throw(d)}return new Promise(function(d,e){function f(g){g.done?d(g.value):Promise.resolve(g.value).then(b,c).then(f,e)}f(a.next())})}
function t(a){var b=a[Symbol.asyncIterator];if(void 0!==b)a=b.call(a);else{b=ca;var c="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];if(c)a=c.call(a);else if("number"==typeof a.length)a={next:h(a)};else throw Error(String(a)+" is not an iterable or ArrayLike");a=new b(a)}return a}
function ca(a){this[Symbol.asyncIterator]=function(){return this};this[Symbol.iterator]=function(){return a};this.next=function(b){return Promise.resolve(a.next(b))};void 0!==a["throw"]&&(this["throw"]=function(b){return Promise.resolve(a["throw"](b))});void 0!==a["return"]&&(this["return"]=function(b){return Promise.resolve(a["return"](b))})}function u(a,b){this.action=a;this.value=b}function da(a,b,c,d){this.method=a;this.u=b;this.resolve=c;this.reject=d}
function ea(a){this.frame=a;this.next=null}function v(){this.H=this.m=null}v.prototype.isEmpty=function(){return null===this.m};v.prototype.first=function(){if(this.m)return this.m.frame;throw Error("no frames in executionQueue");};function w(a){a.m&&(a.m=a.m.next,a.m||(a.H=null))}v.prototype.enqueue=function(a){a=new ea(a);this.H?this.H.next=a:this.m=a;this.H=a};
function x(a){this.S=a;this.i=null;this.h=new v;this[Symbol.asyncIterator]=function(){return this};var b=this;this.ba=function(c){var d=b.h.first();!0===c.done?(b.i=null,d.method="next",d.u=c.value):(d.resolve({value:c.value,done:!1}),w(b.h));y(b)};this.aa=function(c){z(b,c)};this.M=function(c){B(b,c)}}function C(a,b,c){return new Promise(function(d,e){var f=a.h.isEmpty();a.h.enqueue(new da(b,c,d,e));f&&y(a)})}x.prototype.next=function(a){return C(this,"next",a)};
x.prototype.return=function(a){return C(this,"return",new u(0,a))};x.prototype.throw=function(a){return C(this,"throw",a)};function y(a){if(!a.h.isEmpty())try{if(a.i){if(!a.i)throw Error("no delegate to perform execution");var b=a.h.first();if(b.method in a.i)try{a.i[b.method](b.u).then(a.ba,a.aa).catch(a.M)}catch(c){z(a,c)}else a.i=null,y(a)}else fa(a)}catch(c){B(a,c)}}
function fa(a){var b=a.h.first();try{var c=a.S[b.method](b.u);if(c.value instanceof u)switch(c.value.action){case 0:Promise.resolve(c.value.value).then(function(d){b.resolve({value:d,done:c.done});w(a.h);y(a)},function(d){b.reject(d);w(a.h);y(a)}).catch(a.M);break;case 1:a.i=t(c.value.value);b.method="next";b.u=void 0;y(a);break;case 2:Promise.resolve(c.value.value).then(function(d){b.method="next";b.u=d;y(a)},function(d){b.method="throw";b.u=d;y(a)}).catch(a.M);break;default:throw Error("Unrecognized AsyncGeneratorWrapper$ActionEnum");
}else b.resolve(c),w(a.h),y(a)}catch(d){b.reject(d),w(a.h),y(a)}}function z(a,b){var c=a.h.first();a.i=null;c.method="throw";c.u=b;y(a)}function B(a,b){a.h.isEmpty()||(a.h.first().reject(b),w(a.h));a.i&&"return"in a.i&&(a.i["return"](void 0),a.i=null);a.S["return"](void 0);y(a)}function D(a){return a}function F(a){return r(function*(){return a}())};function G(a,b){return"undefined"===typeof b?a:function(c,d){return a.call(b,c,d)}};const H=a=>"function"===typeof a,I=a=>null!=a&&Object(a)===a;function J(a){return I(a)&&"number"===typeof a.length}function K(a){return null!=a&&H(a[Symbol.iterator])}function L(a){return I(a)&&!H(a[Symbol.iterator])&&H(a.next)}function ha(a){return null!=a&&Object(a)===a&&"function"===typeof a.subscribe}const ia=a=>I(a)&&H(a.pipe)&&H(a._read)&&"boolean"===typeof a.readable&&I(a._readableState),ja=a=>I(a)&&H(a.end)&&H(a._write)&&"boolean"===typeof a.writable&&I(a._writableState);function ka(a){a=Number(a);return isNaN(a)?0:0!==a&&isFinite(a)?(0<a?1:-1)*Math.floor(Math.abs(a)):a};const la=Math.pow(2,53)-1;class M{forEach(a,b){a=G(a,b);b=0;for(const c of this)a(c,b++)}pipe(...a){let b=-1;const c=a.length;let d=this;for(;++b<c;)d=a[b](M.as(d));return d}static as(a){return a instanceof M?a:"string"===typeof a?new N([a],D):K(a)||J(a)?new N(a,D):new N([a],D)}static from(a,b=D,c){b=G(b,c);if(K(a)||J(a))return new N(a,b);if(L(a))return new N({[Symbol.iterator]:()=>a},b);throw new TypeError("Input type not supported");}}M.prototype[Symbol.toStringTag]="IterableX";
Object.defineProperty(M,Symbol.hasInstance,{writable:!0,configurable:!0,value(a){return!(!a||"IterableX"!==a[Symbol.toStringTag])}});class N extends M{constructor(a,b){super();this.g=a;this.v=b}*[Symbol.iterator](){let a=0;if(K(this.g))for(var b of this.g)yield this.v(b,a++);else for(b=Math.min(Math.max(ka(this.g.length),0),la);a<b;)yield this.v(this.g[a],a++)}}
try{(a=>{if(!a){M.prototype.pipe=function(...c){let d=-1;const e=c.length;let f=this,g;for(;++d<e;)if(g=c[d],"function"===typeof g)f=g(M.as(f));else if(ja(g))return{end:c=!0}=c[d+1]||{},ia(f)?f.pipe(g,{end:c}):M.as(f).ea(b(g)).pipe(g,{end:c});return f};var b=(c,d=c.$||{da:!0})=>d}})("object"===typeof window&&"object"===typeof document&&9===document.nodeType)}catch(a){}const ma=M.as,na=M.from;function O(a){"function"===typeof(null==a?void 0:a.return)&&a.return()};class oa extends M{constructor(a){super();this.g=a}*[Symbol.iterator](){let a=null,b=!1;for(const c of this.g){const d=c[Symbol.iterator]();a=null;for(b=!1;;){let e={};try{const {done:f,value:g}=d.next();if(f){O(d);break}e=g}catch(f){a=f;b=!0;O(d);break}yield e}if(!b)break}if(b)throw a;}};class pa extends M{constructor(a){super();this.g=a}*[Symbol.iterator](){for(const a of this.g)yield*a}};class qa extends M{constructor(a){super();this.v=a}[Symbol.iterator](){return this.v()}};class ra extends M{constructor(a){super();this.v=a}*[Symbol.iterator](){for(const a of this.v())yield a}}function sa(a){return new ra(a)};class ta extends M{*[Symbol.iterator](){}}function ua(){return new ta};class va extends M{constructor(a,b,c,d){super();this.V=a;this.J=b;this.W=c;this.Y=d}*[Symbol.iterator](){for(let a=this.V;this.J(a);a=this.W(a))yield this.Y(a)}};function wa(a,b){return a===b||"number"===typeof a&&"number"===typeof b&&isNaN(a)&&isNaN(b)}function P(a,b){return a>b?1:a<b?-1:0};function xa(a,b,c){let d=[];a=a[Symbol.iterator]();const {value:e,done:f}=a.next();if(f)throw Error("Sequence contains no elements");let g=b(e);d.push(e);for(var m;!(m=a.next()).done;){m=m.value;const n=b(m),q=c(n,g);0===q?d.push(m):0<q&&(d=[m],g=n)}return d};function ya(...a){return new za(a)}class za extends M{constructor(a){super();this.U=a}*[Symbol.iterator](){yield*this.U}};class Aa extends M{constructor(a){super();this.g=a}*[Symbol.iterator](){for(const a of this.g){const b=a[Symbol.iterator]();for(;;){let c;try{c=b.next()}catch(d){break}if(c.done)break;yield c.value}}}};class Ba extends M{constructor(a,b){super();this.P=a;this.o=b}*[Symbol.iterator](){for(let a=this.P,b=this.P+this.o;a<b;a++)yield a}};function Ca(a){const b=[];for(const c of a)b.push(c);return b};class Da extends M{constructor(a,b){super();this.g=a;this.o=b}*[Symbol.iterator](){if(-1===this.o)for(;;)for(var a of this.g)yield a;else for(a=0;a<this.o;a++)for(const b of this.g)yield b}};class Ea extends M{constructor(a){super();this.s=a}*[Symbol.iterator](){throw this.s;}};class Q extends Error{constructor(a="The operation has been aborted"){super(a);Object.setPrototypeOf(this,Q.prototype);Error.captureStackTrace(this,this.constructor);this.name="AbortError"}get [Symbol.toStringTag](){return"AbortError"}}function R(a){if(a&&a.aborted)throw new Q;}Object.defineProperty(Q,Symbol.hasInstance,{writable:!0,configurable:!0,value(a){return I(a)&&("AbortError"===a.constructor.name||"AbortError"===a[Symbol.toStringTag])}});class S{forEach(a,b,c){const d=this;return r(function*(){const e=c?new Fa(d,c):d;let f=0;var g;try{for(var m=t(e);;){var n=yield m.next();if(n.done)break;yield a.call(b,n.value,f++,c)}}catch(A){var q={error:A}}finally{try{n&&!n.done&&(g=m.return)&&(yield g.call(m))}finally{if(q)throw q.error;}}}())}pipe(...a){let b=-1;const c=a.length;let d=this;for(;++b<c;)d=a[b](S.as(d));return d}static from(a,b=F,c){b=G(b,c);if(K(a)||I(a)&&H(a[Symbol.asyncIterator]))return new T(a,b);if(I(a)&&H(a.then))return new Ga(a,
b);if(ha(a))return new Ha(a,b);if(J(a))return new U(a,b);if(L(a))return new T({[Symbol.asyncIterator]:()=>a},b);throw new TypeError("Input type not supported");}static as(a){return a instanceof S?a:"string"===typeof a?new U([a],F):K(a)||I(a)&&H(a[Symbol.asyncIterator])?new T(a,F):I(a)&&H(a.then)?new Ga(a,F):ha(a)?new Ha(a,F):J(a)?new U(a,F):new U([a],F)}}S.prototype[Symbol.toStringTag]="AsyncIterableX";
Object.defineProperty(S,Symbol.hasInstance,{writable:!0,configurable:!0,value(a){return!(!a||"AsyncIterableX"!==a[Symbol.toStringTag])}});function Ia(a,b){if(a.K)throw Error("AsyncSink already ended");if(0<a.C.length){const {resolve:c,reject:d}=a.C.shift();"error"===b.type?d(b.error):c({done:!1,value:b.value})}else a.L.push(b)}
class Ja{constructor(){this.K=!1;this.L=[];this.C=[]}[Symbol.asyncIterator](){return this}write(a){Ia(this,{type:"value",value:a})}error(a){Ia(this,{type:"error",error:a})}next(){if(0<this.L.length){const {type:a,value:b,error:c}=this.L.shift();return"error"===a?Promise.reject(c):Promise.resolve({done:!1,value:b})}return this.K?Promise.resolve({done:!0}):new Promise((a,b)=>{this.C.push({resolve:a,reject:b})})}end(){for(;0<this.C.length;)this.C.shift().resolve({done:!0});this.K=!0}}
class U extends S{constructor(a,b){super();this.g=a;this.l=b}[Symbol.asyncIterator](){const a=this;return new x(function*(){let b=0;const c=Math.min(Math.max(ka(a.g.length),0),la);for(;b<c;)yield new u(0,yield new u(2,a.l(a.g[b],b++)))}())}}
class T extends S{constructor(a,b){super();this.g=a;this.l=b}[Symbol.asyncIterator](a){const b=this;return new x(function*(){let c=0;if(a&&b.g instanceof S){var d;try{for(var e=t(new Fa(b.g,a));;){var f=yield new u(2,e.next());if(f.done)break;yield new u(0,yield new u(2,b.l(f.value,c++)))}}catch(E){var g={error:E}}finally{try{f&&!f.done&&(d=e.return)&&(yield new u(2,d.call(e)))}finally{if(g)throw g.error;}}}else{R(a);var m;try{for(var n=t(b.g);;){var q=yield new u(2,n.next());if(q.done)break;const E=
q.value;R(a);const Ta=yield new u(2,b.l(E,c++));R(a);yield new u(0,Ta)}}catch(E){var A={error:E}}finally{try{q&&!q.done&&(m=n.return)&&(yield new u(2,m.call(n)))}finally{if(A)throw A.error;}}}}())}}class Ga extends S{constructor(a,b){super();this.g=a;this.l=b}[Symbol.asyncIterator](){const a=this;return new x(function*(){const b=yield new u(2,a.g);yield new u(0,yield new u(2,a.l(b,0)))}())}}
class Ha extends S{constructor(a,b){super();this.X=a;this.l=b}[Symbol.asyncIterator](a){const b=this;return new x(function*(){function c(){d.error(new Q)}R(a);const d=new Ja,e=b.X.subscribe({next(g){d.write(g)},error(g){d.error(g)},complete(){d.end()}});a&&a.addEventListener("abort",c);let f=0;try{for(let g;!(g=yield new u(2,d.next())).done;)R(a),yield new u(0,yield new u(2,b.l(g.value,f++)))}finally{a&&a.removeEventListener("abort",c),e.unsubscribe()}}())}}
class Fa{constructor(a,b){this.g=a;this.Z=b}[Symbol.asyncIterator](){return this.g[Symbol.asyncIterator](this.Z)}}try{(a=>{if(!a){S.prototype.pipe=function(...c){let d=-1;const e=c.length;let f=this,g;for(;++d<e;)if(g=c[d],"function"===typeof g)f=g(S.as(f));else if(ja(g))return{end:c=!0}=c[d+1]||{},ia(f)?f.pipe(g,{end:c}):S.as(f).ea(b(g)).pipe(g,{end:c});return f};var b=(c,d=c.$||{da:!0})=>d}})("object"===typeof window&&"object"===typeof document&&9===document.nodeType)}catch(a){};class Ka{constructor(){this.F=this.o=0;this.B=new Map}clear(){this.B.clear()}get count(){return this.o}get N(){return this.F}set N(a){this.F=a}done(){this.F--}get(a){if(!this.B.has(a))throw Error("Element no longer available in the buffer.");const b=this.B.get(a),c=b.value;0===--b.count&&this.B.delete(a);return c}push(a){this.B.set(this.o++,{value:a,count:this.F})}};class La extends M{constructor(a){super();this.A=!1;this.g=a;this.j=new Ka}*D(a){try{for(;;){let b=!1,c={};if(a>=this.j.count){if(!this.A)try{const d=this.g.next();if(b=!d.done)c=d.value}catch(d){this.s=d,this.A=!0}if(this.A){if(this.s)throw this.s;break}b&&this.j.push(c)}else b=!0;if(b)yield this.j.get(a);else break;a++}}finally{this.j.done()}}[Symbol.iterator](){this.j.N++;return this.D(this.j.count)[Symbol.iterator]()}}function Ma(){return function(a){return new La(a[Symbol.iterator]())}};class Na extends S{constructor(a){var b=new Ka;super();this.G=this.s=null;this.A=!1;this.g=a;this.j=b}[Symbol.asyncIterator](a){R(a);return this.D(0)}D(a=0){const b=this;return new x(function*(){let c=a-1,d=!1;const e=b.j;try{do if(++c<e.count)yield new u(0,e.get(c));else{if(b.A)throw b.s;null===b.G&&(b.G=b.g.next().then(f=>{b.G=null;f.done||e.push(f.value);return f}));({done:d}=yield new u(2,b.G.catch(f=>{b.s=f;b.A=!0;throw f;})));d||(yield new u(0,e.get(c)))}while(!d)}finally{e.done()}}())}};class Oa extends Na{[Symbol.asyncIterator](a){R(a);this.j.N++;return this.D(this.j.count)[Symbol.asyncIterator]()}}function Pa(){return function(a){return new Oa(a[Symbol.asyncIterator]())}};const Qa="undefined"!==typeof SharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;class Ra extends S{constructor(a){super();this.R=a}[Symbol.asyncIterator](){const a=this.R,b=a.getReader();return Sa(a,b,Ua(b))}}class Va extends Ra{[Symbol.asyncIterator](){var a=this.R;let b;try{b=a.getReader({mode:"byob"})}catch(c){return super[Symbol.asyncIterator]()}a=Sa(a,b,Wa(b));a.next();return a}}
function Sa(a,b,c){return new x(function*(){let d=!1;try{yield new u(1,c)}catch(e){if(d=!0,b)yield new u(2,b.cancel(e))}finally{if(b&&(d||(yield new u(2,b.cancel())),a.locked))try{b.closed.catch(()=>{}),b.releaseLock()}catch(e){}}}())}function Ua(a){return new x(function*(){let b;for(;!(b=yield new u(2,a.read())).done;)yield new u(0,b.value)}())}function Wa(a){return new x(function*(){var b;for(b=yield new u(0,null);!(b=yield new u(2,Xa(a,b))).done;)b=yield new u(0,b.value)}())}
function Xa(a,b){return r(function*(){let c,d;if("number"===typeof b)d=new ArrayBuffer(c=b);else if(b instanceof ArrayBuffer)c=(d=b).byteLength;else if(b instanceof Qa)c=(d=b).byteLength;else return{done:!0,value:void 0};return yield Ya(a,d,0,c)}())}
function Ya(a,b,c,d){return r(function*(){let e=c;if(e>=d)return{done:!1,value:new Uint8Array(b,0,d)};const {done:f,value:g}=yield a.read(new Uint8Array(b,e,d-e));return(e+=g.byteLength)<d&&!f?yield Ya(a,g.buffer,e,d):{done:f,value:new Uint8Array(g.buffer,0,e)}}())}function Za(a,b){return b&&"byob"===b.mode?new Va(a):new Ra(a)};function $a(a,b,c=0,d=b.byteLength){const e=a.byteLength;a=new Uint8Array(a.buffer,a.byteOffset,e);b=new Uint8Array(b.buffer,b.byteOffset,Math.min(d,e,b.buffer.byteLength-b.byteOffset));a.set(b,c);return b.byteLength}class ab{constructor(a){this.g=a}cancel(){const a=this;return r(function*(){const b=a.g;b&&b.return&&(yield b.return());a.g=null}())}}
class bb extends ab{pull(a){const b=this;return r(function*(){var c=b.g;if(c&&(c=yield c.next(a.desiredSize),!c.done))return a.enqueue(c.value);a.close()}())}}
class cb extends ab{constructor(a,b={}){super(a);this.type="bytes";this.autoAllocateChunkSize=b.autoAllocateChunkSize;this.ca=new bb(a)}pull(a){const b=this;return r(function*(){if(!a.byobRequest)return yield b.ca.pull(a);if(b.g){const c=a.byobRequest.view,{done:d,value:e}=yield b.g.next(c);if(!d){if("number"===typeof e)return a.byobRequest.respond(e);if(ArrayBuffer.isView(e))return e.buffer===c.buffer?a.byobRequest.respondWithNewView(e):a.byobRequest.respond($a(c,e))}}a.close()}())}}
const db=(()=>{let a,b,c=(e,f)=>{class g extends ReadableStream{[Symbol.asyncIterator](){return Za(this)[Symbol.asyncIterator]()}}class m extends ReadableStream{[Symbol.asyncIterator](){return Za(this,{mode:"byob"})[Symbol.asyncIterator]()}}a=m;b=g;c=d;return d(e,f)};const d=(e,f)=>e instanceof cb?new a(e,f):new b(e,f);return(e,f)=>c(e,f)})();function V(a,b){return b&&"type"in b&&"bytes"===b.type?db(new cb(a[Symbol.asyncIterator](),b),b):db(new bb(a[Symbol.asyncIterator]()),b)}S.prototype.tee=function(){return W(this).tee()};
S.prototype.pipeTo=function(a,b){return W(this).pipeTo(a,b)};S.prototype.pipeThrough=function(a,b){return W(this).pipeThrough(a,b)};function W(a){return a.I||(a.I=a.pipe(Pa(),V))}S.prototype.toDOMStream=function(a){return a?V(this,a):V(this)};function X(a,b){return V(S.as(a),b)}M.prototype.tee=function(){return Y(this).tee()};M.prototype.pipeTo=function(a,b){return Y(this).pipeTo(a,b)};M.prototype.pipeThrough=function(a,b){return Y(this).pipeThrough(a,b)};function Y(a){return a.I||(a.I=a.pipe(Ma(),X))}M.prototype.toDOMStream=function(a){return a?X(this,a):X(this)};class eb extends M{constructor(a,b){super();this.J=a;this.g=b}*[Symbol.iterator](){for(;this.J();)yield*this.g}};class fb extends M{constructor(a){super();this.O=a}*[Symbol.iterator](){const a=this.O.length,b=this.O.map(c=>c[Symbol.iterator]());for(;0<a;){const c=Array(a);for(let d=-1;++d<a;){const e=b[d].next();if(e.done){b.forEach(O);return}c[d]=e.value}yield c}}};var Z={};Z.IterableX=M;Z.as=ma;Z.average=function(a,b){const {selector:c=D,thisArg:d}=b||{};let e=b=0;for(const f of a)b+=c.call(d,f),e++;if(0===e)throw Error("Empty collection");return b/e};Z.catchAll=function(a){return new oa(a)};Z.catchError=function(...a){return new oa(a)};Z.concat=function(...a){return new pa(a)};Z.count=function(a,b){const {thisArg:c,predicate:d=()=>!0}=b||{};b=0;for(const e of a)d.call(c,e,b)&&b++;return b};Z.create=function(a){return new qa(a)};Z.defer=sa;
Z.elementAt=function(a,b){for(const c of a){if(0===b)return c;b--}};Z.empty=ua;Z.every=function(a,b){const {thisArg:c,predicate:d}=b;b=0;for(const e of a)if(!d.call(c,e,b++))return!1;return!0};Z.find=function(a,b){const {thisArg:c,predicate:d}=b;b=0;for(const e of a)if(d.call(c,e,b++))return e};Z.findIndex=function(a,b){const {thisArg:c,predicate:d}=b;b=0;for(const e of a)if(d.call(c,e,b++))return b;return-1};
Z.first=function(a,b){const {thisArg:c,predicate:d=()=>!0}=b||{};b=0;for(const e of a)if(d.call(c,e,b++))return e};Z.from=na;Z.generate=function(a,b,c,d){return new va(a,b,c,d)};Z.iif=function(a,b,c=ua()){return sa(()=>a()?b:c)};Z.includes=function(a,b,c=0){let d=0;Math.abs(c)&&(c=0);for(const e of a)if(d++>c&&wa(e,b))return!0;return!1};Z.isEmpty=function(a){for(const b of a)return!1;return!0};
Z.last=function(a,b){const {thisArg:c,predicate:d=()=>!0}=b||{};b=0;let e;for(const f of a)d.call(c,f,b++)&&(e=f);return e};Z.max=function(a,b){const {comparer:c=P,selector:d=D}=b||{};a=a[Symbol.iterator]();var e=a.next();if(e.done)throw Error("Sequence contains no elements");for(b=d(e.value);!(e=a.next()).done;)e=d(e.value),0<c(e,b)&&(b=e);return b};Z.maxBy=function(a,b){const {comparer:c=P,selector:d}=b||{};return xa(a,d,c)};
Z.min=function(a,b){const {comparer:c=P,selector:d=D}=b||{};a=a[Symbol.iterator]();var e=a.next();if(e.done)throw Error("Sequence contains no elements");for(b=d(e.value);!(e=a.next()).done;)e=d(e.value),0>c(e,b)&&(b=e);return b};Z.minBy=function(a,b){const {comparer:c=P,selector:d}=b||{};return xa(a,d,(e,f)=>-c(e,f))};Z.of=ya;Z.onErrorResumeNext=function(...a){return new Aa(a)};Z.range=function(a,b){return new Ba(a,b)};
Z.reduce=function(a,b,c){var d="function"===typeof b?2<arguments.length?{callback:b,seed:c}:{callback:b}:b;const {seed:e,callback:f}=d;d=d.hasOwnProperty("seed");let g=0,m=!1,n=e;for(const q of a)m||(m=d)?n=f(n,q,g++):(n=q,m=!0,g++);if(!d&&!m)throw Error("Sequence contains no elements");return n};
Z.reduceRight=function(a,b,c){var d="function"===typeof b?2<arguments.length?{callback:b,seed:c}:{callback:b}:b;const {seed:e,callback:f}=d;d=d.hasOwnProperty("seed");const g=Ca(a);let m=!1,n=e;for(let q=g.length-1;0<=q;q--){const A=g[q];m||(m=d)?n=f(n,A,q):(n=A,m=!0)}if(!d&&!m)throw Error("Sequence contains no elements");return n};Z.repeatValue=function(a,b=-1){return new Da(ya(a),b)};
Z.sequenceEqual=function(a,b,c){({comparer:c=wa}=c||{});a=a[Symbol.iterator]();b=b[Symbol.iterator]();let d,e;for(;!(d=a.next()).done;)if((e=b.next()).done||!c(d.value,e.value))return!1;return!!b.next().done};Z.single=function(a,b){const {thisArg:c,predicate:d=()=>!0}=b||{};let e;b=!1;let f=0;for(const g of a){if(b&&d.call(c,g,f++))throw Error("More than one element was found");d.call(c,g,f++)&&(e=g,b=!0)}return e};
Z.some=function(a,b){const {thisArg:c,predicate:d}=b;b=0;for(const e of a)if(d.call(c,e,b++))return!0;return!1};Z.sum=function(a,b){const {selector:c=D,thisArg:d}=b||{};b=0;for(const e of a)b+=c.call(d,e);return b};Z.throwError=function(a){return new Ea(a)};Z.toArray=Ca;Z.toDOMStream=X;Z.toMap=function(a,b){const {elementSelector:c=D,keySelector:d=D}=b||{};b=new Map;for(const e of a){a=c(e);const f=d(e);b.set(f,a)}return b};Z.toSet=function(a){const b=new Set;for(const c of a)b.add(c);return b};
Z.whileDo=function(a,b){return new eb(b,a)};Z.zip=function(...a){return new fb(a)};Object.assign(arguments[0],Z);}.bind(this))));
//# sourceMappingURL=iterable.es2015.min.js.map