Comparing version 0.0.16 to 0.0.17
@@ -1,3 +0,3 @@ | ||
/*! spica v0.0.16 https://github.com/falsandtru/spica | (c) 2016, falsandtru | undefined License (undefined) */ | ||
define="function"==typeof define&&define.amd?define:function(){"use strict";var e="spica",t={};return function n(r,i,o){return o?void o.apply(this,i.map(function(e){switch(e){case"require":return"function"==typeof require?require:void 0;case"exports":return r.indexOf("/")===-1?t[r]="undefined"==typeof exports?self[r]=self[r]||{}:exports:t[r]=t.hasOwnProperty(r)?t[r]:{};default:return".d"===e.slice(-2)&&{}||t.hasOwnProperty(e)&&t[e]||"function"==typeof require&&require(e)||self[e]}})):void n(e,r,i)}}();var __extends=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)};define("src/lib/concat",["require","exports"],function(e,t){"use strict";function n(e,t){for(var n=0,r=t.length,i=e.length;n<r;++n)e[n+i]=t[n];return e}t.concat=n}),define("src/lib/observable",["require","exports","src/lib/concat"],function(e,t,n){"use strict";var r=function(){function e(){this.node_={parent:void 0,childrenMap:Object.create(null),childrenList:[],registers:[]}}return e.prototype.monitor=function(e,t,n){var r=this;return void 0===n&&(n=t),void this.throwTypeErrorIfInvalidSubscriber_(t,e),void this.seekNode_(e).registers.push([e,n,!0,t]),function(){return r.off(e,n)}},e.prototype.on=function(e,t,n){var r=this;return void 0===n&&(n=t),void this.throwTypeErrorIfInvalidSubscriber_(t,e),void this.seekNode_(e).registers.push([e,n,!1,function(e){return t(e)}]),function(){return r.off(e,n)}},e.prototype.off=function(e,t){switch(typeof t){case"function":return void this.seekNode_(e).registers.some(function(e,n,r){var i=e[1];if(t!==i)return!1;switch(n){case 0:return!void r.shift();case r.length-1:return!void r.pop();default:return!void r.splice(n,1)}});case"undefined":var n=this.seekNode_(e);return n.childrenMap=Object.create(null),n.childrenList=[],void(n.registers=[]);default:throw this.throwTypeErrorIfInvalidSubscriber_(t,e)}},e.prototype.once=function(e,t){var n=this;return void this.throwTypeErrorIfInvalidSubscriber_(t,e),this.on(e,function(r){return void n.off(e,t),t(r)},t)},e.prototype.emit=function(e,t,n){void this.drain_(e,t,n)},e.prototype.reflect=function(e,t){var n;return void this.emit(e,t,function(e,t){return n=t}),n},e.prototype.drain_=function(e,t,n){var r=[];if(void this.refsBelow_(this.seekNode_(e)).reduce(function(e,i){var o=i[2],u=i[3];if(!o)try{var c=u(t);n&&(r[r.length]=c)}catch(s){void 0!==s&&null!==s&&void console.error(s+"")}},void 0),void this.refsAbove_(this.seekNode_(e)).reduce(function(e,n){var r=n[2],i=n[3];if(r)try{void i(t)}catch(o){void 0!==o&&null!==o&&void console.error(o)}},void 0),n)try{void n(t,r)}catch(i){void console.error(i)}},e.prototype.refs=function(e){return this.refsBelow_(this.seekNode_(e))},e.prototype.refsAbove_=function(e){var t=e.parent,r=e.registers;for(r=n.concat([],r);t;)r=n.concat(r,t.registers),t=t.parent;return r},e.prototype.refsBelow_=function(e){var t=e.childrenList,r=e.childrenMap,i=e.registers;i=n.concat([],i);for(var o=0;o<t.length;++o){var u=t[o],c=this.refsBelow_(r[u]);i=n.concat(i,c),0===c.length&&(void delete r[u],void t.splice(t.indexOf(u),1),void--o)}return i},e.prototype.seekNode_=function(e){for(var t=this.node_,n=0,r=e;n<r.length;n++){var i=r[n],o=t.childrenMap;o[i+""]||(void t.childrenList.push(i+""),t.childrenList=t.childrenList.sort(),o[i+""]={parent:t,childrenMap:Object.create(null),childrenList:[],registers:[]}),t=o[i+""]}return t},e.prototype.throwTypeErrorIfInvalidSubscriber_=function(e,t){switch(typeof e){case"function":return;default:throw new TypeError("Spica: Observable: Invalid subscriber.\n\t"+e)}},e}();t.Observable=r}),define("src/lib/sqid",["require","exports"],function(e,t){"use strict";function n(e){return void 0===e?(1e15+ ++r+"").slice(1):(1e15+e+"").slice(1)}var r=0;t.sqid=n}),define("src/lib/type",["require","exports"],function(e,t){"use strict";function n(e){return Object.prototype.toString.call(e).split(" ").pop().slice(0,-1)}t.type=n}),define("src/lib/collection/datamap",["require","exports","src/lib/sqid","src/lib/type"],function(e,t,n,r){"use strict";function i(e){return e instanceof Object==!1}var o=function(){function e(){this.store=new Map,this.weakstore=new WeakMap}return e.prototype.stringify=function(e){switch(typeof e){case"undefined":return"0:"+e;case"boolean":return"1:"+e;case"number":return"2:"+(1e3+(""+e).length)+":"+e;case"string":return"3:"+(1e14+e.length)+":"+e;default:return i(e)?"8:"+e:Array.isArray(e)?"9:[ "+this.stringifyArray(e)+" ]":"9:{ "+(this.weakstore.has(e)?this.weakstore.get(e):this.stringifyObject(e)||this.weakstore.set(e,n.sqid()))+" }"}},e.prototype.stringifyArray=function(e){for(var t="",n=0,r=e;n<r.length;n++){var i=r[n];t+=""+this.stringify(i)}return t},e.prototype.stringifyObject=function(e){if("Object"!==r.type(e))return"";for(var t=Object.keys(e),n="",i=0,o=t;i<o.length;i++){var u=o[i];n+=this.stringify(u)+": "+this.stringify(e[u])}return n||" "},e.prototype.get=function(e){return(this.store.get(this.stringify(e))||[])[1]},e.prototype.set=function(e,t){return void this.store.set(this.stringify(e),[e,t]),this},e.prototype.has=function(e){return this.store.has(this.stringify(e))},e.prototype["delete"]=function(e){return this.store["delete"](this.stringify(e))},e.prototype.clear=function(){return this.store.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this.store.size},enumerable:!0,configurable:!0}),e}();t.DataMap=o}),define("src/lib/tick",["require","exports"],function(e,t){"use strict";var n;!function(e){function t(e){void i.push(e),void r()}function n(){void r(),void--o;for(var e=i.length;e-- >0;)void i.shift()()}function r(){if(0!==i.length)for(;o<u.length;)void setTimeout(n,u[o%u.length]),void++o}e.queue=t;var i=[],o=0,u=[0,4,10,20,25].reverse()}(n||(n={}));var r=Function("return typeof process === 'object' && typeof window !== 'object'")();t.Tick=r?Function("return fn => process.nextTick(fn)")():n.queue}),define("src/lib/thenable",["require","exports"],function(e,t){"use strict";function n(e){return!!e&&"object"==typeof e&&void 0!==e.then}t.isThenable=n}),define("src/lib/noop",["require","exports"],function(e,t){"use strict";function n(){}t.noop=n}),define("src/lib/supervisor",["require","exports","src/lib/observable","src/lib/collection/datamap","src/lib/tick","src/lib/thenable","src/lib/concat","src/lib/noop"],function(e,t,n,r,i,o,u,c){"use strict";function s(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}var a=function(){function e(t){var i=this,o=void 0===t?{}:t,u=o.name,s=void 0===u?"":u,a=o.dependencies,f=void 0===a?[]:a,d=o.retry,l=void 0!==d&&d,p=o.timeout,h=void 0===p?0:p,v=o.destructor,m=void 0===v?c.noop:v;if(this.deps=new r.DataMap,this.events={exec:new n.Observable,fail:new n.Observable,loss:new n.Observable,exit:new n.Observable},this.procs=new n.Observable,this.alive=!0,this.registerable=!0,this.scheduled=!1,this.workerSharedResource={procs:this.procs,dependenciesStack:[]},this.queue=[],this.constructor===e)throw new Error("Spica: Supervisor: Cannot instantiate abstract classes.");this.name=s,void f.reduce(function(e,t){var n=t[0],r=t[1];return void i.deps.set(n,r)},void 0),this.retry=l,this.timeout=h,this.destructor_=m,void++this.constructor.count}return e.prototype.destructor=function(e){for(void this.checkState(),this.alive=!1;this.queue.length>0;){var t=this.queue.shift(),n=t[0],r=t[1];void this.events.loss.emit(n,[n,void 0,r])}try{void this.destructor_(e)}catch(i){void console.error(i)}void--this.constructor.count,void Object.freeze(this)},e.prototype.schedule=function(){var e=this;this.alive&&(this.scheduled||(void i.Tick(function(t){e.alive&&(e.scheduled=!1,void e.drain())}),this.scheduled=!0))},e.prototype.register=function(e,t){if(void this.checkState(),!this.registerable)throw new Error("Spica: Supervisor: Supervisor "+this.name+" cannot register process during the exiting.");return e=u.concat([],e),void this.schedule(),new d(this,this.workerSharedResource,e,t,this.deps.get(e)||[]).terminate},e.prototype.call=function(e,t,n,r){var i=this;void 0===n&&(n=this.timeout),void 0===r&&(r=c.noop),void this.checkState(),e=u.concat([],e),void this.queue.push([e,t,function(e,t){return void r(t,e)},n,Date.now()]),void this.schedule(),n>0!=!1&&void setTimeout(function(){return i.drain(e)},n)},e.prototype.cast=function(e,t,n){void 0===n&&(n=this.retry),void this.checkState();var r=this.procs.reflect(e,new f.Call(t));return 0===r.length&&void this.events.fail.emit(e,[e,void 0,t]),r.length>0||!n?r:this.cast(e,t,!1)},e.prototype.refs=function(e){return void this.checkState(),this.procs.refs(e).map(function(e){var t=(e[0],e[1]),n=t(void 0);return[n.namespace,n.process,n.terminate]})},e.prototype.terminate=function(e,t){void this.checkState(),void 0===e&&(this.registerable=!1),void this.procs.emit(e||[],new f.Exit(t)),void this.procs.off(e||[]),void 0===e&&void this.destructor(t)},e.prototype.checkState=function(){if(!this.alive)throw new Error("Spica: Supervisor: Supervisor "+this.name+" already exited.")},e.prototype.drain=function(e){void 0===e&&(e=[]);for(var t,n=Date.now(),r=function(r){var o=i.queue[r],u=o[0],c=o[1],s=o[2],a=o[3],d=o[4],l=e.every(function(e,t){return e===u[t]})?i.procs.reflect(u,new f.Call(c)):[];if(0===l.length&&void i.events.fail.emit(u,[u,void 0,c]),0===l.length&&n<d+a)return t=r,"continue";if(0===r?void i.queue.shift():void i.queue.splice(r,1),void--r,0===l.length&&void i.events.loss.emit(u,[u,void 0,c]),!s)return t=r,"continue";try{void s(c,l)}catch(p){void console.error(p)}t=r},i=this,o=0;o<this.queue.length;++o){r(o);o=t}},e.count=0,e.procs=0,e}();t.Supervisor=a;var f;!function(e){var t=function(){function e(){}return e}(),n=function(e){function t(t){e.call(this),this.namespace=t}return __extends(t,e),t}(t);e.Deps=n;var r=function(e){function t(t){e.call(this),this.data=t}return __extends(t,e),t}(t);e.Call=r;var i=function(e){function t(t){e.call(this),this.reason=t}return __extends(t,e),t}(t);e.Exit=i}(f||(f={}));var d=function(){function e(t,n,r,i,o){var u=this;this.sv=t,this.sharedResource=n,this.namespace=r,this.process=i,this.dependencies=o,this.alive=!0,this.called=!1,this.concurrency=1,this.receive=function(t){return e.prototype.receive.call(u,t)},this.terminate=function(t){return e.prototype.terminate.call(u,t)},this.sharedResource.allRefsCache=void 0,void++this.sv.constructor.procs,void this.sharedResource.procs.on(r,this.receive)}return e.prototype.destructor=function(e){void this.checkState(),void this.sharedResource.procs.off(this.namespace,this.receive),this.alive=!1,void--this.sv.constructor.procs,this.sharedResource.allRefsCache=void 0,void Object.freeze(this),void this.sv.events.exit.emit(this.namespace,[this.namespace,this.process,e])},e.prototype.tryDependencyResolving=function(e){if(this.receive(new f.Deps(this.namespace)))return void(this.sharedResource.dependenciesStack=[]);throw void(this.sharedResource.dependenciesStack=[])},e.prototype.receive=function(e){var t=this;if(void this.checkState(),void 0===e)return this;if(e instanceof f.Deps){if(e.namespace.length!==this.namespace.length)return!1;if(0===this.concurrency)return!1;for(var n=0,r=this.sharedResource.dependenciesStack;n<r.length;n++){var i=r[n];if(s(this.namespace,i))return!0}return void this.sharedResource.dependenciesStack.push(this.namespace),this.dependencies.every(function(e){return(t.sharedResource.allRefsCache=t.sharedResource.allRefsCache||t.sharedResource.procs.refs([])).some(function(t){var n=t[0],r=t[1];return s(n,e)&&!!r(new f.Deps(e))})})}if(e instanceof f.Call){if(0===this.concurrency)throw void 0;void this.tryDependencyResolving(e),this.called||(this.called=!0,void this.sv.events.exec.emit(this.namespace,[this.namespace,this.process]));try{void--this.concurrency;var u=(0,this.process)(e.data);return o.isThenable(u)?void u.then(function(e){void t.sv.schedule(),t.alive&&void++t.concurrency},function(e){void t.sv.schedule(),t.alive&&(void++t.concurrency,void t.terminate(e))}):void++this.concurrency,u}catch(c){throw void void this.terminate(c)}}if(e instanceof f.Exit)throw void void this.terminate(e.reason);throw new TypeError("Spica: Supervisor: Invalid command: "+e)},e.prototype.terminate=function(e){void this.destructor(e)},e.prototype.checkState=function(){if(!this.alive)throw new Error("Spica: Supervisor: Process "+this.namespace+"/"+this.process+" already exited.")},e}()}),define("src/lib/monad/lazy",["require","exports"],function(e,t){"use strict";var n=function(){function e(e){this.thunk=e}return e.prototype.evaluate=function(){return this.memory_=this.memory_||this.thunk()},e}();t.Lazy=n}),define("src/lib/monad/functor",["require","exports","src/lib/monad/lazy"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t}(n.Lazy);t.Functor=r;var r;!function(e){function t(e,t){return t?e.fmap(t):function(t){return e.fmap(t)}}e.fmap=t}(r=t.Functor||(t.Functor={}))}),define("src/lib/monad/applicative",["require","exports","src/lib/monad/functor"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t}(n.Functor);t.Applicative=r;var r;!function(e){function t(e,t){return t?e.bind(function(e){return t.fmap(function(t){return e(t)})}):function(t){return e.bind(function(e){return t.fmap(function(t){return e(t)})})}}e.ap=t}(r=t.Applicative||(t.Applicative={}))}),define("src/lib/monad/monad",["require","exports","src/lib/monad/applicative"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t}(n.Applicative);t.Monad=r;var r;!function(e){function t(e,t){return t?e.bind(t):function(t){return e.bind(t)}}e.bind=t}(r=t.Monad||(t.Monad={}))}),define("src/lib/monad/monadplus",["require","exports","src/lib/monad/monad"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t}(n.Monad);t.MonadPlus=r;var r;!function(e){}(r=t.MonadPlus||(t.MonadPlus={}))}),define("src/lib/curry",["require","exports"],function(e,t){"use strict";function n(e,t,r){return e.length===t.length?e.apply(r,t):function(){for(var i=[],o=0;o<arguments.length;o++)i[o-0]=arguments[o];return n(e,t.concat(i),r)}}var r=this;t.curry=function(e,t){return void 0===t&&(t=r),0===e.length?function(){return e.call(t)}:n(e,[],t)}}),define("src/lib/monad/maybe.impl",["require","exports","src/lib/monad/monadplus"],function(e,t,n){"use strict";function r(){throw new Error("Spica: Maybe: Invalid thunk call.")}var i=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.fmap=function(e){return this.bind(function(t){return new o(e(t))})},t.prototype.bind=function(e){var n=this;return new t(function(){var r=n.evaluate();if(r instanceof o)return e(r.extract());if(r instanceof u)return r;if(r instanceof t)return r.bind(e);throw new TypeError("Spica: Maybe: Invalid monad value.\n\t"+r)})},t.prototype.extract=function(e){return this.evaluate().extract(e)},t}(n.MonadPlus);t.Maybe=i;var i;!function(e){function t(e){return new o(e)}e.pure=t,e.Return=t}(i=t.Maybe||(t.Maybe={}));var o=function(e){function t(t){e.call(this,r),this.a=t}return __extends(t,e),t.prototype.bind=function(e){var t=this;return new i(function(){return e(t.extract())})},t.prototype.extract=function(e){return this.a},t}(i);t.Just=o;var u=function(e){function t(){e.call(this,r)}return __extends(t,e),t.prototype.bind=function(e){return this},t.prototype.extract=function(e){if(!e)throw void 0;return e()},t}(i);t.Nothing=u;var i;!function(e){function t(t,n){return new e(function(){return t.fmap(function(){return t}).extract(function(){return n})})}e.mzero=new u,e.mplus=t}(i=t.Maybe||(t.Maybe={}))}),define("src/lib/monad/maybe",["require","exports","src/lib/monad/maybe.impl"],function(e,t,n){"use strict";function r(e){return new n.Just(e)}var i;!function(e){e.fmap=n.Maybe.fmap,e.pure=n.Maybe.pure,e.ap=n.Maybe.ap,e.Return=n.Maybe.Return,e.bind=n.Maybe.bind,e.mzero=n.Maybe.mzero,e.mplus=n.Maybe.mplus}(i=t.Maybe||(t.Maybe={})),t.Just=r,t.Nothing=n.Maybe.mzero}),define("src/lib/monad/either.impl",["require","exports","src/lib/monad/monad"],function(e,t,n){"use strict";function r(){throw new Error("Spica: Either: Invalid thunk call.")}var i=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.fmap=function(e){return this.bind(function(t){return new u(e(t))})},t.prototype.bind=function(e){var n=this;return new t(function(){var r=n.evaluate();if(r instanceof o)return r;if(r instanceof u)return e(r.extract());if(r instanceof t)return r.bind(e);throw new TypeError("Spica: Either: Invalid monad value.\n\t"+r)})},t.prototype.extract=function(e){return this.evaluate().extract(e)},t}(n.Monad);t.Either=i;var i;!function(e){function t(e){return new u(e)}e.pure=t,e.Return=t}(i=t.Either||(t.Either={}));var o=function(e){function t(t){e.call(this,r),this.a=t}return __extends(t,e),t.prototype.bind=function(e){return this},t.prototype.extract=function(e){if(!e)throw this.a;return e(this.a)},t}(i);t.Left=o;var u=function(e){function t(t){e.call(this,r),this.b=t}return __extends(t,e),t.prototype.bind=function(e){var t=this;return new i(function(){return e(t.extract())})},t.prototype.extract=function(e){return this.b},t}(i);t.Right=u}),define("src/lib/monad/either",["require","exports","src/lib/monad/either.impl"],function(e,t,n){"use strict";function r(e){return new n.Left(e)}function i(e){return new n.Right(e)}var o;!function(e){e.fmap=n.Either.fmap,e.pure=n.Either.pure,e.ap=n.Either.ap,e.Return=n.Either.Return,e.bind=n.Either.bind}(o=t.Either||(t.Either={})),t.Left=r,t.Right=i}),define("src/lib/cancelable",["require","exports","src/lib/noop","src/lib/monad/maybe","src/lib/monad/either"],function(e,t,n,r,i){"use strict";var o=function(){function e(){var e=this;this.canceled=!1,this.listeners=new Set,this.promise=function(t){return e.canceled?e.promise_=e.promise_||new Promise(function(t,n){return void n(e.reason)}):Promise.resolve(t)},this.maybe=function(t){return e.canceled?r.Nothing:r.Just(t)},this.either=function(t){return e.canceled?i.Left(e.reason):i.Right(t)},this.cancel=function(t){return e.cancel=n.noop,e.canceled=!0,e.reason=t,e.listeners.forEach(function(t){return void t(e.reason)}),void e.listeners.clear()}}return e}();t.Cancelable=o}),define("src/lib/monad/sequence/core",["require","exports","src/lib/monad/monadplus"],function(e,t,n){"use strict";var r=function(e){function t(t,n){e.call(this),this.cons=t,this.memory=n}return __extends(t,e),t}(n.MonadPlus);t.Sequence=r;var r;!function(e){}(r=t.Sequence||(t.Sequence={}));var r;!function(e){function t(e){return r.iterator(e)!==i.done}var n;!function(t){function n(t,n){switch(arguments.length){case 0:return[];case 1:return[t];case 2:return[t,n];default:throw e.Exception.invalidConsError(arguments)}}t.cons=n}(n=e.Data||(e.Data={}));var r;!function(e){function t(e){return e[0]}function n(e){return e[1]}function r(e){return e[2]}e.value=t,e.iterator=n,e.index=r}(r=e.Thunk||(e.Thunk={}));var i;!function(t){function n(t,i,o){return e.isIterable(t)?o(t,function(){return n(r.iterator(t)(),i,o)}):i(t)}t.done=function(){return[void 0,t.done,-1]},t.when=n}(i=e.Iterator||(e.Iterator={})),e.isIterable=t;var o;!function(e){function t(e){return console.error(e,e.length,e[0],e[1]),new TypeError("Spica: Sequence: Invalid parameters of cons.")}function n(e){return console.error(e),new TypeError("Spica: Sequence: Invalid data.")}function r(e){return console.error(e),new TypeError("Spica: Sequence: Invalid thunk.")}e.invalidConsError=t,e.invalidDataError=n,e.invalidThunkError=r}(o=e.Exception||(e.Exception={}))}(r=t.Sequence||(t.Sequence={}))}),define("src/lib/monad/sequence/member/static/from",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.from=function(e){return new n.Sequence(function(t,n){return void 0===t&&(t=0),t<e.length?n(e[t],++t):n()})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/write",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.write=function(e){return new n.Sequence(function(t,n){return e.length>0?n(e.shift(),e):n()})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/cycle",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.cycle=function(e){return new n.Sequence(function(t,n){return void 0===t&&(t=0),0===e.length?n():n(e[t],++t%e.length)})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/random",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.random=function(e){switch(void 0===e&&(e=function(){return Math.random()}),!0){case Array.isArray(e):return this.random().map(function(t){return e[t*e.length|0]});default:return new n.Sequence(function(t,n){return n(e(),NaN)})}},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/concat",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.concat=function(e){return new n.Sequence(function(t,r){var i=void 0===t?[function(){return e.iterate()},n.Sequence.Iterator.done]:t,o=i[0],u=i[1];return n.Sequence.Iterator.when(o(),function(){return r()},function(e,t){return u=u===n.Sequence.Iterator.done?function(){return n.Sequence.Thunk.value(e).iterate()}:u,n.Sequence.Iterator.when(u(),function(){return u=n.Sequence.Iterator.done,t()},function(t){return r(n.Sequence.Thunk.value(t),[function(){return e},n.Sequence.Thunk.iterator(t)])})})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/zip",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.zip=function(e,t){return new n.Sequence(function(r,i){var o=void 0===r?[function(){return e.iterate()},function(){return t.iterate()}]:r,u=o[0],c=o[1];return n.Sequence.Iterator.when(u(),function(){return i()},function(e){return n.Sequence.Iterator.when(c(),function(){return i()},function(t){return i([n.Sequence.Thunk.value(e),n.Sequence.Thunk.value(t)],[n.Sequence.Thunk.iterator(e),n.Sequence.Thunk.iterator(t)])})})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/union",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";function r(e,t,r){return new n.Sequence(function(i,o){var u=void 0===i?[function(){return t.iterate()},function(){return r.iterate()}]:i,c=u[0],s=u[1];return n.Sequence.Iterator.when(c(),function(){return n.Sequence.Iterator.when(s(),function(){return o()},function(e){return o(n.Sequence.Thunk.value(e),[n.Sequence.Iterator.done,n.Sequence.Thunk.iterator(e)])})},function(t){return n.Sequence.Iterator.when(s(),function(){return o(n.Sequence.Thunk.value(t),[n.Sequence.Thunk.iterator(t),n.Sequence.Iterator.done])},function(r){var i=e(n.Sequence.Thunk.value(t),n.Sequence.Thunk.value(r));return i<0?o(n.Sequence.Thunk.value(t),[n.Sequence.Thunk.iterator(t),s]):i>0?o(n.Sequence.Thunk.value(r),[c,n.Sequence.Thunk.iterator(r)]):o(n.Sequence.Thunk.value(t),[n.Sequence.Thunk.iterator(t),n.Sequence.Thunk.iterator(r)])})})})}var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.union=function(e,t){return t.reduce(function(t,n){return r(e,t,n)})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/static/intersect",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";function r(e,t,r){return new n.Sequence(function(i,o){var u=void 0===i?[function(){return t.iterate()},function(){return r.iterate()}]:i,c=u[0],s=u[1];return n.Sequence.Iterator.when(c(),function(){return o()},function(t,r){return n.Sequence.Iterator.when(s(),function(){return o()},function(i,u){var c=e(n.Sequence.Thunk.value(t),n.Sequence.Thunk.value(i));return c<0?(s=function(){return i},r()):c>0?u():o(n.Sequence.Thunk.value(t),[n.Sequence.Thunk.iterator(t),n.Sequence.Thunk.iterator(i)])})})})}var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.intersect=function(e,t){return t.reduce(function(t,n){return r(e,t,n)})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/static/pure",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.pure=function(e){return new n.Sequence(function(t,n){return n(e)})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/return",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.Return=function(e){return new n.Sequence(function(t,n){return n(e)})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/mempty",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.mempty=new n.Sequence(function(e,t){return t()}),t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/mconcat",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";function r(e,t){return new n.Sequence(function(r,i){var o=void 0===r?[function(){return e.iterate()},function(){return t.iterate()}]:r,u=o[0],c=o[1];return n.Sequence.Iterator.when(u(),function(){return n.Sequence.Iterator.when(c(),function(){return i()},function(e){return i(n.Sequence.Thunk.value(e),[n.Sequence.Iterator.done,n.Sequence.Thunk.iterator(e)])})},function(e){return i(n.Sequence.Thunk.value(e),[n.Sequence.Thunk.iterator(e),c])})})}var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.mconcat=function(e){return e.reduce(function(e,t){return r(e,t)},n.Sequence.from([]))},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/static/mappend",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.mappend=function(e,t){return n.Sequence.mconcat([e,t])},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/mzero",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.mzero=n.Sequence.mempty,t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/mplus",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.mplus=n.Sequence.mappend,t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/iterate",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.iterate=function(){return this.iterate_()},t.prototype.iterate_=function(e,t){var r=this;void 0===t&&(t=0);var i=this.memory?this.memory.has(t)?this.memory.get(t):this.memory.set(t,this.cons(e,n.Sequence.Data.cons)).get(t):this.cons(e,n.Sequence.Data.cons);switch(i.length){case 0:return[void 0,n.Sequence.Iterator.done,-1];case 1:return[i[0],function(){return n.Sequence.Iterator.done()},t];case 2:return[i[0],function(){return r.iterate_(i[1],t+1)},t];default:throw n.Sequence.Exception.invalidDataError(i)}},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/memoize",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.memoize=function(e){return void 0===e&&(e=this.memory||new Map),new n.Sequence(this.cons,this.memory||e)},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/read",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,t,n,r){"use strict";var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.read=function(){for(var e=this,t=[],i=function(){return e.iterate()};;){var o=i();if(!n.Sequence.isIterable(o))return t;void r.concat(t,[n.Sequence.Thunk.value(o)]),i=n.Sequence.Thunk.iterator(o)}},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/instance/take",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.take=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(e>0?r():n.Sequence.Iterator.done(),function(){return i()},function(t){return n.Sequence.Thunk.index(t)+1<e?i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t)):i(n.Sequence.Thunk.value(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/drop",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.drop=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t,r){return n.Sequence.Thunk.index(t)<e?r():i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/takeWhile",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.takeWhile=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t){return e(n.Sequence.Thunk.value(t))?i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t)):i()})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/dropWhile",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.dropWhile=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t,r){return e(n.Sequence.Thunk.value(t))?r():i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t)); | ||
})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/takeUntil",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.takeUntil=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t){return e(n.Sequence.Thunk.value(t))?i(n.Sequence.Thunk.value(t)):i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/dropUntil",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.dropUntil=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t,r){return e(n.Sequence.Thunk.value(t))?r():i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/fmap",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.fmap=function(e){var t=this;return new n.Sequence(function(r){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return n.Sequence.Data.cons()},function(t){return n.Sequence.Data.cons(e(n.Sequence.Thunk.value(t)),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/bind",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.bind=function(e){return n.Sequence.concat(this.fmap(e))},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/mapM",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,t,n,r){"use strict";var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.mapM=function(e){var t=this;return this.take(1).bind(function(){var i=t.read();switch(i.length){case 0:return n.Sequence.from([]);default:var o=i.shift();return e(o).bind(function(t){return 0===i.length?n.Sequence.from([[t]]):n.Sequence.from(i).mapM(e).fmap(function(e){return r.concat([t],e)})})}})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/instance/filterM",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,t,n,r){"use strict";var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.filterM=function(e){var t=this;return this.take(1).bind(function(){var i=t.read();switch(i.length){case 0:return n.Sequence.from([[]]);default:var o=i.shift();return e(o).bind(function(t){return t?0===i.length?n.Sequence.from([[o]]):n.Sequence.from(i).filterM(e).fmap(function(e){return r.concat([o],e)}):0===i.length?n.Sequence.from([[]]):n.Sequence.from(i).filterM(e)})}})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/instance/map",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.map=function(e){var t=this;return new n.Sequence(function(r){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return n.Sequence.Data.cons()},function(t){return n.Sequence.Data.cons(e(n.Sequence.Thunk.value(t),n.Sequence.Thunk.index(t)),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/filter",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.filter=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t,r){return e(n.Sequence.Thunk.value(t),n.Sequence.Thunk.index(t))?i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t)):r()})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/scan",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.scan=function(e,t){var r=this;return new n.Sequence(function(i){var o=void 0===i?[void 0,void 0]:i,u=o[0],c=void 0===u?t:u,s=o[1],a=void 0===s?function(){return r.iterate()}:s;return n.Sequence.Iterator.when(a(),function(){return n.Sequence.Data.cons()},function(t){return n.Sequence.Data.cons(c=e(c,n.Sequence.Thunk.value(t)),[c,n.Sequence.Thunk.iterator(t)])})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/assign",["require","exports","src/lib/type"],function(e,t,n){"use strict";function r(e){return function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if(void 0===t||null===t)throw new TypeError("Spica: assign: Cannot walk on "+t+".");for(var i=0,o=n;i<o.length;i++){var u=o[i];if(void 0!==u&&null!==u)for(var c=0,s=Object.keys(Object(u));c<s.length;c++){var a=s[c],f=Object.getOwnPropertyDescriptor(Object(u),a);void 0!==f&&f.enumerable&&void e(a,Object(t),Object(u))}}return Object(t)}}t.assign=r(function(e,t,n){return t[e]=n[e]}),t.clone=r(function(e,r,i){switch(n.type(i[e])){case"Array":return r[e]=t.clone([],i[e]);case"Function":case"Object":return r[e]=t.clone({},i[e]);default:return r[e]=i[e]}}),t.extend=r(function(e,r,i){switch(n.type(i[e])){case"Array":return r[e]=t.extend([],i[e]);case"Function":case"Object":switch(n.type(r[e])){case"Function":case"Object":return r[e]=t.extend(r[e],i[e]);default:return r[e]=t.extend({},i[e])}default:return r[e]=i[e]}})}),define("src/lib/compose",["require","exports","src/lib/assign","src/lib/concat"],function(e,t,n,r){"use strict";function i(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return r.concat([e],t).reduce(function(e,t){void n.assign(e.prototype,t.prototype);for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e})}t.compose=i}),define("src/lib/monad/sequence",["require","exports","src/lib/monad/sequence/core","src/lib/monad/sequence/member/static/from","src/lib/monad/sequence/member/static/write","src/lib/monad/sequence/member/static/cycle","src/lib/monad/sequence/member/static/random","src/lib/monad/sequence/member/static/concat","src/lib/monad/sequence/member/static/zip","src/lib/monad/sequence/member/static/union","src/lib/monad/sequence/member/static/intersect","src/lib/monad/sequence/member/static/pure","src/lib/monad/sequence/member/static/return","src/lib/monad/sequence/member/static/mempty","src/lib/monad/sequence/member/static/mconcat","src/lib/monad/sequence/member/static/mappend","src/lib/monad/sequence/member/static/mzero","src/lib/monad/sequence/member/static/mplus","src/lib/monad/sequence/member/instance/iterate","src/lib/monad/sequence/member/instance/memoize","src/lib/monad/sequence/member/instance/read","src/lib/monad/sequence/member/instance/take","src/lib/monad/sequence/member/instance/drop","src/lib/monad/sequence/member/instance/takeWhile","src/lib/monad/sequence/member/instance/dropWhile","src/lib/monad/sequence/member/instance/takeUntil","src/lib/monad/sequence/member/instance/dropUntil","src/lib/monad/sequence/member/instance/fmap","src/lib/monad/sequence/member/instance/bind","src/lib/monad/sequence/member/instance/mapM","src/lib/monad/sequence/member/instance/filterM","src/lib/monad/sequence/member/instance/map","src/lib/monad/sequence/member/instance/filter","src/lib/monad/sequence/member/instance/scan","src/lib/compose"],function(e,t,n,r,i,o,u,c,s,a,f,d,l,p,h,v,m,b,q,y,S,x,_,w,g,k,M,T,O,I,j,E,P,R,N){"use strict";t.Sequence=n.Sequence,N.compose(n.Sequence,r["default"],i["default"],o["default"],u["default"],c["default"],s["default"],a["default"],f["default"],d["default"],l["default"],p["default"],h["default"],v["default"],m["default"],b["default"],q["default"],y["default"],S["default"],x["default"],_["default"],w["default"],g["default"],k["default"],M["default"],T["default"],O["default"],I["default"],j["default"],E["default"],P["default"],R["default"])}),define("src/lib/flip",["require","exports","src/lib/curry"],function(e,t,n){"use strict";function r(e){return n.curry(function(t,n){return e.length>1?e(n,t):e(n)(t)})}t.flip=r}),define("src/lib/list",["require","exports","src/lib/concat"],function(e,t,n){"use strict";var r=function(){function e(){}return e.prototype.push=function(e){return new i(e,this)},e}();t.Nil=r;var i=function(){function e(e,t){this.head_=e,this.tail_=t}return e.prototype.push=function(t){return new e(t,this)},e.prototype.head=function(){return this.head_},e.prototype.tail=function(){return this.tail_},e.prototype.walk=function(e){return void e(this.head()),this.tail()},e.prototype.modify=function(e){return this.tail().push(e(this.head()))},e.prototype.extend=function(e){return this.push(e(this.head()))},e.prototype.array=function(){return n.concat([this.head()],this.tail().array?this.tail().array():[])},e}()}),define("src/lib/hlist",["require","exports"],function(e,t){"use strict";var n=function(){function e(){}return e.prototype.push=function(e){return new r(e,this)},e}();t.HNil=n;var r=function(){function e(e,t){this.head_=e,this.tail_=t}return e.prototype.push=function(t){return new e(t,this)},e.prototype.head=function(){return this.head_},e.prototype.tail=function(){return this.tail_},e.prototype.walk=function(e){return void e(this.head()),this.tail()},e.prototype.modify=function(e){return this.tail().push(e(this.head()))},e.prototype.extend=function(e){return this.push(e(this.head()))},e}()}),define("src/lib/collection/attrmap",["require","exports"],function(e,t){"use strict";var n=function(){function e(){this.store=new WeakMap}return e.prototype.get=function(e,t){return this.store.get(e)&&this.store.get(e).get(t)},e.prototype.set=function(e,t,n){var r=this.store.has(e)?this.store.get(e):this.store.set(e,new Map).get(e);return void r.set(t,n),this},e.prototype.has=function(e,t){return this.store.has(e)&&this.store.get(e).has(t)},e.prototype["delete"]=function(e,t){return void 0===t?this.store["delete"](e):!!this.store.has(e)&&this.store.get(e)["delete"](t)},e}();t.AttrMap=n}),define("src/lib/collection/relationmap",["require","exports"],function(e,t){"use strict";var n=function(){function e(){this.store=new WeakMap}return e.prototype.get=function(e,t){return this.store.get(e)&&this.store.get(e).get(t)},e.prototype.set=function(e,t,n){var r=this.store.has(e)?this.store.get(e):this.store.set(e,new WeakMap).get(e);return void r.set(t,n),this},e.prototype.has=function(e,t){return this.store.has(e)&&this.store.get(e).has(t)},e.prototype["delete"]=function(e,t){return void 0===t?this.store["delete"](e):!!this.store.has(e)&&this.store.get(e)["delete"](t)},e}();t.RelationMap=n}),define("src/lib/mixin",["require","exports","src/lib/assign"],function(e,t,n){"use strict";function r(){for(var e=[],t=0;t<arguments.length;t++)e[t-0]=arguments[t];return e.reduceRight(function(e,t){return i(t,e)},function(){function e(){}return e}())}function i(e,t){var r=function(){function n(){return e.apply(t.apply(this,arguments)||this,arguments)}return n}();void n.assign(r.prototype,e.prototype,t.prototype);for(var i in t)t.hasOwnProperty(i)&&(r[i]=t[i]);for(var i in e)e.hasOwnProperty(i)&&(r[i]=e[i]);return r}t.Mixin=r}),define("src/lib/fingerprint",["require","exports"],function(e,t){"use strict";function n(){return i(o([u(window.navigator),u(window.screen),u((new Date).getTimezoneOffset())].join()))}function r(){return i(o([u(process)].join()))}function i(e){return e.split("").reduce(function(e,t,n){return(+t*n+e)%1e9||e-+t},0)}function o(e){return e.split("").map(function(e){return e.charCodeAt(0)}).join("")}function u(e,t){if(void 0===t&&(t=5),t>0&&e&&"object"==typeof e){var n="{";for(var r in e)n+='"'+r+'": '+u(e[r],t-1)+",";return n+="}"}return!e||e.toString?'"'+e+'"':'"'+Object.prototype.toString.call(e)+'"'}t.FINGERPRINT="object"==typeof window?n():r(),t.browser=n,t.server=r,t.hash=i,t.str2digit=o,t.stringify=u}),define("src/lib/uuid",["require","exports","src/lib/fingerprint"],function(e,t,n){"use strict";function r(){var e=u=u*Date.now()%1e15;if(e<16||1e15<e)throw new Error("Spica: uuid: Invalid uuid dynamic seed.");for(var t="",n=0,r=o;n<r.length;n++){var i=r[n];if("x"===i||"y"===i){var c=Math.random()*e%16|0,s="x"==i?c:3&c|8;t+=s.toString(16)}else t+=i}return t.toLowerCase()}var i=n.FINGERPRINT*Date.now()%1e15;if(!i||"number"!=typeof i||i<100||1e15<i)throw new Error("Spica: uuid: Invalid uuid static seed.\n\t"+n.FINGERPRINT);var o=Object.freeze("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split("")),u=i;t.v4=r}),define("src/lib/sort",["require","exports"],function(e,t){"use strict";function n(e,t,n,r){if(void 0===r&&(r=!1),!r&&n*n>1.25*e.length)return e.sort(t);n=n<e.length-1?n:e.length-1;for(var i=0;i<n;++i)for(var o=i+1;o<e.length;++o)if(t(e[i],e[o])>0!=!1){var u=e[i];e[i]=e[o],e[o]=u}return e}t.sort=n}),define("src/export",["require","exports","src/lib/supervisor","src/lib/observable","src/lib/cancelable","src/lib/monad/sequence","src/lib/monad/maybe","src/lib/monad/either","src/lib/curry","src/lib/flip","src/lib/list","src/lib/hlist","src/lib/collection/datamap","src/lib/collection/attrmap","src/lib/collection/relationmap","src/lib/mixin","src/lib/tick","src/lib/fingerprint","src/lib/uuid","src/lib/sqid","src/lib/assign","src/lib/concat","src/lib/sort"],function(e,t,n,r,i,o,u,c,s,a,f,d,l,p,h,v,m,b,q,y,S,x,_){"use strict";t.Supervisor=n.Supervisor,t.Observable=r.Observable,t.Cancelable=i.Cancelable,t.Sequence=o.Sequence,t.Maybe=u.Maybe,t.Just=u.Just,t.Nothing=u.Nothing,t.Either=c.Either,t.Left=c.Left,t.Right=c.Right,t.curry=s.curry,t.flip=a.flip,t.Nil=f.Nil,t.HNil=d.HNil,t.DataMap=l.DataMap,t.AttrMap=p.AttrMap,t.RelationMap=h.RelationMap,t.Mixin=v.Mixin,t.Tick=m.Tick,t.FINGERPRINT=b.FINGERPRINT,t.uuid=q.v4,t.sqid=y.sqid,t.assign=S.assign,t.clone=S.clone,t.extend=S.extend,t.concat=x.concat,t.sort=_.sort}),define("spica",["require","exports","src/export"],function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}r(n)}); | ||
/*! spica v0.0.17 https://github.com/falsandtru/spica | (c) 2016, falsandtru | undefined License (undefined) */ | ||
define="function"==typeof define&&define.amd?define:function(){"use strict";var e="spica",t={};return function n(r,i,o){return o?void o.apply(this,i.map(function(e){switch(e){case"require":return"function"==typeof require?require:void 0;case"exports":return r.indexOf("/")===-1?t[r]="undefined"==typeof exports?self[r]=self[r]||{}:exports:t[r]=t.hasOwnProperty(r)?t[r]:{};default:return".d"===e.slice(-2)&&{}||t.hasOwnProperty(e)&&t[e]||"function"==typeof require&&require(e)||self[e]}})):void n(e,r,i)}}();var __extends=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)};define("src/lib/concat",["require","exports"],function(e,t){"use strict";function n(e,t){for(var n=0,r=t.length,i=e.length;n<r;++n)e[n+i]=t[n];return e}t.concat=n}),define("src/lib/observable",["require","exports","src/lib/concat"],function(e,t,n){"use strict";var r=function(){function e(){this.node_={parent:void 0,childrenMap:Object.create(null),childrenList:[],registers:[]}}return e.prototype.monitor=function(e,t,n){var r=this;return void 0===n&&(n=t),void this.throwTypeErrorIfInvalidSubscriber_(t,e),void this.seekNode_(e).registers.push([e,n,!0,t]),function(){return r.off(e,n)}},e.prototype.on=function(e,t,n){var r=this;return void 0===n&&(n=t),void this.throwTypeErrorIfInvalidSubscriber_(t,e),void this.seekNode_(e).registers.push([e,n,!1,function(e){return t(e)}]),function(){return r.off(e,n)}},e.prototype.off=function(e,t){switch(typeof t){case"function":return void this.seekNode_(e).registers.some(function(e,n,r){var i=e[1];if(t!==i)return!1;switch(n){case 0:return!void r.shift();case r.length-1:return!void r.pop();default:return!void r.splice(n,1)}});case"undefined":var n=this.seekNode_(e);return n.childrenMap=Object.create(null),n.childrenList=[],void(n.registers=[]);default:throw this.throwTypeErrorIfInvalidSubscriber_(t,e)}},e.prototype.once=function(e,t){var n=this;return void this.throwTypeErrorIfInvalidSubscriber_(t,e),this.on(e,function(r){return void n.off(e,t),t(r)},t)},e.prototype.emit=function(e,t,n){void this.drain_(e,t,n)},e.prototype.reflect=function(e,t){var n;return void this.emit(e,t,function(e,t){return n=t}),n},e.prototype.drain_=function(e,t,n){var r=[];if(void this.refsBelow_(this.seekNode_(e)).reduce(function(e,i){var o=i[2],u=i[3];if(!o)try{var c=u(t);n&&(r[r.length]=c)}catch(s){void 0!==s&&null!==s&&void console.error(s+"")}},void 0),void this.refsAbove_(this.seekNode_(e)).reduce(function(e,n){var r=n[2],i=n[3];if(r)try{void i(t)}catch(o){void 0!==o&&null!==o&&void console.error(o)}},void 0),n)try{void n(t,r)}catch(i){void console.error(i)}},e.prototype.refs=function(e){return this.refsBelow_(this.seekNode_(e))},e.prototype.refsAbove_=function(e){var t=e.parent,r=e.registers;for(r=n.concat([],r);t;)r=n.concat(r,t.registers),t=t.parent;return r},e.prototype.refsBelow_=function(e){var t=e.childrenList,r=e.childrenMap,i=e.registers;i=n.concat([],i);for(var o=0;o<t.length;++o){var u=t[o],c=this.refsBelow_(r[u]);i=n.concat(i,c),0===c.length&&(void delete r[u],void t.splice(t.indexOf(u),1),void--o)}return i},e.prototype.seekNode_=function(e){for(var t=this.node_,n=0,r=e;n<r.length;n++){var i=r[n],o=t.childrenMap;o[i+""]||(void t.childrenList.push(i+""),t.childrenList=t.childrenList.sort(),o[i+""]={parent:t,childrenMap:Object.create(null),childrenList:[],registers:[]}),t=o[i+""]}return t},e.prototype.throwTypeErrorIfInvalidSubscriber_=function(e,t){switch(typeof e){case"function":return;default:throw new TypeError("Spica: Observable: Invalid subscriber.\n\t"+e)}},e}();t.Observable=r}),define("src/lib/sqid",["require","exports"],function(e,t){"use strict";function n(e){return void 0===e?(1e15+ ++r+"").slice(1):(1e15+e+"").slice(1)}var r=0;t.sqid=n}),define("src/lib/type",["require","exports"],function(e,t){"use strict";function n(e){return Object.prototype.toString.call(e).split(" ").pop().slice(0,-1)}t.type=n}),define("src/lib/collection/datamap",["require","exports","src/lib/sqid","src/lib/type"],function(e,t,n,r){"use strict";function i(e){return e instanceof Object==!1}var o=function(){function e(){this.store=new Map,this.weakstore=new WeakMap}return e.prototype.stringify=function(e){switch(typeof e){case"undefined":return"0:"+e;case"boolean":return"1:"+e;case"number":return"2:"+(1e3+(""+e).length)+":"+e;case"string":return"3:"+(1e14+e.length)+":"+e;default:return i(e)?"8:"+e:Array.isArray(e)?"9:[ "+this.stringifyArray(e)+" ]":"9:{ "+(this.weakstore.has(e)?this.weakstore.get(e):this.stringifyObject(e)||this.weakstore.set(e,n.sqid()))+" }"}},e.prototype.stringifyArray=function(e){for(var t="",n=0,r=e;n<r.length;n++){var i=r[n];t+=""+this.stringify(i)}return t},e.prototype.stringifyObject=function(e){if("Object"!==r.type(e))return"";for(var t=Object.keys(e),n="",i=0,o=t;i<o.length;i++){var u=o[i];n+=this.stringify(u)+": "+this.stringify(e[u])}return n||" "},e.prototype.get=function(e){return(this.store.get(this.stringify(e))||[])[1]},e.prototype.set=function(e,t){return void this.store.set(this.stringify(e),[e,t]),this},e.prototype.has=function(e){return this.store.has(this.stringify(e))},e.prototype["delete"]=function(e){return this.store["delete"](this.stringify(e))},e.prototype.clear=function(){return this.store.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this.store.size},enumerable:!0,configurable:!0}),e}();t.DataMap=o}),define("src/lib/tick",["require","exports"],function(e,t){"use strict";var n;!function(e){function t(e){void i.push(e),void r()}function n(){void r(),void--o;for(var e=i.length;e-- >0;)void i.shift()()}function r(){if(0!==i.length)for(;o<u.length;)void setTimeout(n,u[o%u.length]),void++o}e.queue=t;var i=[],o=0,u=[0,4,10,20,25].reverse()}(n||(n={}));var r=Function("return typeof process === 'object' && typeof window !== 'object'")();t.Tick=r?Function("return fn => process.nextTick(fn)")():n.queue}),define("src/lib/thenable",["require","exports"],function(e,t){"use strict";function n(e){return!!e&&"object"==typeof e&&void 0!==e.then}t.isThenable=n}),define("src/lib/noop",["require","exports"],function(e,t){"use strict";function n(){}t.noop=n}),define("src/lib/supervisor",["require","exports","src/lib/observable","src/lib/collection/datamap","src/lib/tick","src/lib/thenable","src/lib/concat","src/lib/noop"],function(e,t,n,r,i,o,u,c){"use strict";function s(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}var a=function(){function e(t){var i=this,o=void 0===t?{}:t,u=o.name,s=void 0===u?"":u,a=o.dependencies,f=void 0===a?[]:a,d=o.retry,l=void 0!==d&&d,p=o.timeout,h=void 0===p?0:p,v=o.destructor,m=void 0===v?c.noop:v;if(this.deps=new r.DataMap,this.events={exec:new n.Observable,fail:new n.Observable,loss:new n.Observable,exit:new n.Observable},this.procs=new n.Observable,this.alive=!0,this.registerable=!0,this.scheduled=!1,this.workerSharedResource={procs:this.procs,dependenciesStack:[]},this.queue=[],this.constructor===e)throw new Error("Spica: Supervisor: Cannot instantiate abstract classes.");this.name=s,void f.reduce(function(e,t){var n=t[0],r=t[1];return void i.deps.set(n,r)},void 0),this.retry=l,this.timeout=h,this.destructor_=m,void++this.constructor.count}return e.prototype.destructor=function(e){for(void this.checkState(),this.alive=!1;this.queue.length>0;){var t=this.queue.shift(),n=t[0],r=t[1];void this.events.loss.emit(n,[n,void 0,r])}try{void this.destructor_(e)}catch(i){void console.error(i)}void--this.constructor.count,void Object.freeze(this)},e.prototype.schedule=function(){var e=this;this.alive&&(this.scheduled||(void i.Tick(function(t){e.alive&&(e.scheduled=!1,void e.drain())}),this.scheduled=!0))},e.prototype.register=function(e,t){if(void this.checkState(),!this.registerable)throw new Error("Spica: Supervisor: Supervisor "+this.name+" cannot register process during the exiting.");return e=u.concat([],e),void this.schedule(),new d(this,this.workerSharedResource,e,t,this.deps.get(e)||[]).terminate},e.prototype.call=function(e,t,n,r){var i=this;void 0===n&&(n=this.timeout),void 0===r&&(r=c.noop),void this.checkState(),e=u.concat([],e),void this.queue.push([e,t,function(e,t){return void r(t,e)},n,Date.now()]),void this.schedule(),n>0!=!1&&void setTimeout(function(){return i.drain(e)},n)},e.prototype.cast=function(e,t,n){void 0===n&&(n=this.retry),void this.checkState();var r=this.procs.reflect(e,new f.Call(t));return 0===r.length&&void this.events.fail.emit(e,[e,void 0,t]),r.length>0||!n?r:this.cast(e,t,!1)},e.prototype.refs=function(e){return void this.checkState(),this.procs.refs(e).map(function(e){var t=(e[0],e[1]),n=t(void 0);return[n.namespace,n.process,n.terminate]})},e.prototype.terminate=function(e,t){void this.checkState(),void 0===e&&(this.registerable=!1),void this.procs.emit(e||[],new f.Exit(t)),void this.procs.off(e||[]),void 0===e&&void this.destructor(t)},e.prototype.checkState=function(){if(!this.alive)throw new Error("Spica: Supervisor: Supervisor "+this.name+" already exited.")},e.prototype.drain=function(e){void 0===e&&(e=[]);for(var t,n=Date.now(),r=function(r){var o=i.queue[r],u=o[0],c=o[1],s=o[2],a=o[3],d=o[4],l=e.every(function(e,t){return e===u[t]})?i.procs.reflect(u,new f.Call(c)):[];if(0===l.length&&void i.events.fail.emit(u,[u,void 0,c]),0===l.length&&n<d+a)return t=r,"continue";if(0===r?void i.queue.shift():void i.queue.splice(r,1),void--r,0===l.length&&void i.events.loss.emit(u,[u,void 0,c]),!s)return t=r,"continue";try{void s(c,l)}catch(p){void console.error(p)}t=r},i=this,o=0;o<this.queue.length;++o){r(o);o=t}},e.count=0,e.procs=0,e}();t.Supervisor=a;var f;!function(e){var t=function(){function e(){}return e}(),n=function(e){function t(t){e.call(this),this.namespace=t}return __extends(t,e),t}(t);e.Deps=n;var r=function(e){function t(t){e.call(this),this.data=t}return __extends(t,e),t}(t);e.Call=r;var i=function(e){function t(t){e.call(this),this.reason=t}return __extends(t,e),t}(t);e.Exit=i}(f||(f={}));var d=function(){function e(t,n,r,i,o){var u=this;this.sv=t,this.sharedResource=n,this.namespace=r,this.process=i,this.dependencies=o,this.alive=!0,this.called=!1,this.concurrency=1,this.receive=function(t){return e.prototype.receive.call(u,t)},this.terminate=function(t){return e.prototype.terminate.call(u,t)},this.sharedResource.allRefsCache=void 0,void++this.sv.constructor.procs,void this.sharedResource.procs.on(r,this.receive)}return e.prototype.destructor=function(e){void this.checkState(),void this.sharedResource.procs.off(this.namespace,this.receive),this.alive=!1,void--this.sv.constructor.procs,this.sharedResource.allRefsCache=void 0,void Object.freeze(this),void this.sv.events.exit.emit(this.namespace,[this.namespace,this.process,e])},e.prototype.tryDependencyResolving=function(e){if(this.receive(new f.Deps(this.namespace)))return void(this.sharedResource.dependenciesStack=[]);throw void(this.sharedResource.dependenciesStack=[])},e.prototype.receive=function(e){var t=this;if(void this.checkState(),void 0===e)return this;if(e instanceof f.Deps){if(e.namespace.length!==this.namespace.length)return!1;if(0===this.concurrency)return!1;for(var n=0,r=this.sharedResource.dependenciesStack;n<r.length;n++){var i=r[n];if(s(this.namespace,i))return!0}return void this.sharedResource.dependenciesStack.push(this.namespace),this.dependencies.every(function(e){return(t.sharedResource.allRefsCache=t.sharedResource.allRefsCache||t.sharedResource.procs.refs([])).some(function(t){var n=t[0],r=t[1];return s(n,e)&&!!r(new f.Deps(e))})})}if(e instanceof f.Call){if(0===this.concurrency)throw void 0;void this.tryDependencyResolving(e),this.called||(this.called=!0,void this.sv.events.exec.emit(this.namespace,[this.namespace,this.process]));try{void--this.concurrency;var u=(0,this.process)(e.data);return o.isThenable(u)?void u.then(function(e){void t.sv.schedule(),t.alive&&void++t.concurrency},function(e){void t.sv.schedule(),t.alive&&(void++t.concurrency,void t.terminate(e))}):void++this.concurrency,u}catch(c){throw void void this.terminate(c)}}if(e instanceof f.Exit)throw void void this.terminate(e.reason);throw new TypeError("Spica: Supervisor: Invalid command: "+e)},e.prototype.terminate=function(e){void this.destructor(e)},e.prototype.checkState=function(){if(!this.alive)throw new Error("Spica: Supervisor: Process "+this.namespace+"/"+this.process+" already exited.")},e}()}),define("src/lib/monad/lazy",["require","exports"],function(e,t){"use strict";var n=function(){function e(e){this.thunk=e}return e.prototype.evaluate=function(){return this.memory_=this.memory_||this.thunk()},e}();t.Lazy=n}),define("src/lib/monad/functor",["require","exports","src/lib/monad/lazy"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t}(n.Lazy);t.Functor=r;var r;!function(e){function t(e,t){return t?e.fmap(t):function(t){return e.fmap(t)}}e.fmap=t}(r=t.Functor||(t.Functor={}))}),define("src/lib/monad/applicative",["require","exports","src/lib/monad/functor"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t}(n.Functor);t.Applicative=r;var r;!function(e){function t(e,t){return t?e.bind(function(e){return t.fmap(function(t){return e(t)})}):function(t){return e.bind(function(e){return t.fmap(function(t){return e(t)})})}}e.ap=t}(r=t.Applicative||(t.Applicative={}))}),define("src/lib/monad/monad",["require","exports","src/lib/monad/applicative"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t}(n.Applicative);t.Monad=r;var r;!function(e){function t(e,t){return t?e.bind(t):function(t){return e.bind(t)}}e.bind=t}(r=t.Monad||(t.Monad={}))}),define("src/lib/monad/monadplus",["require","exports","src/lib/monad/monad"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t}(n.Monad);t.MonadPlus=r;var r;!function(e){}(r=t.MonadPlus||(t.MonadPlus={}))}),define("src/lib/curry",["require","exports"],function(e,t){"use strict";function n(e,t,r){return e.length===t.length?e.apply(r,t):function(){for(var i=[],o=0;o<arguments.length;o++)i[o-0]=arguments[o];return n(e,t.concat(i),r)}}var r=this;t.curry=function(e,t){return void 0===t&&(t=r),0===e.length?function(){return e.call(t)}:n(e,[],t)}}),define("src/lib/monad/maybe.impl",["require","exports","src/lib/monad/monadplus"],function(e,t,n){"use strict";function r(){throw new Error("Spica: Maybe: Invalid thunk call.")}var i=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.fmap=function(e){return this.bind(function(t){return new o(e(t))})},t.prototype.bind=function(e){var n=this;return new t(function(){var r=n.evaluate();if(r instanceof o)return e(r.extract());if(r instanceof u)return r;if(r instanceof t)return r.bind(e);throw new TypeError("Spica: Maybe: Invalid monad value.\n\t"+r)})},t.prototype.extract=function(e){return this.evaluate().extract(e)},t}(n.MonadPlus);t.Maybe=i;var i;!function(e){function t(e){return new o(e)}e.pure=t,e.Return=t}(i=t.Maybe||(t.Maybe={}));var o=function(e){function t(t){e.call(this,r),this.a=t}return __extends(t,e),t.prototype.bind=function(e){var t=this;return new i(function(){return e(t.extract())})},t.prototype.extract=function(e){return this.a},t}(i);t.Just=o;var u=function(e){function t(){e.call(this,r)}return __extends(t,e),t.prototype.bind=function(e){return this},t.prototype.extract=function(e){if(!e)throw void 0;return e()},t}(i);t.Nothing=u;var i;!function(e){function t(t,n){return new e(function(){return t.fmap(function(){return t}).extract(function(){return n})})}e.mzero=new u,e.mplus=t}(i=t.Maybe||(t.Maybe={}))}),define("src/lib/monad/maybe",["require","exports","src/lib/monad/maybe.impl"],function(e,t,n){"use strict";function r(e){return new n.Just(e)}var i;!function(e){e.fmap=n.Maybe.fmap,e.pure=n.Maybe.pure,e.ap=n.Maybe.ap,e.Return=n.Maybe.Return,e.bind=n.Maybe.bind,e.mzero=n.Maybe.mzero,e.mplus=n.Maybe.mplus}(i=t.Maybe||(t.Maybe={})),t.Just=r,t.Nothing=n.Maybe.mzero}),define("src/lib/monad/either.impl",["require","exports","src/lib/monad/monad"],function(e,t,n){"use strict";function r(){throw new Error("Spica: Either: Invalid thunk call.")}var i=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.fmap=function(e){return this.bind(function(t){return new u(e(t))})},t.prototype.bind=function(e){var n=this;return new t(function(){var r=n.evaluate();if(r instanceof o)return r;if(r instanceof u)return e(r.extract());if(r instanceof t)return r.bind(e);throw new TypeError("Spica: Either: Invalid monad value.\n\t"+r)})},t.prototype.extract=function(e){return this.evaluate().extract(e)},t}(n.Monad);t.Either=i;var i;!function(e){function t(e){return new u(e)}e.pure=t,e.Return=t}(i=t.Either||(t.Either={}));var o=function(e){function t(t){e.call(this,r),this.a=t}return __extends(t,e),t.prototype.bind=function(e){return this},t.prototype.extract=function(e){if(!e)throw this.a;return e(this.a)},t}(i);t.Left=o;var u=function(e){function t(t){e.call(this,r),this.b=t}return __extends(t,e),t.prototype.bind=function(e){var t=this;return new i(function(){return e(t.extract())})},t.prototype.extract=function(e){return this.b},t}(i);t.Right=u}),define("src/lib/monad/either",["require","exports","src/lib/monad/either.impl"],function(e,t,n){"use strict";function r(e){return new n.Left(e)}function i(e){return new n.Right(e)}var o;!function(e){e.fmap=n.Either.fmap,e.pure=n.Either.pure,e.ap=n.Either.ap,e.Return=n.Either.Return,e.bind=n.Either.bind}(o=t.Either||(t.Either={})),t.Left=r,t.Right=i}),define("src/lib/cancelable",["require","exports","src/lib/noop","src/lib/monad/maybe","src/lib/monad/either"],function(e,t,n,r,i){"use strict";var o=function(){function e(){var e=this;this.canceled=!1,this.listeners=new Set,this.promise=function(t){return e.canceled?e.promise_=e.promise_||new Promise(function(t,n){return void n(e.reason)}):Promise.resolve(t)},this.maybe=function(t){return e.canceled?r.Nothing:r.Just(t)},this.either=function(t){return e.canceled?i.Left(e.reason):i.Right(t)},this.cancel=function(t){return e.cancel=n.noop,e.canceled=!0,e.reason=t,e.listeners.forEach(function(t){return void t(e.reason)}),void e.listeners.clear()}}return e}();t.Cancelable=o}),define("src/lib/monad/sequence/core",["require","exports","src/lib/monad/monadplus"],function(e,t,n){"use strict";var r=function(e){function t(t,n){e.call(this),this.cons=t,this.memory=n}return __extends(t,e),t}(n.MonadPlus);t.Sequence=r;var r;!function(e){}(r=t.Sequence||(t.Sequence={}));var r;!function(e){function t(e){return r.iterator(e)!==i.done}var n;!function(t){function n(t,n){switch(arguments.length){case 0:return[];case 1:return[t];case 2:return[t,n];default:throw e.Exception.invalidConsError(arguments)}}t.cons=n}(n=e.Data||(e.Data={}));var r;!function(e){function t(e){return e[0]}function n(e){return e[1]}function r(e){return e[2]}e.value=t,e.iterator=n,e.index=r}(r=e.Thunk||(e.Thunk={}));var i;!function(t){function n(t,i,o){return e.isIterable(t)?o(t,function(){return n(r.iterator(t)(),i,o)}):i(t)}t.done=function(){return[void 0,t.done,-1]},t.when=n}(i=e.Iterator||(e.Iterator={})),e.isIterable=t;var o;!function(e){function t(e){return console.error(e,e.length,e[0],e[1]),new TypeError("Spica: Sequence: Invalid parameters of cons.")}function n(e){return console.error(e),new TypeError("Spica: Sequence: Invalid data.")}function r(e){return console.error(e),new TypeError("Spica: Sequence: Invalid thunk.")}e.invalidConsError=t,e.invalidDataError=n,e.invalidThunkError=r}(o=e.Exception||(e.Exception={}))}(r=t.Sequence||(t.Sequence={}))}),define("src/lib/monad/sequence/member/static/from",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.from=function(e){return new n.Sequence(function(t,n){return void 0===t&&(t=0),t<e.length?n(e[t],++t):n()})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/write",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.write=function(e){return new n.Sequence(function(t,n){return e.length>0?n(e.shift(),e):n()})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/cycle",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.cycle=function(e){return new n.Sequence(function(t,n){return void 0===t&&(t=0),0===e.length?n():n(e[t],++t%e.length)})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/random",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.random=function(e){switch(void 0===e&&(e=function(){return Math.random()}),!0){case Array.isArray(e):return this.random().map(function(t){return e[t*e.length|0]});default:return new n.Sequence(function(t,n){return n(e(),NaN)})}},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/concat",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.concat=function(e){return new n.Sequence(function(t,r){var i=void 0===t?[function(){return e.iterate()},n.Sequence.Iterator.done]:t,o=i[0],u=i[1];return n.Sequence.Iterator.when(o(),function(){return r()},function(e,t){return u=u===n.Sequence.Iterator.done?function(){return n.Sequence.Thunk.value(e).iterate()}:u,n.Sequence.Iterator.when(u(),function(){return u=n.Sequence.Iterator.done,t()},function(t){return r(n.Sequence.Thunk.value(t),[function(){return e},n.Sequence.Thunk.iterator(t)])})})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/zip",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.zip=function(e,t){return new n.Sequence(function(r,i){var o=void 0===r?[function(){return e.iterate()},function(){return t.iterate()}]:r,u=o[0],c=o[1];return n.Sequence.Iterator.when(u(),function(){return i()},function(e){return n.Sequence.Iterator.when(c(),function(){return i()},function(t){return i([n.Sequence.Thunk.value(e),n.Sequence.Thunk.value(t)],[n.Sequence.Thunk.iterator(e),n.Sequence.Thunk.iterator(t)])})})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/union",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";function r(e,t,r){return new n.Sequence(function(i,o){var u=void 0===i?[function(){return e.iterate()},function(){return t.iterate()}]:i,c=u[0],s=u[1];return n.Sequence.Iterator.when(c(),function(){return n.Sequence.Iterator.when(s(),function(){return o()},function(e){return o(n.Sequence.Thunk.value(e),[n.Sequence.Iterator.done,n.Sequence.Thunk.iterator(e)])})},function(e){return n.Sequence.Iterator.when(s(),function(){return o(n.Sequence.Thunk.value(e),[n.Sequence.Thunk.iterator(e),n.Sequence.Iterator.done])},function(t){var i=r(n.Sequence.Thunk.value(e),n.Sequence.Thunk.value(t));return i<0?o(n.Sequence.Thunk.value(e),[n.Sequence.Thunk.iterator(e),s]):i>0?o(n.Sequence.Thunk.value(t),[c,n.Sequence.Thunk.iterator(t)]):o(n.Sequence.Thunk.value(e),[n.Sequence.Thunk.iterator(e),n.Sequence.Thunk.iterator(t)])})})})}var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.union=function(e,t){return e.reduce(function(e,n){return r(e,n,t)})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/static/intersect",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";function r(e,t,r){return new n.Sequence(function(i,o){var u=void 0===i?[function(){return e.iterate()},function(){return t.iterate()}]:i,c=u[0],s=u[1];return n.Sequence.Iterator.when(c(),function(){return o()},function(e,t){return n.Sequence.Iterator.when(s(),function(){return o()},function(i,u){var c=r(n.Sequence.Thunk.value(e),n.Sequence.Thunk.value(i));return c<0?(s=function(){return i},t()):c>0?u():o(n.Sequence.Thunk.value(e),[n.Sequence.Thunk.iterator(e),n.Sequence.Thunk.iterator(i)])})})})}var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.intersect=function(e,t){return e.reduce(function(e,n){return r(e,n,t)})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/static/pure",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.pure=function(e){return new n.Sequence(function(t,n){return n(e)})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/return",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.Return=function(e){return new n.Sequence(function(t,n){return n(e)})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/mempty",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.mempty=new n.Sequence(function(e,t){return t()}),t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/mconcat",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";function r(e,t){return new n.Sequence(function(r,i){var o=void 0===r?[function(){return e.iterate()},function(){return t.iterate()}]:r,u=o[0],c=o[1];return n.Sequence.Iterator.when(u(),function(){return n.Sequence.Iterator.when(c(),function(){return i()},function(e){return i(n.Sequence.Thunk.value(e),[n.Sequence.Iterator.done,n.Sequence.Thunk.iterator(e)])})},function(e){return i(n.Sequence.Thunk.value(e),[n.Sequence.Thunk.iterator(e),c])})})}var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.mconcat=function(e){return e.reduce(function(e,t){return r(e,t)},n.Sequence.from([]))},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/static/mappend",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.mappend=function(e,t){return n.Sequence.mconcat([e,t])},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/mzero",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.mzero=n.Sequence.mempty,t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/mplus",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.mplus=n.Sequence.mappend,t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/iterate",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.iterate=function(){return this.iterate_()},t.prototype.iterate_=function(e,t){var r=this;void 0===t&&(t=0);var i=this.memory?this.memory.has(t)?this.memory.get(t):this.memory.set(t,this.cons(e,n.Sequence.Data.cons)).get(t):this.cons(e,n.Sequence.Data.cons);switch(i.length){case 0:return[void 0,n.Sequence.Iterator.done,-1];case 1:return[i[0],function(){return n.Sequence.Iterator.done()},t];case 2:return[i[0],function(){return r.iterate_(i[1],t+1)},t];default:throw n.Sequence.Exception.invalidDataError(i)}},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/memoize",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.memoize=function(e){return void 0===e&&(e=this.memory||new Map),new n.Sequence(this.cons,this.memory||e)},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/read",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,t,n,r){"use strict";var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.read=function(){for(var e=this,t=[],i=function(){return e.iterate()};;){var o=i();if(!n.Sequence.isIterable(o))return t;void r.concat(t,[n.Sequence.Thunk.value(o)]),i=n.Sequence.Thunk.iterator(o)}},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/instance/take",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.take=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(e>0?r():n.Sequence.Iterator.done(),function(){return i()},function(t){return n.Sequence.Thunk.index(t)+1<e?i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t)):i(n.Sequence.Thunk.value(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/drop",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.drop=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t,r){return n.Sequence.Thunk.index(t)<e?r():i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/takeWhile",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.takeWhile=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t){return e(n.Sequence.Thunk.value(t))?i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t)):i()})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/dropWhile",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.dropWhile=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t,r){return e(n.Sequence.Thunk.value(t))?r():i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t)); | ||
})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/takeUntil",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.takeUntil=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t){return e(n.Sequence.Thunk.value(t))?i(n.Sequence.Thunk.value(t)):i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/dropUntil",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.dropUntil=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t,r){return e(n.Sequence.Thunk.value(t))?r():i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/fmap",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.fmap=function(e){var t=this;return new n.Sequence(function(r){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return n.Sequence.Data.cons()},function(t){return n.Sequence.Data.cons(e(n.Sequence.Thunk.value(t)),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/bind",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.bind=function(e){return n.Sequence.concat(this.fmap(e))},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/mapM",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,t,n,r){"use strict";var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.mapM=function(e){var t=this;return this.take(1).bind(function(){var i=t.read();switch(i.length){case 0:return n.Sequence.from([]);default:var o=i.shift();return e(o).bind(function(t){return 0===i.length?n.Sequence.from([[t]]):n.Sequence.from(i).mapM(e).fmap(function(e){return r.concat([t],e)})})}})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/instance/filterM",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,t,n,r){"use strict";var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.filterM=function(e){var t=this;return this.take(1).bind(function(){var i=t.read();switch(i.length){case 0:return n.Sequence.from([[]]);default:var o=i.shift();return e(o).bind(function(t){return t?0===i.length?n.Sequence.from([[o]]):n.Sequence.from(i).filterM(e).fmap(function(e){return r.concat([o],e)}):0===i.length?n.Sequence.from([[]]):n.Sequence.from(i).filterM(e)})}})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/instance/map",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.map=function(e){var t=this;return new n.Sequence(function(r){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return n.Sequence.Data.cons()},function(t){return n.Sequence.Data.cons(e(n.Sequence.Thunk.value(t),n.Sequence.Thunk.index(t)),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/filter",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.filter=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t,r){return e(n.Sequence.Thunk.value(t),n.Sequence.Thunk.index(t))?i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t)):r()})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/scan",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.scan=function(e,t){var r=this;return new n.Sequence(function(i){var o=void 0===i?[void 0,void 0,void 0]:i,u=o[0],c=void 0===u?t:u,s=o[1],a=void 0===s?function(){return r.iterate()}:s,f=o[2],d=void 0===f?0:f;return n.Sequence.Iterator.when(a(),function(e){return 0===d?n.Sequence.Data.cons(t):n.Sequence.Data.cons()},function(t){return n.Sequence.Data.cons(c=e(c,n.Sequence.Thunk.value(t)),[c,n.Sequence.Thunk.iterator(t),n.Sequence.Thunk.index(t)+1])})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/assign",["require","exports","src/lib/type"],function(e,t,n){"use strict";function r(e){return function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if(void 0===t||null===t)throw new TypeError("Spica: assign: Cannot walk on "+t+".");for(var i=0,o=n;i<o.length;i++){var u=o[i];if(void 0!==u&&null!==u)for(var c=0,s=Object.keys(Object(u));c<s.length;c++){var a=s[c],f=Object.getOwnPropertyDescriptor(Object(u),a);void 0!==f&&f.enumerable&&void e(a,Object(t),Object(u))}}return Object(t)}}t.assign=r(function(e,t,n){return t[e]=n[e]}),t.clone=r(function(e,r,i){switch(n.type(i[e])){case"Array":return r[e]=t.clone([],i[e]);case"Function":case"Object":return r[e]=t.clone({},i[e]);default:return r[e]=i[e]}}),t.extend=r(function(e,r,i){switch(n.type(i[e])){case"Array":return r[e]=t.extend([],i[e]);case"Function":case"Object":switch(n.type(r[e])){case"Function":case"Object":return r[e]=t.extend(r[e],i[e]);default:return r[e]=t.extend({},i[e])}default:return r[e]=i[e]}})}),define("src/lib/compose",["require","exports","src/lib/assign","src/lib/concat"],function(e,t,n,r){"use strict";function i(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return r.concat([e],t).reduce(function(e,t){void n.assign(e.prototype,t.prototype);for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e})}t.compose=i}),define("src/lib/monad/sequence",["require","exports","src/lib/monad/sequence/core","src/lib/monad/sequence/member/static/from","src/lib/monad/sequence/member/static/write","src/lib/monad/sequence/member/static/cycle","src/lib/monad/sequence/member/static/random","src/lib/monad/sequence/member/static/concat","src/lib/monad/sequence/member/static/zip","src/lib/monad/sequence/member/static/union","src/lib/monad/sequence/member/static/intersect","src/lib/monad/sequence/member/static/pure","src/lib/monad/sequence/member/static/return","src/lib/monad/sequence/member/static/mempty","src/lib/monad/sequence/member/static/mconcat","src/lib/monad/sequence/member/static/mappend","src/lib/monad/sequence/member/static/mzero","src/lib/monad/sequence/member/static/mplus","src/lib/monad/sequence/member/instance/iterate","src/lib/monad/sequence/member/instance/memoize","src/lib/monad/sequence/member/instance/read","src/lib/monad/sequence/member/instance/take","src/lib/monad/sequence/member/instance/drop","src/lib/monad/sequence/member/instance/takeWhile","src/lib/monad/sequence/member/instance/dropWhile","src/lib/monad/sequence/member/instance/takeUntil","src/lib/monad/sequence/member/instance/dropUntil","src/lib/monad/sequence/member/instance/fmap","src/lib/monad/sequence/member/instance/bind","src/lib/monad/sequence/member/instance/mapM","src/lib/monad/sequence/member/instance/filterM","src/lib/monad/sequence/member/instance/map","src/lib/monad/sequence/member/instance/filter","src/lib/monad/sequence/member/instance/scan","src/lib/compose"],function(e,t,n,r,i,o,u,c,s,a,f,d,l,p,h,v,m,b,q,y,S,x,_,w,g,k,M,T,O,I,j,E,P,R,N){"use strict";t.Sequence=n.Sequence,N.compose(n.Sequence,r["default"],i["default"],o["default"],u["default"],c["default"],s["default"],a["default"],f["default"],d["default"],l["default"],p["default"],h["default"],v["default"],m["default"],b["default"],q["default"],y["default"],S["default"],x["default"],_["default"],w["default"],g["default"],k["default"],M["default"],T["default"],O["default"],I["default"],j["default"],E["default"],P["default"],R["default"])}),define("src/lib/flip",["require","exports","src/lib/curry"],function(e,t,n){"use strict";function r(e){return n.curry(function(t,n){return e.length>1?e(n,t):e(n)(t)})}t.flip=r}),define("src/lib/list",["require","exports","src/lib/concat"],function(e,t,n){"use strict";var r=function(){function e(){}return e.prototype.push=function(e){return new i(e,this)},e}();t.Nil=r;var i=function(){function e(e,t){this.head_=e,this.tail_=t}return e.prototype.push=function(t){return new e(t,this)},e.prototype.head=function(){return this.head_},e.prototype.tail=function(){return this.tail_},e.prototype.walk=function(e){return void e(this.head()),this.tail()},e.prototype.modify=function(e){return this.tail().push(e(this.head()))},e.prototype.extend=function(e){return this.push(e(this.head()))},e.prototype.array=function(){return n.concat([this.head()],this.tail().array?this.tail().array():[])},e}()}),define("src/lib/hlist",["require","exports"],function(e,t){"use strict";var n=function(){function e(){}return e.prototype.push=function(e){return new r(e,this)},e}();t.HNil=n;var r=function(){function e(e,t){this.head_=e,this.tail_=t}return e.prototype.push=function(t){return new e(t,this)},e.prototype.head=function(){return this.head_},e.prototype.tail=function(){return this.tail_},e.prototype.walk=function(e){return void e(this.head()),this.tail()},e.prototype.modify=function(e){return this.tail().push(e(this.head()))},e.prototype.extend=function(e){return this.push(e(this.head()))},e}()}),define("src/lib/collection/attrmap",["require","exports"],function(e,t){"use strict";var n=function(){function e(){this.store=new WeakMap}return e.prototype.get=function(e,t){return this.store.get(e)&&this.store.get(e).get(t)},e.prototype.set=function(e,t,n){var r=this.store.has(e)?this.store.get(e):this.store.set(e,new Map).get(e);return void r.set(t,n),this},e.prototype.has=function(e,t){return this.store.has(e)&&this.store.get(e).has(t)},e.prototype["delete"]=function(e,t){return void 0===t?this.store["delete"](e):!!this.store.has(e)&&this.store.get(e)["delete"](t)},e}();t.AttrMap=n}),define("src/lib/collection/relationmap",["require","exports"],function(e,t){"use strict";var n=function(){function e(){this.store=new WeakMap}return e.prototype.get=function(e,t){return this.store.get(e)&&this.store.get(e).get(t)},e.prototype.set=function(e,t,n){var r=this.store.has(e)?this.store.get(e):this.store.set(e,new WeakMap).get(e);return void r.set(t,n),this},e.prototype.has=function(e,t){return this.store.has(e)&&this.store.get(e).has(t)},e.prototype["delete"]=function(e,t){return void 0===t?this.store["delete"](e):!!this.store.has(e)&&this.store.get(e)["delete"](t)},e}();t.RelationMap=n}),define("src/lib/mixin",["require","exports","src/lib/assign"],function(e,t,n){"use strict";function r(){for(var e=[],t=0;t<arguments.length;t++)e[t-0]=arguments[t];return e.reduceRight(function(e,t){return i(t,e)},function(){function e(){}return e}())}function i(e,t){var r=function(){function n(){return e.apply(t.apply(this,arguments)||this,arguments)}return n}();void n.assign(r.prototype,e.prototype,t.prototype);for(var i in t)t.hasOwnProperty(i)&&(r[i]=t[i]);for(var i in e)e.hasOwnProperty(i)&&(r[i]=e[i]);return r}t.Mixin=r}),define("src/lib/fingerprint",["require","exports"],function(e,t){"use strict";function n(){return i(o([u(window.navigator),u(window.screen),u((new Date).getTimezoneOffset())].join()))}function r(){return i(o([u(process)].join()))}function i(e){return e.split("").reduce(function(e,t,n){return(+t*n+e)%1e9||e-+t},0)}function o(e){return e.split("").map(function(e){return e.charCodeAt(0)}).join("")}function u(e,t){if(void 0===t&&(t=5),t>0&&e&&"object"==typeof e){var n="{";for(var r in e)n+='"'+r+'": '+u(e[r],t-1)+",";return n+="}"}return!e||e.toString?'"'+e+'"':'"'+Object.prototype.toString.call(e)+'"'}t.FINGERPRINT="object"==typeof window?n():r(),t.browser=n,t.server=r,t.hash=i,t.str2digit=o,t.stringify=u}),define("src/lib/uuid",["require","exports","src/lib/fingerprint"],function(e,t,n){"use strict";function r(){var e=u=u*Date.now()%1e15;if(e<16||1e15<e)throw new Error("Spica: uuid: Invalid uuid dynamic seed.");for(var t="",n=0,r=o;n<r.length;n++){var i=r[n];if("x"===i||"y"===i){var c=Math.random()*e%16|0,s="x"==i?c:3&c|8;t+=s.toString(16)}else t+=i}return t.toLowerCase()}var i=n.FINGERPRINT*Date.now()%1e15;if(!i||"number"!=typeof i||i<100||1e15<i)throw new Error("Spica: uuid: Invalid uuid static seed.\n\t"+n.FINGERPRINT);var o=Object.freeze("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split("")),u=i;t.v4=r}),define("src/lib/sort",["require","exports"],function(e,t){"use strict";function n(e,t,n,r){if(void 0===r&&(r=!1),!r&&n*n>1.25*e.length)return e.sort(t);n=n<e.length-1?n:e.length-1;for(var i=0;i<n;++i)for(var o=i+1;o<e.length;++o)if(t(e[i],e[o])>0!=!1){var u=e[i];e[i]=e[o],e[o]=u}return e}t.sort=n}),define("src/export",["require","exports","src/lib/supervisor","src/lib/observable","src/lib/cancelable","src/lib/monad/sequence","src/lib/monad/maybe","src/lib/monad/either","src/lib/curry","src/lib/flip","src/lib/list","src/lib/hlist","src/lib/collection/datamap","src/lib/collection/attrmap","src/lib/collection/relationmap","src/lib/mixin","src/lib/tick","src/lib/fingerprint","src/lib/uuid","src/lib/sqid","src/lib/assign","src/lib/concat","src/lib/sort"],function(e,t,n,r,i,o,u,c,s,a,f,d,l,p,h,v,m,b,q,y,S,x,_){"use strict";t.Supervisor=n.Supervisor,t.Observable=r.Observable,t.Cancelable=i.Cancelable,t.Sequence=o.Sequence,t.Maybe=u.Maybe,t.Just=u.Just,t.Nothing=u.Nothing,t.Either=c.Either,t.Left=c.Left,t.Right=c.Right,t.curry=s.curry,t.flip=a.flip,t.Nil=f.Nil,t.HNil=d.HNil,t.DataMap=l.DataMap,t.AttrMap=p.AttrMap,t.RelationMap=h.RelationMap,t.Mixin=v.Mixin,t.Tick=m.Tick,t.FINGERPRINT=b.FINGERPRINT,t.uuid=q.v4,t.sqid=y.sqid,t.assign=S.assign,t.clone=S.clone,t.extend=S.extend,t.concat=x.concat,t.sort=_.sort}),define("spica",["require","exports","src/export"],function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}r(n)}); |
{ | ||
"name": "spica", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "Supervisor, Observable, Sequence, Maybe, Either and some utils.", | ||
@@ -5,0 +5,0 @@ "private": false, |
@@ -20,4 +20,4 @@ import {MonadPlus} from '../monadplus'; | ||
export declare function zip<a, b>(a: Sequence<a, any>, b: Sequence<b, any>): Sequence<[a, b], [Sequence.Iterator<a>, Sequence.Iterator<b>]>; | ||
export declare function union<a>(cmp: (l: a, r: a) => number, as: Sequence<a, any>[]): Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]>; | ||
export declare function intersect<a>(cmp: (l: a, r: a) => number, as: Sequence<a, any>[]): Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]>; | ||
export declare function union<a>(as: Sequence<a, any>[], cmp: (l: a, r: a) => number): Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]>; | ||
export declare function intersect<a>(as: Sequence<a, any>[], cmp: (l: a, r: a) => number): Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]>; | ||
export declare function fmap<a, b>(m: Sequence<a, any>, f: (a: a) => b): Sequence<b, Sequence.Iterator<a>>; | ||
@@ -47,3 +47,3 @@ export declare function fmap<a>(m: Sequence<a, any>): <b>(f: (a: a) => b) => Sequence<b, Sequence.Iterator<a>>; | ||
filter(f: (a: a, i: number) => boolean): Sequence<a, Sequence.Iterator<a>>; | ||
scan<b>(f: (b: b, a: a) => b, z: b): Sequence<b, [b, Sequence.Iterator<a>]>; | ||
scan<b>(f: (b: b, a: a) => b, z: b): Sequence<b, [b, Sequence.Iterator<a>, number]>; | ||
take(n: number): Sequence<a, Sequence.Iterator<a>>; | ||
@@ -50,0 +50,0 @@ drop(n: number): Sequence<a, Sequence.Iterator<a>>; |
@@ -5,2 +5,10 @@ import {Sequence} from '../../../sequence'; | ||
describe('scan', () => { | ||
it('empty', () => { | ||
assert.deepStrictEqual( | ||
Sequence.from([]) | ||
.scan((a, b) => a + b, '') | ||
.read(), | ||
['']); | ||
}); | ||
it('0', () => { | ||
@@ -42,4 +50,13 @@ assert.deepStrictEqual( | ||
it('4', () => { | ||
assert.deepStrictEqual( | ||
Sequence.from('abc'.split('')) | ||
.scan((a, b) => a + b, '') | ||
.take(4) | ||
.read(), | ||
['a', 'ab', 'abc']); | ||
}); | ||
}); | ||
}); |
import {Sequence} from '../../core'; | ||
export default class <a, z> extends Sequence<a, z> { | ||
public scan<b>(f: (b: b, a: a) => b, z: b): Sequence<b, [b, Sequence.Iterator<a>]> { | ||
return new Sequence<b, [b, Sequence.Iterator<a>]>(([prev = z, iter = () => this.iterate()] = [void 0, void 0]) => | ||
public scan<b>(f: (b: b, a: a) => b, z: b): Sequence<b, [b, Sequence.Iterator<a>, number]> { | ||
return new Sequence<b, [b, Sequence.Iterator<a>, number]>(([prev = z, iter = () => this.iterate(), i = 0] = [void 0, void 0, void 0]) => | ||
Sequence.Iterator.when( | ||
iter(), | ||
() => Sequence.Data.cons<b, [b, Sequence.Iterator<a>]>(), | ||
thunk => | ||
Sequence.Data.cons<b, [b, Sequence.Iterator<a>]>( | ||
i === 0 | ||
? Sequence.Data.cons<b, [b, Sequence.Iterator<a>, number]>(z) | ||
: Sequence.Data.cons<b, [b, Sequence.Iterator<a>, number]>(), | ||
thunk => | ||
Sequence.Data.cons<b, [b, Sequence.Iterator<a>, number]>( | ||
prev = f(prev, Sequence.Thunk.value(thunk)), | ||
[prev, Sequence.Thunk.iterator(thunk)]))); | ||
[prev, Sequence.Thunk.iterator(thunk), Sequence.Thunk.index(thunk) + 1]))); | ||
} | ||
} |
@@ -11,6 +11,6 @@ import {Sequence} from '../../../sequence'; | ||
assert.deepStrictEqual( | ||
Sequence.intersect((a, b) => a - b, [double, triple]).take(3).read(), | ||
Sequence.intersect([double, triple], (a, b) => a - b).take(3).read(), | ||
[0, 6, 12]); | ||
assert.deepStrictEqual( | ||
Sequence.intersect((a, b) => b - a, [double.map(n => -n), triple.map(n => -n)]).take(3).read(), | ||
Sequence.intersect([double.map(n => -n), triple.map(n => -n)], (a, b) => b - a).take(3).read(), | ||
[0, 6, 12].map(n => -n)); | ||
@@ -21,6 +21,6 @@ }); | ||
assert.deepStrictEqual( | ||
Sequence.intersect((a, b) => a - b, [double, triple]).take(3).read(), | ||
Sequence.intersect([double, triple], (a, b) => a - b).take(3).read(), | ||
[0, 6, 12]); | ||
assert.deepStrictEqual( | ||
Sequence.intersect((a, b) => b - a, [double.map(n => -n), triple.map(n => -n)]).take(3).read(), | ||
Sequence.intersect([double.map(n => -n), triple.map(n => -n)], (a, b) => b - a).take(3).read(), | ||
[0, 6, 12].map(n => -n)); | ||
@@ -31,6 +31,6 @@ }); | ||
assert.deepStrictEqual( | ||
Sequence.intersect((a, b) => a - b, [double.dropWhile(n => n < 6).takeUntil(n => n === 12), triple]).take(2).read(), | ||
Sequence.intersect([double.dropWhile(n => n < 6).takeUntil(n => n === 12), triple], (a, b) => a - b).take(2).read(), | ||
[6, 12]); | ||
assert.deepStrictEqual( | ||
Sequence.intersect((a, b) => a - b, [triple, double.dropWhile(n => n < 6).takeUntil(n => n === 12)]).take(2).read(), | ||
Sequence.intersect([triple, double.dropWhile(n => n < 6).takeUntil(n => n === 12)], (a, b) => a - b).take(2).read(), | ||
[6, 12]); | ||
@@ -41,9 +41,9 @@ }); | ||
assert.deepStrictEqual( | ||
Sequence.intersect((a, b) => a - b, [nat, Sequence.from([])]).take(3).read(), | ||
Sequence.intersect([nat, Sequence.from([])], (a, b) => a - b).take(3).read(), | ||
[]); | ||
assert.deepStrictEqual( | ||
Sequence.intersect((a, b) => a - b, [Sequence.from([]), nat]).take(3).read(), | ||
Sequence.intersect([Sequence.from([]), nat], (a, b) => a - b).take(3).read(), | ||
[]); | ||
assert.deepStrictEqual( | ||
Sequence.intersect((a, b) => a - b, [Sequence.from([]), Sequence.from([])]).take(3).read(), | ||
Sequence.intersect([Sequence.from([]), Sequence.from([])], (a, b) => a - b).take(3).read(), | ||
[]); | ||
@@ -54,7 +54,7 @@ }); | ||
assert.deepStrictEqual( | ||
Sequence.intersect((a, b) => a - b, [ | ||
Sequence.intersect([ | ||
new Sequence<number, number>((n = 0, cons) => cons(n, n + 2)), | ||
new Sequence<number, number>((n = 0, cons) => cons(n, n + 3)), | ||
new Sequence<number, number>((n = 0, cons) => cons(n, n + 5)) | ||
]) | ||
], (a, b) => a - b) | ||
.take(3).read(), | ||
@@ -61,0 +61,0 @@ [0, 30, 60]); |
import {Sequence} from '../../core'; | ||
export default class <a, z> extends Sequence<a, z> { | ||
public static intersect<a>(cmp: (l: a, r: a) => number, as: Sequence<a, any>[]): Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]> { | ||
return as.reduce((a, b) => intersect(cmp, a, b)); | ||
public static intersect<a>(as: Sequence<a, any>[], cmp: (l: a, r: a) => number): Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]> { | ||
return as.reduce((a, b) => intersect(a, b, cmp)); | ||
} | ||
} | ||
function intersect<a>(cmp: (l: a, r: a) => number, a: Sequence<a, any>, b: Sequence<a, any>): Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]> { | ||
function intersect<a>(a: Sequence<a, any>, b: Sequence<a, any>, cmp: (l: a, r: a) => number): Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]> { | ||
return new Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]>(([ai, bi] = [() => a.iterate(), () => b.iterate()], cons) => | ||
@@ -11,0 +11,0 @@ Sequence.Iterator.when( |
@@ -11,6 +11,6 @@ import {Sequence} from '../../../sequence'; | ||
assert.deepStrictEqual( | ||
Sequence.union((a, b) => a - b, [double, triple]).take(7).read(), | ||
Sequence.union([double, triple], (a, b) => a - b).take(7).read(), | ||
[0, 2, 3, 4, 6, 8, 9]); | ||
assert.deepStrictEqual( | ||
Sequence.union((a, b) => b - a, [double.map(n => -n), triple.map(n => -n)]).take(7).read(), | ||
Sequence.union([double.map(n => -n), triple.map(n => -n)], (a, b) => b - a).take(7).read(), | ||
[0, 2, 3, 4, 6, 8, 9].map(n => -n)); | ||
@@ -21,6 +21,6 @@ }); | ||
assert.deepStrictEqual( | ||
Sequence.union((a, b) => a - b, [double, triple]).take(7).read(), | ||
Sequence.union([double, triple], (a, b) => a - b).take(7).read(), | ||
[0, 2, 3, 4, 6, 8, 9]); | ||
assert.deepStrictEqual( | ||
Sequence.union((a, b) => b - a, [double.map(n => -n), triple.map(n => -n)]).take(7).read(), | ||
Sequence.union([double.map(n => -n), triple.map(n => -n)], (a, b) => b - a).take(7).read(), | ||
[0, 2, 3, 4, 6, 8, 9].map(n => -n)); | ||
@@ -31,6 +31,6 @@ }); | ||
assert.deepStrictEqual( | ||
Sequence.union((a, b) => a - b, [double.dropWhile(n => n < 6).takeUntil(n => n === 12), triple]).take(8).read(), | ||
Sequence.union([double.dropWhile(n => n < 6).takeUntil(n => n === 12), triple], (a, b) => a - b).take(8).read(), | ||
[0, 3, 6, 8, 9, 10, 12, 15]); | ||
assert.deepStrictEqual( | ||
Sequence.union((a, b) => a - b, [triple, double.dropWhile(n => n < 6).takeUntil(n => n === 12)]).take(8).read(), | ||
Sequence.union([triple, double.dropWhile(n => n < 6).takeUntil(n => n === 12)], (a, b) => a - b).take(8).read(), | ||
[0, 3, 6, 8, 9, 10, 12, 15]); | ||
@@ -41,9 +41,9 @@ }); | ||
assert.deepStrictEqual( | ||
Sequence.union((a, b) => a - b, [nat, Sequence.from([])]).take(3).read(), | ||
Sequence.union([nat, Sequence.from([])], (a, b) => a - b).take(3).read(), | ||
[0, 1, 2]); | ||
assert.deepStrictEqual( | ||
Sequence.union((a, b) => a - b, [Sequence.from([]), nat]).take(3).read(), | ||
Sequence.union([Sequence.from([]), nat], (a, b) => a - b).take(3).read(), | ||
[0, 1, 2]); | ||
assert.deepStrictEqual( | ||
Sequence.union((a, b) => a - b, [Sequence.from([]), Sequence.from([])]).take(3).read(), | ||
Sequence.union([Sequence.from([]), Sequence.from([])], (a, b) => a - b).take(3).read(), | ||
[]); | ||
@@ -54,7 +54,7 @@ }); | ||
assert.deepStrictEqual( | ||
Sequence.union((a, b) => a - b, [ | ||
Sequence.union([ | ||
new Sequence<number, number>((n = 0, cons) => cons(n, n + 2)), | ||
new Sequence<number, number>((n = 0, cons) => cons(n, n + 3)), | ||
new Sequence<number, number>((n = 0, cons) => cons(n, n + 5)) | ||
]) | ||
], (a, b) => a - b) | ||
.take(9).read(), | ||
@@ -61,0 +61,0 @@ [0, 2, 3, 4, 5, 6, 8, 9, 10]); |
import {Sequence} from '../../core'; | ||
export default class <a, z> extends Sequence<a, z> { | ||
public static union<a>(cmp: (a: a, b: a) => number, as: Sequence<a, any>[]): Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]> { | ||
return as.reduce((a, b) => union(cmp, a, b)); | ||
public static union<a>(as: Sequence<a, any>[], cmp: (a: a, b: a) => number): Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]> { | ||
return as.reduce((a, b) => union(a, b, cmp)); | ||
} | ||
} | ||
function union<a>(cmp: (a: a, b: a) => number, a: Sequence<a, any>, b: Sequence<a, any>): Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]> { | ||
function union<a>(a: Sequence<a, any>, b: Sequence<a, any>, cmp: (a: a, b: a) => number): Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]> { | ||
return new Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]>(([ai, bi] = [() => a.iterate(), () => b.iterate()], cons) => | ||
@@ -11,0 +11,0 @@ Sequence.Iterator.when( |
@@ -117,4 +117,4 @@ /** | ||
static concat<a>(as: Sequence<Sequence<a, any>, any>): Sequence<a, [Sequence.Iterator<Sequence<a, any>>, Sequence.Iterator<a>]>; | ||
static union<a>(cmp: (l: a, r: a) => number, as: Sequence<a, any>[]): Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]>; | ||
static intersect<a>(cmp: (l: a, r: a) => number, as: Sequence<a, any>[]): Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]>; | ||
static union<a>(as: Sequence<a, any>[], cmp: (l: a, r: a) => number): Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]>; | ||
static intersect<a>(as: Sequence<a, any>[], cmp: (l: a, r: a) => number): Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]>; | ||
static fmap<a, b>(m: Sequence<a, any>, f: (a: a) => b): Sequence<b, Sequence.Iterator<a>>; | ||
@@ -143,3 +143,3 @@ static fmap<a>(m: Sequence<a, any>): <b>(f: (a: a) => b) => Sequence<b, Sequence.Iterator<a>>; | ||
filter(f: (a: a, i: number) => boolean): Sequence<a, Sequence.Iterator<a>>; | ||
scan<b>(f: (b: b, a: a) => b, z: b): Sequence<b, [b, Sequence.Iterator<a>]>; | ||
scan<b>(f: (b: b, a: a) => b, z: b): Sequence<b, [b, Sequence.Iterator<a>, number]>; | ||
take(n: number): Sequence<a, Sequence.Iterator<a>>; | ||
@@ -146,0 +146,0 @@ drop(n: number): Sequence<a, Sequence.Iterator<a>>; |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
353875
9248