Comparing version 0.0.24 to 0.0.25
@@ -1,3 +0,3 @@ | ||
/*! spica v0.0.24 https://github.com/falsandtru/spica | (c) 2016, falsandtru | MIT License */ | ||
/*! spica v0.0.25 https://github.com/falsandtru/spica | (c) 2016, falsandtru | MIT License */ | ||
define="function"==typeof define&&define.amd?define:function(){"use strict";var e="spica",n={};return function t(r,i,u){return u?void u.apply(this,i.map(function(e){switch(e){case"require":return"function"==typeof require?require:void 0;case"exports":return r.indexOf("/")===-1?n[r]="undefined"==typeof exports?self[r]=self[r]||{}:exports:n[r]=n.hasOwnProperty(r)?n[r]:{};default:return".d"===e.slice(-2)&&{}||n.hasOwnProperty(e)&&n[e]||"function"==typeof require&&require(e)||self[e]}})):void t(e,r,i)}}();var __extends=this&&this.__extends||function(e,n){function t(){this.constructor=e}for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r]);e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)};define("src/lib/concat",["require","exports"],function(e,n){"use strict";function t(e,n){for(var t=0,r=n.length,i=e.length;t<r;++t)e[t+i]=n[t];return e}n.concat=t}),define("src/lib/observable",["require","exports","src/lib/concat"],function(e,n,t){"use strict";var r=function(){function e(){this.node_={parent:void 0,childrenMap:Object.create(null),childrenList:[],registers:[]}}return e.prototype.monitor=function(e,n,t){var r=this;return void 0===t&&(t=n),void this.throwTypeErrorIfInvalidSubscriber_(n,e),void this.seekNode_(e).registers.push([e,t,!0,n]),function(){return r.off(e,t)}},e.prototype.on=function(e,n,t){var r=this;return void 0===t&&(t=n),void this.throwTypeErrorIfInvalidSubscriber_(n,e),void this.seekNode_(e).registers.push([e,t,!1,function(e){return n(e)}]),function(){return r.off(e,t)}},e.prototype.off=function(e,n){switch(typeof n){case"function":return void this.seekNode_(e).registers.some(function(e,t,r){var i=e[1];if(n!==i)return!1;switch(t){case 0:return!void r.shift();case r.length-1:return!void r.pop();default:return!void r.splice(t,1)}});case"undefined":var t=this.seekNode_(e);return t.childrenMap=Object.create(null),t.childrenList=[],void(t.registers=[]);default:throw this.throwTypeErrorIfInvalidSubscriber_(n,e)}},e.prototype.once=function(e,n){var t=this;return void this.throwTypeErrorIfInvalidSubscriber_(n,e),this.on(e,function(r){return void t.off(e,n),n(r)},n)},e.prototype.emit=function(e,n,t){void this.drain_(e,n,t)},e.prototype.reflect=function(e,n){var t;return void this.emit(e,n,function(e,n){return t=n}),t},e.prototype.drain_=function(e,n,t){var r=[];if(void this.refsBelow_(this.seekNode_(e)).reduce(function(e,i){var u=i[2],o=i[3];if(!u)try{var c=o(n);t&&(r[r.length]=c)}catch(e){void 0!==e&&null!==e&&void console.error(e+"")}},void 0),void this.refsAbove_(this.seekNode_(e)).reduce(function(e,t){var r=t[2],i=t[3];if(r)try{void i(n)}catch(e){void 0!==e&&null!==e&&void console.error(e)}},void 0),t)try{void t(n,r)}catch(e){void console.error(e)}},e.prototype.refs=function(e){return this.refsBelow_(this.seekNode_(e))},e.prototype.refsAbove_=function(e){var n=e.parent,r=e.registers;for(r=t.concat([],r);n;)r=t.concat(r,n.registers),n=n.parent;return r},e.prototype.refsBelow_=function(e){var n=e.childrenList,r=e.childrenMap,i=e.registers;i=t.concat([],i);for(var u=0;u<n.length;++u){var o=n[u],c=this.refsBelow_(r[o]);i=t.concat(i,c),0===c.length&&(void delete r[o],void n.splice(n.indexOf(o),1),void--u)}return i},e.prototype.seekNode_=function(e){for(var n=this.node_,t=0,r=e;t<r.length;t++){var i=r[t],u=n.childrenMap;u[i+""]||(void n.childrenList.push(i+""),n.childrenList=n.childrenList.sort(),u[i+""]={parent:n,childrenMap:Object.create(null),childrenList:[],registers:[]}),n=u[i+""]}return n},e.prototype.throwTypeErrorIfInvalidSubscriber_=function(e,n){switch(typeof e){case"function":return;default:throw new TypeError("Spica: Observable: Invalid subscriber.\n\t"+e)}},e}();n.Observable=r}),define("src/lib/sqid",["require","exports"],function(e,n){"use strict";function t(e){return void 0===e?(1e15+ ++r+"").slice(1):(1e15+e+"").slice(1)}var r=0;n.sqid=t}),define("src/lib/type",["require","exports"],function(e,n){"use strict";function t(e){return Object.prototype.toString.call(e).split(" ").pop().slice(0,-1)}n.type=t}),define("src/lib/collection/datamap",["require","exports","src/lib/sqid","src/lib/type"],function(e,n,t,r){"use strict";function i(e){return e instanceof Object==!1}var u=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,t.sqid()))+" }"}},e.prototype.stringifyArray=function(e){for(var n="",t=0,r=e;t<r.length;t++){var i=r[t];n+=""+this.stringify(i)}return n},e.prototype.stringifyObject=function(e){if("Object"!==r.type(e))return"";for(var n=Object.keys(e),t="",i=0,u=n;i<u.length;i++){var o=u[i];t+=this.stringify(o)+": "+this.stringify(e[o])}return t||" "},e.prototype.get=function(e){return(this.store.get(this.stringify(e))||[])[1]},e.prototype.set=function(e,n){return void this.store.set(this.stringify(e),[e,n]),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}();n.DataMap=u}),define("src/lib/tick",["require","exports"],function(e,n){"use strict";var t;!function(e){function n(e){void i.push(e),void r()}function t(){void r(),void--u;for(var e=i.length;e-- >0;)void i.shift()()}function r(){if(0!==i.length)for(;u<o.length;)void setTimeout(t,o[u%o.length]),void++u}e.queue=n;var i=[],u=0,o=[0,4,10,20,25].reverse()}(t||(t={}));var r=Function("return typeof process === 'object' && typeof window !== 'object'")();n.Tick=r?Function("return fn => process.nextTick(fn)")():t.queue}),define("src/lib/thenable",["require","exports"],function(e,n){"use strict";function t(e){return!!e&&"object"==typeof e&&void 0!==e.then}n.isThenable=t}),define("src/lib/noop",["require","exports"],function(e,n){"use strict";function t(){}n.noop=t}),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,n,t,r,i,u,o,c){"use strict";function s(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(var t=0;t<e.length;++t)if(e[t]!==n[t])return!1;return!0}var a=function(){function e(n){var i=this,u=void 0===n?{}:n,o=u.name,s=void 0===o?"":o,a=u.dependencies,f=void 0===a?[]:a,d=u.retry,l=void 0!==d&&d,p=u.timeout,h=void 0===p?0:p,v=u.destructor,m=void 0===v?c.noop:v;if(this.deps=new r.DataMap,this.events={exec:new t.Observable,fail:new t.Observable,loss:new t.Observable,exit:new t.Observable},this.procs=new t.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,n){var t=n[0],r=n[1];return void i.deps.set(t,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 n=this.queue.shift(),t=n[0],r=n[1];void this.events.loss.emit(t,[t,void 0,r])}try{void this.destructor_(e)}catch(e){void console.error(e)}void--this.constructor.count,void Object.freeze(this)},e.prototype.schedule=function(){var e=this;this.alive&&(this.scheduled||(void i.Tick(function(n){e.alive&&(e.scheduled=!1,void e.drain())}),this.scheduled=!0))},e.prototype.register=function(e,n){if(void this.checkState(),!this.registerable)throw new Error("Spica: Supervisor: Supervisor "+this.name+" cannot register process during the exiting.");return e=o.concat([],e),void this.schedule(),new d(this,this.workerSharedResource,e,n,this.deps.get(e)||[]).terminate},e.prototype.call=function(e,n,t,r){var i=this;void 0===t&&(t=this.timeout),void 0===r&&(r=c.noop),void this.checkState(),e=o.concat([],e),void this.queue.push([e,n,function(e,n){return void r(n,e)},t,Date.now()]),void this.schedule(),t>0!=!1&&void setTimeout(function(){return i.drain(e)},t)},e.prototype.cast=function(e,n,t){void 0===t&&(t=this.retry),void this.checkState();var r=this.procs.reflect(e,new f.Call(n));return 0===r.length&&void this.events.fail.emit(e,[e,void 0,n]),r.length>0||!t?r:this.cast(e,n,!1)},e.prototype.refs=function(e){return void this.checkState(),this.procs.refs(e).map(function(e){var n=(e[0],e[1]),t=n(void 0);return[t.namespace,t.process,t.terminate]})},e.prototype.terminate=function(e,n){void this.checkState(),void 0===e&&(this.registerable=!1),void this.procs.emit(e||[],new f.Exit(n)),void this.procs.off(e||[]),void 0===e&&void this.destructor(n)},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 n,t=Date.now(),r=function(r){var u=i.queue[r],o=u[0],c=u[1],s=u[2],a=u[3],d=u[4],l=e.every(function(e,n){return e===o[n]})?i.procs.reflect(o,new f.Call(c)):[];if(0===l.length&&void i.events.fail.emit(o,[o,void 0,c]),0===l.length&&t<d+a)return n=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(o,[o,void 0,c]),!s)return n=r,"continue";try{void s(c,l)}catch(e){void console.error(e)}n=r},i=this,u=0;u<this.queue.length;++u){r(u);u=n}},e.count=0,e.procs=0,e}();n.Supervisor=a;var f;!function(e){var n=function(){function e(){}return e}(),t=function(e){function n(n){e.call(this),this.namespace=n}return __extends(n,e),n}(n);e.Deps=t;var r=function(e){function n(n){e.call(this),this.data=n}return __extends(n,e),n}(n);e.Call=r;var i=function(e){function n(n){e.call(this),this.reason=n}return __extends(n,e),n}(n);e.Exit=i}(f||(f={}));var d=function(){function e(n,t,r,i,u){var o=this;this.sv=n,this.sharedResource=t,this.namespace=r,this.process=i,this.dependencies=u,this.alive=!0,this.called=!1,this.concurrency=1,this.receive=function(n){return e.prototype.receive.call(o,n)},this.terminate=function(n){return e.prototype.terminate.call(o,n)},this.sharedResource.allRefsCache=void 0,void++this.sv.constructor.procs,void this.sharedResource.procs.on(r,this.receive)}return e.prototype.destructor=function(e){this.alive&&(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 n=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 t=0,r=this.sharedResource.dependenciesStack;t<r.length;t++){var i=r[t];if(s(this.namespace,i))return!0}return void this.sharedResource.dependenciesStack.push(this.namespace),this.dependencies.every(function(e){return(n.sharedResource.allRefsCache=n.sharedResource.allRefsCache||n.sharedResource.procs.refs([])).some(function(n){var t=n[0],r=n[1];return s(t,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 o=(0,this.process)(e.data);return u.isThenable(o)?void o.then(function(e){void n.sv.schedule(),n.alive&&void++n.concurrency},function(e){void n.sv.schedule(),n.alive&&(void++n.concurrency,void n.terminate(e))}):void++this.concurrency,o}catch(e){throw void void this.terminate(e)}}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,n){"use strict";var t=function(){function e(e){this.thunk=e}return e.prototype.evaluate=function(){return this.memory_=this.memory_||this.thunk()},e}();n.Lazy=t}),define("src/lib/monad/functor",["require","exports","src/lib/monad/lazy"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n}(t.Lazy);n.Functor=r;var r;!function(e){function n(e,n){return n?e.fmap(n):function(n){return e.fmap(n)}}e.fmap=n}(r=n.Functor||(n.Functor={}))}),define("src/lib/monad/applicative",["require","exports","src/lib/monad/functor"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n}(t.Functor);n.Applicative=r;var r;!function(e){function n(e,n){return n?e.bind(function(e){return n.fmap(function(n){return e(n)})}):function(n){return e.bind(function(e){return n.fmap(function(n){return e(n)})})}}e.ap=n}(r=n.Applicative||(n.Applicative={}))}),define("src/lib/monad/monad",["require","exports","src/lib/monad/applicative"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n}(t.Applicative);n.Monad=r;var r;!function(e){function n(e,n){return n?e.bind(n):function(n){return e.bind(n)}}e.bind=n}(r=n.Monad||(n.Monad={}))}),define("src/lib/monad/monadplus",["require","exports","src/lib/monad/monad"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n}(t.Monad);n.MonadPlus=r;var r;!function(e){}(r=n.MonadPlus||(n.MonadPlus={}))}),define("src/lib/curry",["require","exports"],function(e,n){"use strict";function t(e,n,r){return e.length===n.length?e.apply(r,n):function(){for(var i=[],u=0;u<arguments.length;u++)i[u-0]=arguments[u];return t(e,n.concat(i),r)}}var r=this;n.curry=function(e,n){return void 0===n&&(n=r),0===e.length?function(){return e.call(n)}:t(e,[],n)}}),define("src/lib/monad/maybe.impl",["require","exports","src/lib/monad/monadplus"],function(e,n,t){"use strict";function r(){throw new Error("Spica: Maybe: Invalid thunk call.")}var i=function(e){function n(n){e.call(this,n)}return __extends(n,e),n.prototype.fmap=function(e){return this.bind(function(n){return new u(e(n))})},n.prototype.bind=function(e){var t=this;return new n(function(){var r=t.evaluate();if(r instanceof u)return e(r.extract());if(r instanceof o)return r;if(r instanceof n)return r.bind(e);throw new TypeError("Spica: Maybe: Invalid monad value.\n\t"+r)})},n.prototype.extract=function(e){return this.evaluate().extract(e)},n.prototype.maybe=function(e,n){return this.fmap(n).extract(e)},n}(t.MonadPlus);n.Maybe=i;var i;!function(e){function n(e){return new u(e)}e.pure=n,e.Return=n}(i=n.Maybe||(n.Maybe={}));var u=function(e){function n(n){e.call(this,r),this.a=n}return __extends(n,e),n.prototype.bind=function(e){var n=this;return new i(function(){return e(n.extract())})},n.prototype.extract=function(e){return this.a},n}(i);n.Just=u;var o=function(e){function n(){e.call(this,r)}return __extends(n,e),n.prototype.bind=function(e){return this},n.prototype.extract=function(e){if(!e)throw void 0;return e()},n}(i);n.Nothing=o;var i;!function(e){function n(n,t){return new e(function(){return n.fmap(function(){return n}).extract(function(){return t})})}e.mzero=new o,e.mplus=n}(i=n.Maybe||(n.Maybe={}))}),define("src/lib/monad/maybe",["require","exports","src/lib/monad/maybe.impl"],function(e,n,t){"use strict";function r(e){return new t.Just(e)}var i;!function(e){e.fmap=t.Maybe.fmap,e.pure=t.Maybe.pure,e.ap=t.Maybe.ap,e.Return=t.Maybe.Return,e.bind=t.Maybe.bind,e.mzero=t.Maybe.mzero,e.mplus=t.Maybe.mplus}(i=n.Maybe||(n.Maybe={})),n.Just=r,n.Nothing=t.Maybe.mzero}),define("src/lib/monad/either.impl",["require","exports","src/lib/monad/monad"],function(e,n,t){"use strict";function r(){throw new Error("Spica: Either: Invalid thunk call.")}var i=function(e){function n(n){e.call(this,n)}return __extends(n,e),n.prototype.fmap=function(e){return this.bind(function(n){return new o(e(n))})},n.prototype.bind=function(e){var t=this;return new n(function(){var r=t.evaluate();if(r instanceof u)return r;if(r instanceof o)return e(r.extract());if(r instanceof n)return r.bind(e);throw new TypeError("Spica: Either: Invalid monad value.\n\t"+r)})},n.prototype.extract=function(e){return this.evaluate().extract(e)},n.prototype.either=function(e,n){return this.fmap(n).extract(e)},n}(t.Monad);n.Either=i;var i;!function(e){function n(e){return new o(e)}e.pure=n,e.Return=n}(i=n.Either||(n.Either={}));var u=function(e){function n(n){e.call(this,r),this.a=n}return __extends(n,e),n.prototype.bind=function(e){return this},n.prototype.extract=function(e){if(!e)throw this.a;return e(this.a)},n}(i);n.Left=u;var o=function(e){function n(n){e.call(this,r),this.b=n}return __extends(n,e),n.prototype.bind=function(e){var n=this;return new i(function(){return e(n.extract())})},n.prototype.extract=function(e){return this.b},n}(i);n.Right=o}),define("src/lib/monad/either",["require","exports","src/lib/monad/either.impl"],function(e,n,t){"use strict";function r(e){return new t.Left(e)}function i(e){return new t.Right(e)}var u;!function(e){e.fmap=t.Either.fmap,e.pure=t.Either.pure,e.ap=t.Either.ap,e.Return=t.Either.Return,e.bind=t.Either.bind}(u=n.Either||(n.Either={})),n.Left=r,n.Right=i}),define("src/lib/cancelable",["require","exports","src/lib/noop","src/lib/monad/maybe","src/lib/monad/either"],function(e,n,t,r,i){"use strict";var u=function(){function e(){var e=this;this.canceled=!1,this.listeners=new Set,this.promise=function(n){return e.canceled?e.promise_=e.promise_||new Promise(function(n,t){return void t(e.reason)}):Promise.resolve(n)},this.maybe=function(n){return e.canceled?r.Nothing:r.Just(n)},this.either=function(n){return e.canceled?i.Left(e.reason):i.Right(n)},this.cancel=function(n){return e.cancel=t.noop,e.canceled=!0,e.reason=n,e.listeners.forEach(function(e){return void e(n)}),e.listeners.clear(),void(e.listeners.add=function(n){return void n(e.reason),e.listeners})}}return e}();n.Cancelable=u}),define("src/lib/monad/sequence/core",["require","exports","src/lib/monad/monadplus"],function(e,n,t){"use strict";var r=function(e){function n(n,t){e.call(this),this.cons=n,this.memory=t}return __extends(n,e),n}(t.MonadPlus);n.Sequence=r;var r;!function(e){}(r=n.Sequence||(n.Sequence={}));var r;!function(e){function n(e){return r.iterator(e)!==i.done}var t;!function(n){function t(n,t){switch(arguments.length){case 0:return[];case 1:return[n];case 2:return[n,t];default:throw e.Exception.invalidConsError(arguments)}}n.cons=t}(t=e.Data||(e.Data={}));var r;!function(e){function n(e){return e[0]}function t(e){return e[1]}function r(e){return e[2]}e.value=n,e.iterator=t,e.index=r}(r=e.Thunk||(e.Thunk={}));var i;!function(n){function t(n,i,u){return e.isIterable(n)?u(n,function(){return t(r.iterator(n)(),i,u)}):i(n)}n.done=function(){return[void 0,n.done,-1]},n.when=t}(i=e.Iterator||(e.Iterator={})),e.isIterable=n;var u;!function(e){function n(e){return console.error(e,e.length,e[0],e[1]),new TypeError("Spica: Sequence: Invalid parameters of cons.")}function t(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=n,e.invalidDataError=t,e.invalidThunkError=r}(u=e.Exception||(e.Exception={}))}(r=n.Sequence||(n.Sequence={}))}),define("src/lib/monad/sequence/member/static/resume",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.resume=function(e){return new t.Sequence(function(n,r){return void 0===n&&(n=e),t.Sequence.Iterator.when(n(),function(){return r()},function(e){return r(t.Sequence.Thunk.value(e),t.Sequence.Thunk.iterator(e))})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/static/from",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.from=function(e){return new t.Sequence(function(n,t){return void 0===n&&(n=0),n<e.length?t(e[n],++n):t()})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/static/write",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.write=function(e){return new t.Sequence(function(n,t){return e.length>0?t(e.shift(),e):t()})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/static/cycle",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.cycle=function(e){return new t.Sequence(function(n,t){return void 0===n&&(n=0),0===e.length?t():t(e[n],++n%e.length)})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/static/random",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.random=function(e){switch(void 0===e&&(e=function(){return Math.random()}),!0){case Array.isArray(e):return this.random().map(function(n){return e[n*e.length|0]});default:return new t.Sequence(function(n,t){return t(e(),NaN)})}},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/static/concat",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.concat=function(e){return new t.Sequence(function(n,r){var i=void 0===n?[function(){return e.iterate()},t.Sequence.Iterator.done]:n,u=i[0],o=i[1];return t.Sequence.Iterator.when(u(),function(){return r()},function(e,n){return o=o===t.Sequence.Iterator.done?function(){return t.Sequence.Thunk.value(e).iterate()}:o,t.Sequence.Iterator.when(o(),function(){return o=t.Sequence.Iterator.done,n()},function(n){return r(t.Sequence.Thunk.value(n),[function(){return e},t.Sequence.Thunk.iterator(n)])})})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/static/zip",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.zip=function(e,n){return new t.Sequence(function(r,i){var u=void 0===r?[function(){return e.iterate()},function(){return n.iterate()}]:r,o=u[0],c=u[1];return t.Sequence.Iterator.when(o(),function(){return i()},function(e){return t.Sequence.Iterator.when(c(),function(){return i()},function(n){return i([t.Sequence.Thunk.value(e),t.Sequence.Thunk.value(n)],[t.Sequence.Thunk.iterator(e),t.Sequence.Thunk.iterator(n)])})})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/static/difference",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.difference=function(e,n,r){return new t.Sequence(function(i,u){var o=void 0===i?[function(){return e.iterate()},function(){return n.iterate()}]:i,c=o[0],s=o[1];return t.Sequence.Iterator.when(c(),function(){return t.Sequence.Iterator.when(s(),function(){return u()},function(e){return u(t.Sequence.Thunk.value(e),[t.Sequence.Iterator.done,t.Sequence.Thunk.iterator(e)])})},function(e,n){return t.Sequence.Iterator.when(s(),function(){return u(t.Sequence.Thunk.value(e),[t.Sequence.Thunk.iterator(e),t.Sequence.Iterator.done])},function(i){var o=r(t.Sequence.Thunk.value(e),t.Sequence.Thunk.value(i));return o<0?u(t.Sequence.Thunk.value(e),[t.Sequence.Thunk.iterator(e),function(){return i}]):o>0?u(t.Sequence.Thunk.value(i),[function(){return e},t.Sequence.Thunk.iterator(i)]):(s=function(){return t.Sequence.Thunk.iterator(i)()},n())})})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/static/union",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.union=function(e,n,r){return new t.Sequence(function(i,u){var o=void 0===i?[function(){return e.iterate()},function(){return n.iterate()}]:i,c=o[0],s=o[1];return t.Sequence.Iterator.when(c(),function(){return t.Sequence.Iterator.when(s(),function(){return u()},function(e){return u(t.Sequence.Thunk.value(e),[t.Sequence.Iterator.done,t.Sequence.Thunk.iterator(e)])})},function(e){return t.Sequence.Iterator.when(s(),function(){return u(t.Sequence.Thunk.value(e),[t.Sequence.Thunk.iterator(e),t.Sequence.Iterator.done])},function(n){var i=r(t.Sequence.Thunk.value(e),t.Sequence.Thunk.value(n));return i<0?u(t.Sequence.Thunk.value(e),[t.Sequence.Thunk.iterator(e),function(){return n}]):i>0?u(t.Sequence.Thunk.value(n),[function(){return e},t.Sequence.Thunk.iterator(n)]):u(t.Sequence.Thunk.value(e),[t.Sequence.Thunk.iterator(e),t.Sequence.Thunk.iterator(n)])})})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/static/intersect",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.intersect=function(e,n,r){return new t.Sequence(function(i,u){var o=void 0===i?[function(){return e.iterate()},function(){return n.iterate()}]:i,c=o[0],s=o[1];return t.Sequence.Iterator.when(c(),function(){return u()},function(e,n){return t.Sequence.Iterator.when(s(),function(){return u()},function(i,o){var c=r(t.Sequence.Thunk.value(e),t.Sequence.Thunk.value(i));return c<0?(s=function(){return i},n()):c>0?o():u(t.Sequence.Thunk.value(e),[t.Sequence.Thunk.iterator(e),t.Sequence.Thunk.iterator(i)])})})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/static/pure",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.pure=function(e){return new t.Sequence(function(n,t){return t(e)})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/static/return",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.Return=function(e){return new t.Sequence(function(n,t){return t(e)})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/static/mempty",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.mempty=new t.Sequence(function(e,n){return n()}),n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/static/mconcat",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";function r(e,n){return new t.Sequence(function(r,i){var u=void 0===r?[function(){return e.iterate()},function(){return n.iterate()}]:r,o=u[0],c=u[1];return t.Sequence.Iterator.when(o(),function(){return t.Sequence.Iterator.when(c(),function(){return i()},function(e){return i(t.Sequence.Thunk.value(e),[t.Sequence.Iterator.done,t.Sequence.Thunk.iterator(e)])})},function(e){return i(t.Sequence.Thunk.value(e),[t.Sequence.Thunk.iterator(e),c])})})}var i=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.mconcat=function(e){return e.reduce(function(e,n){return r(e,n)},t.Sequence.mempty)},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=i}),define("src/lib/monad/sequence/member/static/mappend",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.mappend=function(e,n){return t.Sequence.mconcat([e,n])},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/static/mzero",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.mzero=t.Sequence.mempty,n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/static/mplus",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.mplus=t.Sequence.mappend,n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/iterate",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.iterate=function(){return this.iterate_()},n.prototype.iterate_=function(e,n){var r=this;void 0===n&&(n=0);var i=this.memory?this.memory.has(n)?this.memory.get(n):this.memory.set(n,this.cons(e,t.Sequence.Data.cons)).get(n):this.cons(e,t.Sequence.Data.cons);switch(i.length){case 0:return[void 0,t.Sequence.Iterator.done,-1];case 1:return[i[0],function(){return t.Sequence.Iterator.done()},n];case 2:return[i[0],function(){return r.iterate_(i[1],n+1)},n];default:throw t.Sequence.Exception.invalidDataError(i)}},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/memoize",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.memoize=function(e){return void 0===e&&(e=this.memory||new Map),new t.Sequence(this.cons,this.memory||e)},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/read",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,n,t,r){"use strict";var i=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.read=function(){for(var e=this,n=[],i=function(){return e.iterate()};;){var u=i();if(!t.Sequence.isIterable(u))return n;void r.concat(n,[t.Sequence.Thunk.value(u)]),i=t.Sequence.Thunk.iterator(u)}},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=i}),define("src/lib/monad/sequence/member/instance/take",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.take=function(e){var n=this;return new t.Sequence(function(r,i){return void 0===r&&(r=function(){return n.iterate()}),t.Sequence.Iterator.when(e>0?r():t.Sequence.Iterator.done(),function(){return i()},function(n){return t.Sequence.Thunk.index(n)+1<e?i(t.Sequence.Thunk.value(n),t.Sequence.Thunk.iterator(n)):i(t.Sequence.Thunk.value(n))})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/drop",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){ | ||
"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.drop=function(e){var n=this;return new t.Sequence(function(r,i){return void 0===r&&(r=function(){return n.iterate()}),t.Sequence.Iterator.when(r(),function(){return i()},function(n,r){return t.Sequence.Thunk.index(n)<e?r():i(t.Sequence.Thunk.value(n),t.Sequence.Thunk.iterator(n))})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/takeWhile",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.takeWhile=function(e){var n=this;return new t.Sequence(function(r,i){return void 0===r&&(r=function(){return n.iterate()}),t.Sequence.Iterator.when(r(),function(){return i()},function(n){return e(t.Sequence.Thunk.value(n))?i(t.Sequence.Thunk.value(n),t.Sequence.Thunk.iterator(n)):i()})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/dropWhile",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.dropWhile=function(e){var n=this;return new t.Sequence(function(r,i){return void 0===r&&(r=function(){return n.iterate()}),t.Sequence.Iterator.when(r(),function(){return i()},function(n,r){return e(t.Sequence.Thunk.value(n))?r():i(t.Sequence.Thunk.value(n),t.Sequence.Thunk.iterator(n))})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/takeUntil",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.takeUntil=function(e){var n=this;return new t.Sequence(function(r,i){return void 0===r&&(r=function(){return n.iterate()}),t.Sequence.Iterator.when(r(),function(){return i()},function(n){return e(t.Sequence.Thunk.value(n))?i(t.Sequence.Thunk.value(n)):i(t.Sequence.Thunk.value(n),t.Sequence.Thunk.iterator(n))})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/dropUntil",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.dropUntil=function(e){var n=this;return new t.Sequence(function(r,i){return void 0===r&&(r=function(){return n.iterate()}),t.Sequence.Iterator.when(r(),function(){return i()},function(n,r){return e(t.Sequence.Thunk.value(n))?r():i(t.Sequence.Thunk.value(n),t.Sequence.Thunk.iterator(n))})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/fmap",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.fmap=function(e){var n=this;return new t.Sequence(function(r){return void 0===r&&(r=function(){return n.iterate()}),t.Sequence.Iterator.when(r(),function(){return t.Sequence.Data.cons()},function(n){return t.Sequence.Data.cons(e(t.Sequence.Thunk.value(n)),t.Sequence.Thunk.iterator(n))})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/bind",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.bind=function(e){return t.Sequence.concat(this.fmap(e))},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/mapM",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,n,t,r){"use strict";var i=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.mapM=function(e){var n=this;return t.Sequence.from([0]).bind(function(){var i=n.read();switch(i.length){case 0:return t.Sequence.mempty;default:var u=i.shift();return e(u).bind(function(n){return 0===i.length?t.Sequence.from([[n]]):t.Sequence.from(i).mapM(e).fmap(function(e){return r.concat([n],e)})})}})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=i}),define("src/lib/monad/sequence/member/instance/filterM",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,n,t,r){"use strict";var i=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.filterM=function(e){var n=this;return t.Sequence.from([0]).bind(function(){var i=n.read();switch(i.length){case 0:return t.Sequence.from([[]]);default:var u=i.shift();return e(u).bind(function(n){return n?0===i.length?t.Sequence.from([[u]]):t.Sequence.from(i).filterM(e).fmap(function(e){return r.concat([u],e)}):0===i.length?t.Sequence.from([[]]):t.Sequence.from(i).filterM(e)})}})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=i}),define("src/lib/monad/sequence/member/instance/map",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.map=function(e){var n=this;return new t.Sequence(function(r){return void 0===r&&(r=function(){return n.iterate()}),t.Sequence.Iterator.when(r(),function(){return t.Sequence.Data.cons()},function(n){return t.Sequence.Data.cons(e(t.Sequence.Thunk.value(n),t.Sequence.Thunk.index(n)),t.Sequence.Thunk.iterator(n))})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/filter",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.filter=function(e){var n=this;return new t.Sequence(function(r,i){return void 0===r&&(r=function(){return n.iterate()}),t.Sequence.Iterator.when(r(),function(){return i()},function(n,r){return e(t.Sequence.Thunk.value(n),t.Sequence.Thunk.index(n))?i(t.Sequence.Thunk.value(n),t.Sequence.Thunk.iterator(n)):r()})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/scan",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.scan=function(e,n){var r=this;return new t.Sequence(function(i){var u=void 0===i?[n,function(){return r.iterate()},0]:i,o=u[0],c=u[1],s=u[2];return t.Sequence.Iterator.when(c(),function(){return 0===s?t.Sequence.Data.cons(n):t.Sequence.Data.cons()},function(n){return t.Sequence.Data.cons(o=e(o,t.Sequence.Thunk.value(n)),[o,t.Sequence.Thunk.iterator(n),t.Sequence.Thunk.index(n)+1])})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/fold",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.fold=function(e,n){var r=this;return new t.Sequence(function(i){var u=void 0===i?[function(){return r.iterate()},0]:i,o=u[0];u[1];return t.Sequence.Iterator.when(o(),function(e){return t.Sequence.Data.cons(n)},function(r){return t.Sequence.Data.cons(e(t.Sequence.Thunk.value(r),t.Sequence.resume(t.Sequence.Thunk.iterator(r)).fold(e,n)))})}).bind(function(e){return e})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/group",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,n,t,r){"use strict";var i=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.group=function(e){var n=this;return new t.Sequence(function(i,u){var o=void 0===i?[function(){return n.iterate()},[]]:i,c=o[0],s=o[1];return t.Sequence.Iterator.when(c(),function(){return 0===s.length?u():u(s)},function(n,i){return 0===s.length||e(s[0],t.Sequence.Thunk.value(n))?(r.concat(s,[t.Sequence.Thunk.value(n)]),i()):u(s,[t.Sequence.Thunk.iterator(n),r.concat([],[t.Sequence.Thunk.value(n)])])})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=i}),define("src/lib/monad/sequence/member/instance/subsequences",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,n,t,r){"use strict";function i(e){return t.Sequence.Iterator.when(e.iterate(),function(){return t.Sequence.mempty},function(e){return t.Sequence.mappend(t.Sequence.from([[t.Sequence.Thunk.value(e)]]),new t.Sequence(function(n,u){return t.Sequence.Iterator.when(e,function(){return u()},function(e){return u(i(t.Sequence.resume(t.Sequence.Thunk.iterator(e))).fold(function(n,i){return t.Sequence.mappend(t.Sequence.mappend(t.Sequence.from([n]),t.Sequence.from([r.concat([t.Sequence.Thunk.value(e)],n)])),i)},t.Sequence.mempty))})}).bind(function(e){return e}))})}var u=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.subsequences=function(){var e=this;return t.Sequence.mappend(t.Sequence.from([[]]),t.Sequence.from([0]).bind(function(){return i(e)}))},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=u}),define("src/lib/monad/sequence/member/instance/permutations",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";function r(e,n){return t.Sequence.Iterator.when(e.iterate(),function(){return t.Sequence.mempty},function(e){return new t.Sequence(function(i,u){return t.Sequence.Iterator.when(e,function(){return u()},function(e){function i(e,n){return o(function(e){return e},e,n)[1]}function o(e,n,r){return t.Sequence.Iterator.when(n.iterate(),function(){return[s,r]},function(n){var i=t.Sequence.Thunk.value(n),u=(t.Sequence.resume(t.Sequence.Thunk.iterator(n)),o(function(n){return e(t.Sequence.mappend(t.Sequence.from([i]),n))},t.Sequence.resume(t.Sequence.Thunk.iterator(n)),r)),s=u[0],a=u[1];return[t.Sequence.mappend(t.Sequence.from([i]),s),t.Sequence.mappend(t.Sequence.from([e(t.Sequence.mappend(t.Sequence.from([c]),t.Sequence.mappend(t.Sequence.from([i]),s))).read()]),a)]})}var c=t.Sequence.Thunk.value(e),s=t.Sequence.resume(t.Sequence.Thunk.iterator(e)).memoize();return u(n.permutations().fold(function(e,n){return i(t.Sequence.from(e),n)},r(s,t.Sequence.mappend(t.Sequence.from([c]),n))))})}).bind(function(e){return e})})}var i=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.permutations=function(){var e=this;return t.Sequence.from([0]).bind(function(){var n=e.read();return 0===n.length?t.Sequence.mempty:t.Sequence.from([n])}).bind(function(e){return t.Sequence.mappend(t.Sequence.from([e]),r(t.Sequence.from(e),t.Sequence.mempty))})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=i}),define("src/lib/assign",["require","exports","src/lib/type"],function(e,n,t){"use strict";function r(e){return function(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(void 0===n||null===n)throw new TypeError("Spica: assign: Cannot walk on "+n+".");for(var i=0,u=t;i<u.length;i++){var o=u[i];if(void 0!==o&&null!==o)for(var c=0,s=Object.keys(Object(o));c<s.length;c++){var a=s[c],f=Object.getOwnPropertyDescriptor(Object(o),a);void 0!==f&&f.enumerable&&void e(a,Object(n),Object(o))}}return Object(n)}}n.assign=r(function(e,n,t){return n[e]=t[e]}),n.clone=r(function(e,r,i){switch(t.type(i[e])){case"Array":return r[e]=n.clone([],i[e]);case"Function":case"Object":return r[e]=n.clone({},i[e]);default:return r[e]=i[e]}}),n.extend=r(function(e,r,i){switch(t.type(i[e])){case"Array":return r[e]=n.extend([],i[e]);case"Function":case"Object":switch(t.type(r[e])){case"Function":case"Object":return r[e]=n.extend(r[e],i[e]);default:return r[e]=n.extend({},i[e])}default:return r[e]=i[e]}})}),define("src/lib/compose",["require","exports","src/lib/assign","src/lib/concat"],function(e,n,t,r){"use strict";function i(e){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return r.concat([e],n).reduce(function(e,n){void t.assign(e.prototype,n.prototype);for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r]);return e})}n.compose=i}),define("src/lib/monad/sequence",["require","exports","src/lib/monad/sequence/core","src/lib/monad/sequence/member/static/resume","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/difference","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/monad/sequence/member/instance/fold","src/lib/monad/sequence/member/instance/group","src/lib/monad/sequence/member/instance/subsequences","src/lib/monad/sequence/member/instance/permutations","src/lib/compose"],function(e,n,t,r,i,u,o,c,s,a,f,d,l,p,h,v,m,q,b,y,S,_,x,w,k,g,T,M,O,I,j,P,E,R,D,N,z,A,C,L,F){"use strict";n.Sequence=t.Sequence,F.compose(t.Sequence,r.default,i.default,u.default,o.default,c.default,s.default,a.default,f.default,d.default,l.default,p.default,h.default,v.default,m.default,q.default,b.default,y.default,S.default,_.default,x.default,w.default,k.default,g.default,T.default,M.default,O.default,I.default,j.default,P.default,E.default,R.default,D.default,N.default,z.default,A.default,C.default,L.default)}),define("src/lib/flip",["require","exports","src/lib/curry"],function(e,n,t){"use strict";function r(e){return t.curry(function(n,t){return e.length>1?e(t,n):e(t)(n)})}n.flip=r}),define("src/lib/list",["require","exports","src/lib/concat"],function(e,n,t){"use strict";var r=function(){function e(){}return e.prototype.push=function(e){return new i(e,this)},e}();n.Nil=r;var i=function(){function e(e,n){this.head_=e,this.tail_=n}return e.prototype.push=function(n){return new e(n,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 t.concat([this.head()],this.tail().array?this.tail().array():[])},e}()}),define("src/lib/hlist",["require","exports"],function(e,n){"use strict";var t=function(){function e(){}return e.prototype.push=function(e){return new r(e,this)},e}();n.HNil=t;var r=function(){function e(e,n){this.head_=e,this.tail_=n}return e.prototype.push=function(n){return new e(n,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,n){"use strict";var t=function(){function e(){this.store=new WeakMap}return e.prototype.get=function(e,n){return this.store.get(e)&&this.store.get(e).get(n)},e.prototype.set=function(e,n,t){var r=this.store.has(e)?this.store.get(e):this.store.set(e,new Map).get(e);return void r.set(n,t),this},e.prototype.has=function(e,n){return this.store.has(e)&&this.store.get(e).has(n)},e.prototype.delete=function(e,n){return void 0===n?this.store.delete(e):!!this.store.has(e)&&this.store.get(e).delete(n)},e}();n.AttrMap=t}),define("src/lib/collection/relationmap",["require","exports"],function(e,n){"use strict";var t=function(){function e(){this.store=new WeakMap}return e.prototype.get=function(e,n){return this.store.get(e)&&this.store.get(e).get(n)},e.prototype.set=function(e,n,t){var r=this.store.has(e)?this.store.get(e):this.store.set(e,new WeakMap).get(e);return void r.set(n,t),this},e.prototype.has=function(e,n){return this.store.has(e)&&this.store.get(e).has(n)},e.prototype.delete=function(e,n){return void 0===n?this.store.delete(e):!!this.store.has(e)&&this.store.get(e).delete(n)},e}();n.RelationMap=t}),define("src/lib/mixin",["require","exports","src/lib/assign"],function(e,n,t){"use strict";function r(){for(var e=[],n=0;n<arguments.length;n++)e[n-0]=arguments[n];return e.reduceRight(function(e,n){return i(n,e)},function(){function e(){}return e}())}function i(e,n){var r=function(){function t(){return e.apply(n.apply(this,arguments)||this,arguments)}return t}();void t.assign(r.prototype,e.prototype,n.prototype);for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i]);for(var i in e)e.hasOwnProperty(i)&&(r[i]=e[i]);return r}n.Mixin=r}),define("src/lib/fingerprint",["require","exports"],function(e,n){"use strict";function t(){return i(u([o(window.navigator),o(window.screen),o((new Date).getTimezoneOffset())].join()))}function r(){return i(u([o(process)].join()))}function i(e){return e.split("").reduce(function(e,n,t){return(+n*t+e)%1e9||e-+n},0)}function u(e){return e.split("").map(function(e){return e.charCodeAt(0)}).join("")}function o(e,n){if(void 0===n&&(n=5),n>0&&e&&"object"==typeof e){var t="{";for(var r in e)t+='"'+r+'": '+o(e[r],n-1)+",";return t+="}"}return!e||e.toString?'"'+e+'"':'"'+Object.prototype.toString.call(e)+'"'}n.FINGERPRINT="object"==typeof window?t():r(),n.browser=t,n.server=r,n.hash=i,n.str2digit=u,n.stringify=o}),define("src/lib/uuid",["require","exports","src/lib/fingerprint"],function(e,n,t){"use strict";function r(){var e=o=o*Date.now()%1e15;if(e<16||1e15<e)throw new Error("Spica: uuid: Invalid uuid dynamic seed.");for(var n="",t=0,r=u;t<r.length;t++){var i=r[t];if("x"===i||"y"===i){var c=Math.random()*e%16|0,s="x"==i?c:3&c|8;n+=s.toString(16)}else n+=i}return n.toLowerCase()}var i=t.FINGERPRINT*Date.now()%1e15;if(!i||"number"!=typeof i||i<100||1e15<i)throw new Error("Spica: uuid: Invalid uuid static seed.\n\t"+t.FINGERPRINT);var u=Object.freeze("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split("")),o=i;n.v4=r}),define("src/lib/sort",["require","exports"],function(e,n){"use strict";function t(e,n,t,r){if(void 0===r&&(r=!1),!r&&t*t>1.25*e.length)return e.sort(n);t=t<e.length-1?t:e.length-1;for(var i=0;i<t;++i)for(var u=i+1;u<e.length;++u)if(n(e[i],e[u])>0!=!1){var o=e[i];e[i]=e[u],e[u]=o}return e}n.sort=t}),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,n,t,r,i,u,o,c,s,a,f,d,l,p,h,v,m,q,b,y,S,_,x){"use strict";n.Supervisor=t.Supervisor,n.Observable=r.Observable,n.Cancelable=i.Cancelable,n.Sequence=u.Sequence,n.Maybe=o.Maybe,n.Just=o.Just,n.Nothing=o.Nothing,n.Either=c.Either,n.Left=c.Left,n.Right=c.Right,n.curry=s.curry,n.flip=a.flip,n.Nil=f.Nil,n.HNil=d.HNil,n.DataMap=l.DataMap,n.AttrMap=p.AttrMap,n.RelationMap=h.RelationMap,n.Mixin=v.Mixin,n.Tick=m.Tick,n.FINGERPRINT=q.FINGERPRINT,n.uuid=b.v4,n.sqid=y.sqid,n.assign=S.assign,n.clone=S.clone,n.extend=S.extend,n.concat=_.concat,n.sort=x.sort}),define("spica",["require","exports","src/export"],function(e,n,t){"use strict";function r(e){for(var t in e)n.hasOwnProperty(t)||(n[t]=e[t])}r(t)}); | ||
"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.drop=function(e){var n=this;return new t.Sequence(function(r,i){return void 0===r&&(r=function(){return n.iterate()}),t.Sequence.Iterator.when(r(),function(){return i()},function(n,r){return t.Sequence.Thunk.index(n)<e?r():i(t.Sequence.Thunk.value(n),t.Sequence.Thunk.iterator(n))})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/takeWhile",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.takeWhile=function(e){var n=this;return new t.Sequence(function(r,i){return void 0===r&&(r=function(){return n.iterate()}),t.Sequence.Iterator.when(r(),function(){return i()},function(n){return e(t.Sequence.Thunk.value(n))?i(t.Sequence.Thunk.value(n),t.Sequence.Thunk.iterator(n)):i()})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/dropWhile",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.dropWhile=function(e){var n=this;return new t.Sequence(function(r,i){return void 0===r&&(r=function(){return n.iterate()}),t.Sequence.Iterator.when(r(),function(){return i()},function(n,r){return e(t.Sequence.Thunk.value(n))?r():i(t.Sequence.Thunk.value(n),t.Sequence.Thunk.iterator(n))})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/takeUntil",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.takeUntil=function(e){var n=this;return new t.Sequence(function(r,i){return void 0===r&&(r=function(){return n.iterate()}),t.Sequence.Iterator.when(r(),function(){return i()},function(n){return e(t.Sequence.Thunk.value(n))?i(t.Sequence.Thunk.value(n)):i(t.Sequence.Thunk.value(n),t.Sequence.Thunk.iterator(n))})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/dropUntil",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.dropUntil=function(e){var n=this;return new t.Sequence(function(r,i){return void 0===r&&(r=function(){return n.iterate()}),t.Sequence.Iterator.when(r(),function(){return i()},function(n,r){return e(t.Sequence.Thunk.value(n))?r():i(t.Sequence.Thunk.value(n),t.Sequence.Thunk.iterator(n))})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/fmap",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.fmap=function(e){var n=this;return new t.Sequence(function(r){return void 0===r&&(r=function(){return n.iterate()}),t.Sequence.Iterator.when(r(),function(){return t.Sequence.Data.cons()},function(n){return t.Sequence.Data.cons(e(t.Sequence.Thunk.value(n)),t.Sequence.Thunk.iterator(n))})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/bind",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.bind=function(e){return t.Sequence.concat(this.fmap(e))},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/mapM",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,n,t,r){"use strict";var i=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.mapM=function(e){var n=this;return t.Sequence.from([0]).bind(function(){var i=n.read();switch(i.length){case 0:return t.Sequence.mempty;default:var u=i.shift();return e(u).bind(function(n){return 0===i.length?t.Sequence.from([[n]]):t.Sequence.from(i).mapM(e).fmap(function(e){return r.concat([n],e)})})}})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=i}),define("src/lib/monad/sequence/member/instance/filterM",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,n,t,r){"use strict";var i=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.filterM=function(e){var n=this;return t.Sequence.from([0]).bind(function(){var i=n.read();switch(i.length){case 0:return t.Sequence.from([[]]);default:var u=i.shift();return e(u).bind(function(n){return n?0===i.length?t.Sequence.from([[u]]):t.Sequence.from(i).filterM(e).fmap(function(e){return r.concat([u],e)}):0===i.length?t.Sequence.from([[]]):t.Sequence.from(i).filterM(e)})}})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=i}),define("src/lib/monad/sequence/member/instance/map",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.map=function(e){var n=this;return new t.Sequence(function(r){return void 0===r&&(r=function(){return n.iterate()}),t.Sequence.Iterator.when(r(),function(){return t.Sequence.Data.cons()},function(n){return t.Sequence.Data.cons(e(t.Sequence.Thunk.value(n),t.Sequence.Thunk.index(n)),t.Sequence.Thunk.iterator(n))})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/filter",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.filter=function(e){var n=this;return new t.Sequence(function(r,i){return void 0===r&&(r=function(){return n.iterate()}),t.Sequence.Iterator.when(r(),function(){return i()},function(n,r){return e(t.Sequence.Thunk.value(n),t.Sequence.Thunk.index(n))?i(t.Sequence.Thunk.value(n),t.Sequence.Thunk.iterator(n)):r()})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/scan",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.scan=function(e,n){var r=this;return new t.Sequence(function(i){var u=void 0===i?[n,function(){return r.iterate()},0]:i,o=u[0],c=u[1],s=u[2];return t.Sequence.Iterator.when(c(),function(){return 0===s?t.Sequence.Data.cons(n):t.Sequence.Data.cons()},function(n){return t.Sequence.Data.cons(o=e(o,t.Sequence.Thunk.value(n)),[o,t.Sequence.Thunk.iterator(n),t.Sequence.Thunk.index(n)+1])})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/fold",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";var r=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.fold=function(e,n){var r=this;return new t.Sequence(function(i){var u=void 0===i?[function(){return r.iterate()},0]:i,o=u[0];u[1];return t.Sequence.Iterator.when(o(),function(e){return t.Sequence.Data.cons(n)},function(r){return t.Sequence.Data.cons(e(t.Sequence.Thunk.value(r),t.Sequence.resume(t.Sequence.Thunk.iterator(r)).fold(e,n)))})}).bind(function(e){return e})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=r}),define("src/lib/monad/sequence/member/instance/group",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,n,t,r){"use strict";var i=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.group=function(e){var n=this;return new t.Sequence(function(i,u){var o=void 0===i?[function(){return n.iterate()},[]]:i,c=o[0],s=o[1];return t.Sequence.Iterator.when(c(),function(){return 0===s.length?u():u(s)},function(n,i){return 0===s.length||e(s[0],t.Sequence.Thunk.value(n))?(r.concat(s,[t.Sequence.Thunk.value(n)]),i()):u(s,[t.Sequence.Thunk.iterator(n),r.concat([],[t.Sequence.Thunk.value(n)])])})})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=i}),define("src/lib/monad/sequence/member/instance/subsequences",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,n,t,r){"use strict";function i(e){return t.Sequence.Iterator.when(e.iterate(),function(){return t.Sequence.mempty},function(e){return t.Sequence.mappend(t.Sequence.from([[t.Sequence.Thunk.value(e)]]),new t.Sequence(function(n,u){return t.Sequence.Iterator.when(e,function(){return u()},function(e){return u(i(t.Sequence.resume(t.Sequence.Thunk.iterator(e))).fold(function(n,i){return t.Sequence.mappend(t.Sequence.mappend(t.Sequence.from([n]),t.Sequence.from([r.concat([t.Sequence.Thunk.value(e)],n)])),i)},t.Sequence.mempty))})}).bind(function(e){return e}))})}var u=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.subsequences=function(){var e=this;return t.Sequence.mappend(t.Sequence.from([[]]),t.Sequence.from([0]).bind(function(){return i(e)}))},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=u}),define("src/lib/monad/sequence/member/instance/permutations",["require","exports","src/lib/monad/sequence/core"],function(e,n,t){"use strict";function r(e,n){return t.Sequence.Iterator.when(e.iterate(),function(){return t.Sequence.mempty},function(e){return new t.Sequence(function(i,u){return t.Sequence.Iterator.when(e,function(){return u()},function(e){function i(e,n){return o(function(e){return e},e,n)[1]}function o(e,n,r){return t.Sequence.Iterator.when(n.iterate(),function(){return[s,r]},function(n){var i=t.Sequence.Thunk.value(n),u=(t.Sequence.resume(t.Sequence.Thunk.iterator(n)),o(function(n){return e(t.Sequence.mappend(t.Sequence.from([i]),n))},t.Sequence.resume(t.Sequence.Thunk.iterator(n)),r)),s=u[0],a=u[1];return[t.Sequence.mappend(t.Sequence.from([i]),s),t.Sequence.mappend(t.Sequence.from([e(t.Sequence.mappend(t.Sequence.from([c]),t.Sequence.mappend(t.Sequence.from([i]),s))).read()]),a)]})}var c=t.Sequence.Thunk.value(e),s=t.Sequence.resume(t.Sequence.Thunk.iterator(e)).memoize();return u(n.permutations().fold(function(e,n){return i(t.Sequence.from(e),n)},r(s,t.Sequence.mappend(t.Sequence.from([c]),n))))})}).bind(function(e){return e})})}var i=function(e){function n(){e.apply(this,arguments)}return __extends(n,e),n.prototype.permutations=function(){var e=this;return t.Sequence.from([0]).bind(function(){var n=e.read();return 0===n.length?t.Sequence.mempty:t.Sequence.from([n])}).bind(function(e){return t.Sequence.mappend(t.Sequence.from([e]),r(t.Sequence.from(e),t.Sequence.mempty))})},n}(t.Sequence);Object.defineProperty(n,"__esModule",{value:!0}),n.default=i}),define("src/lib/assign",["require","exports","src/lib/type"],function(e,n,t){"use strict";function r(e){return function(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(void 0===n||null===n)throw new TypeError("Spica: assign: Cannot walk on "+n+".");for(var i=0,u=t;i<u.length;i++){var o=u[i];if(void 0!==o&&null!==o)for(var c=0,s=Object.keys(Object(o));c<s.length;c++){var a=s[c],f=Object.getOwnPropertyDescriptor(Object(o),a);void 0!==f&&f.enumerable&&void e(a,Object(n),Object(o))}}return Object(n)}}n.assign=r(function(e,n,t){return n[e]=t[e]}),n.clone=r(function(e,r,i){switch(t.type(i[e])){case"Array":return r[e]=n.clone([],i[e]);case"Object":return r[e]=n.clone({},i[e]);default:return r[e]=i[e]}}),n.extend=r(function(e,r,i){switch(t.type(i[e])){case"Array":return r[e]=n.extend([],i[e]);case"Object":switch(t.type(r[e])){case"Function":case"Object":return r[e]=n.extend(r[e],i[e]);default:return r[e]=n.extend({},i[e])}default:return r[e]=i[e]}})}),define("src/lib/compose",["require","exports","src/lib/assign","src/lib/concat"],function(e,n,t,r){"use strict";function i(e){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return r.concat([e],n).reduce(function(e,n){void t.assign(e.prototype,n.prototype);for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r]);return e})}n.compose=i}),define("src/lib/monad/sequence",["require","exports","src/lib/monad/sequence/core","src/lib/monad/sequence/member/static/resume","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/difference","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/monad/sequence/member/instance/fold","src/lib/monad/sequence/member/instance/group","src/lib/monad/sequence/member/instance/subsequences","src/lib/monad/sequence/member/instance/permutations","src/lib/compose"],function(e,n,t,r,i,u,o,c,s,a,f,d,l,p,h,v,m,q,b,y,S,_,x,w,k,g,T,M,O,I,j,P,E,R,D,N,z,A,C,L,F){"use strict";n.Sequence=t.Sequence,F.compose(t.Sequence,r.default,i.default,u.default,o.default,c.default,s.default,a.default,f.default,d.default,l.default,p.default,h.default,v.default,m.default,q.default,b.default,y.default,S.default,_.default,x.default,w.default,k.default,g.default,T.default,M.default,O.default,I.default,j.default,P.default,E.default,R.default,D.default,N.default,z.default,A.default,C.default,L.default)}),define("src/lib/flip",["require","exports","src/lib/curry"],function(e,n,t){"use strict";function r(e){return t.curry(function(n,t){return e.length>1?e(t,n):e(t)(n)})}n.flip=r}),define("src/lib/list",["require","exports","src/lib/concat"],function(e,n,t){"use strict";var r=function(){function e(){}return e.prototype.push=function(e){return new i(e,this)},e}();n.Nil=r;var i=function(){function e(e,n){this.head_=e,this.tail_=n}return e.prototype.push=function(n){return new e(n,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 t.concat([this.head()],this.tail().array?this.tail().array():[])},e}()}),define("src/lib/hlist",["require","exports"],function(e,n){"use strict";var t=function(){function e(){}return e.prototype.push=function(e){return new r(e,this)},e}();n.HNil=t;var r=function(){function e(e,n){this.head_=e,this.tail_=n}return e.prototype.push=function(n){return new e(n,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,n){"use strict";var t=function(){function e(){this.store=new WeakMap}return e.prototype.get=function(e,n){return this.store.get(e)&&this.store.get(e).get(n)},e.prototype.set=function(e,n,t){var r=this.store.has(e)?this.store.get(e):this.store.set(e,new Map).get(e);return void r.set(n,t),this},e.prototype.has=function(e,n){return this.store.has(e)&&this.store.get(e).has(n)},e.prototype.delete=function(e,n){return void 0===n?this.store.delete(e):!!this.store.has(e)&&this.store.get(e).delete(n)},e}();n.AttrMap=t}),define("src/lib/collection/relationmap",["require","exports"],function(e,n){"use strict";var t=function(){function e(){this.store=new WeakMap}return e.prototype.get=function(e,n){return this.store.get(e)&&this.store.get(e).get(n)},e.prototype.set=function(e,n,t){var r=this.store.has(e)?this.store.get(e):this.store.set(e,new WeakMap).get(e);return void r.set(n,t),this},e.prototype.has=function(e,n){return this.store.has(e)&&this.store.get(e).has(n)},e.prototype.delete=function(e,n){return void 0===n?this.store.delete(e):!!this.store.has(e)&&this.store.get(e).delete(n)},e}();n.RelationMap=t}),define("src/lib/mixin",["require","exports","src/lib/assign"],function(e,n,t){"use strict";function r(){for(var e=[],n=0;n<arguments.length;n++)e[n-0]=arguments[n];return e.reduceRight(function(e,n){return i(n,e)},function(){function e(){}return e}())}function i(e,n){var r=function(){function t(){return e.apply(n.apply(this,arguments)||this,arguments)}return t}();void t.assign(r.prototype,e.prototype,n.prototype);for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i]);for(var i in e)e.hasOwnProperty(i)&&(r[i]=e[i]);return r}n.Mixin=r}),define("src/lib/fingerprint",["require","exports"],function(e,n){"use strict";function t(){return i(u([o(window.navigator),o(window.screen),o((new Date).getTimezoneOffset())].join()))}function r(){return i(u([o(process)].join()))}function i(e){return e.split("").reduce(function(e,n,t){return(+n*t+e)%1e9||e-+n},0)}function u(e){return e.split("").map(function(e){return e.charCodeAt(0)}).join("")}function o(e,n){if(void 0===n&&(n=5),n>0&&e&&"object"==typeof e){var t="{";for(var r in e)t+='"'+r+'": '+o(e[r],n-1)+",";return t+="}"}return!e||e.toString?'"'+e+'"':'"'+Object.prototype.toString.call(e)+'"'}n.FINGERPRINT="object"==typeof window?t():r(),n.browser=t,n.server=r,n.hash=i,n.str2digit=u,n.stringify=o}),define("src/lib/uuid",["require","exports","src/lib/fingerprint"],function(e,n,t){"use strict";function r(){var e=o=o*Date.now()%1e15;if(e<16||1e15<e)throw new Error("Spica: uuid: Invalid uuid dynamic seed.");for(var n="",t=0,r=u;t<r.length;t++){var i=r[t];if("x"===i||"y"===i){var c=Math.random()*e%16|0,s="x"==i?c:3&c|8;n+=s.toString(16)}else n+=i}return n.toLowerCase()}var i=t.FINGERPRINT*Date.now()%1e15;if(!i||"number"!=typeof i||i<100||1e15<i)throw new Error("Spica: uuid: Invalid uuid static seed.\n\t"+t.FINGERPRINT);var u=Object.freeze("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split("")),o=i;n.v4=r}),define("src/lib/sort",["require","exports"],function(e,n){"use strict";function t(e,n,t,r){if(void 0===r&&(r=!1),!r&&t*t>1.25*e.length)return e.sort(n);t=t<e.length-1?t:e.length-1;for(var i=0;i<t;++i)for(var u=i+1;u<e.length;++u)if(n(e[i],e[u])>0!=!1){var o=e[i];e[i]=e[u],e[u]=o}return e}n.sort=t}),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,n,t,r,i,u,o,c,s,a,f,d,l,p,h,v,m,q,b,y,S,_,x){"use strict";n.Supervisor=t.Supervisor,n.Observable=r.Observable,n.Cancelable=i.Cancelable,n.Sequence=u.Sequence,n.Maybe=o.Maybe,n.Just=o.Just,n.Nothing=o.Nothing,n.Either=c.Either,n.Left=c.Left,n.Right=c.Right,n.curry=s.curry,n.flip=a.flip,n.Nil=f.Nil,n.HNil=d.HNil,n.DataMap=l.DataMap,n.AttrMap=p.AttrMap,n.RelationMap=h.RelationMap,n.Mixin=v.Mixin,n.Tick=m.Tick,n.FINGERPRINT=q.FINGERPRINT,n.uuid=b.v4,n.sqid=y.sqid,n.assign=S.assign,n.clone=S.clone,n.extend=S.extend,n.concat=_.concat,n.sort=x.sort}),define("spica",["require","exports","src/export"],function(e,n,t){"use strict";function r(e){for(var t in e)n.hasOwnProperty(t)||(n[t]=e[t])}r(t)}); |
{ | ||
"name": "spica", | ||
"version": "0.0.24", | ||
"version": "0.0.25", | ||
"description": "Supervisor, Observable, Sequence, Maybe, Either and some utils.", | ||
@@ -5,0 +5,0 @@ "private": false, |
import {type} from './type'; | ||
export const assign = template((key, target, source) => { | ||
return target[key] = source[key]; | ||
}); | ||
export const assign = template((key, target, source) => | ||
target[key] = source[key]); | ||
export const clone = template((key, target, source): any => { | ||
switch (type(source[key])) { | ||
case 'Array': { | ||
case 'Array': | ||
return target[key] = clone([], source[key]); | ||
} | ||
case 'Function': | ||
case 'Object': { | ||
case 'Object': | ||
return target[key] = clone({}, source[key]); | ||
} | ||
default: { | ||
default: | ||
return target[key] = source[key]; | ||
} | ||
} | ||
@@ -24,6 +19,4 @@ }); | ||
switch (type(source[key])) { | ||
case 'Array': { | ||
case 'Array': | ||
return target[key] = extend([], source[key]); | ||
} | ||
case 'Function': | ||
case 'Object': { | ||
@@ -40,5 +33,4 @@ switch (type(target[key])) { | ||
} | ||
default: { | ||
default: | ||
return target[key] = source[key]; | ||
} | ||
} | ||
@@ -45,0 +37,0 @@ }); |
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
389609
9957