From 33ec806d2acb5f34d5695fd75089acb261e7266e Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Sun, 8 Feb 2015 16:06:35 +0200 Subject: [PATCH] Renamed custom element to ; bumped v1.3.1 --- dist/js/app.js | 2 +- dist/js/element.js | 2 +- package.json | 2 +- src/element.js | 2 +- test-custom-element.html | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/js/app.js b/dist/js/app.js index 4dc5eae..f998dfb 100644 --- a/dist/js/app.js +++ b/dist/js/app.js @@ -11,6 +11,6 @@ if(q.length>0){subscribe(q.shift())}else{activeCount--;isStopped&&activeCount=== }}this.count=count+descendants;this.hasWidgets=hasWidgets;this.hasThunks=hasThunks;this.hooks=hooks;this.descendantHooks=descendantHooks}VirtualNode.prototype.version=version;VirtualNode.prototype.type="VirtualNode"},{"./is-thunk":37,"./is-vhook":38,"./is-vnode":39,"./is-widget":41,"./version":42}],44:[function(require,module,exports){var version=require("./version");VirtualPatch.NONE=0;VirtualPatch.VTEXT=1;VirtualPatch.VNODE=2;VirtualPatch.WIDGET=3;VirtualPatch.PROPS=4;VirtualPatch.ORDER=5;VirtualPatch.INSERT=6;VirtualPatch.REMOVE=7;VirtualPatch.THUNK=8;module.exports=VirtualPatch;function VirtualPatch(type,vNode,patch){this.type=Number(type);this.vNode=vNode;this.patch=patch}VirtualPatch.prototype.version=version;VirtualPatch.prototype.type="VirtualPatch"},{"./version":42}],45:[function(require,module,exports){var version=require("./version");module.exports=VirtualText;function VirtualText(text){this.text=String(text)}VirtualText.prototype.version=version;VirtualText.prototype.type="VirtualText"},{"./version":42}],46:[function(require,module,exports){var isObject=require("is-object");var isHook=require("../vnode/is-vhook");module.exports=diffProps;function diffProps(a,b){var diff;for(var aKey in a){if(!(aKey in b)){diff=diff||{};diff[aKey]=undefined}var aValue=a[aKey];var bValue=b[aKey];if(aValue===bValue){continue}else if(isObject(aValue)&&isObject(bValue)){if(getPrototype(bValue)!==getPrototype(aValue)){diff=diff||{};diff[aKey]=bValue}else if(isHook(bValue)){diff=diff||{};diff[aKey]=bValue}else{var objectDiff=diffProps(aValue,bValue);if(objectDiff){diff=diff||{};diff[aKey]=objectDiff}}}else{diff=diff||{};diff[aKey]=bValue}}for(var bKey in b){if(!(bKey in a)){diff=diff||{};diff[bKey]=b[bKey]}}return diff}function getPrototype(value){if(Object.getPrototypeOf){return Object.getPrototypeOf(value)}else if(value.__proto__){return value.__proto__}else if(value.constructor){return value.constructor.prototype}}},{"../vnode/is-vhook":38,"is-object":20}],47:[function(require,module,exports){var isArray=require("x-is-array");var VPatch=require("../vnode/vpatch");var isVNode=require("../vnode/is-vnode");var isVText=require("../vnode/is-vtext");var isWidget=require("../vnode/is-widget");var isThunk=require("../vnode/is-thunk");var handleThunk=require("../vnode/handle-thunk");var diffProps=require("./diff-props");module.exports=diff;function diff(a,b){var patch={a:a};walk(a,b,patch,0);return patch}function walk(a,b,patch,index){if(a===b){return}var apply=patch[index];var applyClear=false;if(isThunk(a)||isThunk(b)){thunks(a,b,patch,index)}else if(b==null){if(!isWidget(a)){clearState(a,patch,index);apply=patch[index]}apply=appendPatch(apply,new VPatch(VPatch.REMOVE,a,b))}else if(isVNode(b)){if(isVNode(a)){if(a.tagName===b.tagName&&a.namespace===b.namespace&&a.key===b.key){var propsPatch=diffProps(a.properties,b.properties);if(propsPatch){apply=appendPatch(apply,new VPatch(VPatch.PROPS,a,propsPatch))}apply=diffChildren(a,b,patch,apply,index)}else{apply=appendPatch(apply,new VPatch(VPatch.VNODE,a,b));applyClear=true}}else{apply=appendPatch(apply,new VPatch(VPatch.VNODE,a,b));applyClear=true}}else if(isVText(b)){if(!isVText(a)){apply=appendPatch(apply,new VPatch(VPatch.VTEXT,a,b));applyClear=true}else if(a.text!==b.text){apply=appendPatch(apply,new VPatch(VPatch.VTEXT,a,b))}}else if(isWidget(b)){if(!isWidget(a)){applyClear=true}apply=appendPatch(apply,new VPatch(VPatch.WIDGET,a,b))}if(apply){patch[index]=apply}if(applyClear){clearState(a,patch,index)}}function diffChildren(a,b,patch,apply,index){var aChildren=a.children;var bChildren=reorder(aChildren,b.children);var aLen=aChildren.length;var bLen=bChildren.length;var len=aLen>bLen?aLen:bLen;for(var i=0;ibLen?aLen:bLen;var shuffle=[];var freeIndex=0;var i=0;var moveIndex=0;var moves={};var removes=moves.removes={};var reverse=moves.reverse={};var hasMoves=false;while(freeIndex1){return Array.prototype.slice.call(arguments)}else{return null}};return this}replicateAll=function replicateAll(input,proxy){if(!input||!proxy){return}for(var key in proxy.proxiedProps){if(proxy.proxiedProps.hasOwnProperty(key)){if(!input.hasOwnProperty(key)&&input instanceof InputProxy){input.proxiedProps[key]=new Rx.Subject;replicate(input.proxiedProps[key],proxy.proxiedProps[key])}else if(input instanceof DataFlowNode&&input.get(key)!==null){replicate(input.get(key),proxy.proxiedProps[key])}else if(typeof input==="object"&&input.hasOwnProperty(key)){if(!input[key]){input[key]=new Rx.Subject}replicate(input[key],proxy.proxiedProps[key])}else{throw new CycleInterfaceError("Input should have the required property "+key,String(key))}}}};module.exports=DataFlowNode},{"./errors":56,"./input-proxy":57,"./utils":60,rx:9}],54:[function(require,module,exports){"use strict";function makeLightweightInputProxies(args){return Array.prototype.slice.call(args).map(function(arg){return{get:function get(streamName){if(typeof arg.get==="function"){return arg.get(streamName)}else{return arg[streamName]||null}}}})}function DataFlowSink(definitionFn){if(arguments.length!==1){throw new Error("DataFlowSink expects only one argument: the definition function.")}if(typeof definitionFn!=="function"){throw new Error("DataFlowSink expects the argument to be the definition function.")}definitionFn.displayName+="(DataFlowSink defFn)";this.inject=function injectIntoDataFlowSink(){var proxies=makeLightweightInputProxies(arguments);return definitionFn.apply({},proxies)};return this}module.exports=DataFlowSink},{}],55:[function(require,module,exports){"use strict";function DataFlowSource(outputObject){if(arguments.length!==1){throw new Error("DataFlowSource expects only one argument: the output object.")}if(typeof outputObject!=="object"){throw new Error("DataFlowSource expects the constructor argument to be the "+"output object.")}for(var key in outputObject){if(outputObject.hasOwnProperty(key)){this[key]=outputObject[key]}}this.inject=function injectDataFlowSource(){throw new Error("A DataFlowSource cannot be injected. Use a DataFlowNode instead.")};return this}module.exports=DataFlowSource},{}],56:[function(require,module,exports){"use strict";function CycleInterfaceError(message,missingMember){this.name="CycleInterfaceError";this.message=message||"";this.missingMember=missingMember||""}CycleInterfaceError.prototype=Error.prototype;function customInterfaceErrorMessageInInject(dataFlowNode,message){var originalInject=dataFlowNode.inject;dataFlowNode.inject=function inject(){try{return originalInject.apply({},arguments)}catch(err){if(err.name==="CycleInterfaceError"){throw new CycleInterfaceError(message+err.missingMember,err.missingMember)}else{throw err}}};return dataFlowNode}module.exports={CycleInterfaceError:CycleInterfaceError,customInterfaceErrorMessageInInject:customInterfaceErrorMessageInInject}},{}],57:[function(require,module,exports){"use strict";var Rx=require("rx");function InputProxy(){this.proxiedProps={};this.get=function getFromProxy(streamKey){if(typeof this.proxiedProps[streamKey]==="undefined"){this.proxiedProps[streamKey]=new Rx.Subject}return this.proxiedProps[streamKey]}}module.exports=InputProxy},{rx:9}],58:[function(require,module,exports){"use strict";function PropertyHook(fn){this.fn=fn}PropertyHook.prototype.hook=function(){this.fn.apply(this,arguments)};module.exports=PropertyHook},{}],59:[function(require,module,exports){"use strict";var VDOM={h:require("virtual-dom").h,diff:require("virtual-dom/diff"),patch:require("virtual-dom/patch")};var DataFlowSink=require("./data-flow-sink");var CustomElements=require("./custom-elements");function isElement(o){return typeof HTMLElement==="object"?o instanceof HTMLElement:o&&typeof o==="object"&&o!==null&&o.nodeType===1&&typeof o.nodeName==="string"}function getFunctionForwardIntoStream(stream){return function forwardIntoStream(ev){stream.onNext(ev)}}function replaceEventHandler(vtree,eventName){if(typeof eventName!=="string"||eventName.search(/^on[a-z]+/)!==0){return}var stream=vtree.properties[eventName];if(!stream||typeof stream==="function"){return}vtree.properties[eventName]=getFunctionForwardIntoStream(stream)}function replaceEventHandlersInVTrees(vtree){if(!vtree){return vtree}if(vtree.type==="VirtualNode"&&!!vtree.properties){for(var key in vtree.properties){if(vtree.properties.hasOwnProperty(key)){replaceEventHandler(vtree,key)}}}if(Array.isArray(vtree.children)){for(var i=0;i=0;i--){vtree.children[i]=this.replaceCustomElements(vtree.children[i])}}return vtree};Renderer.registerCustomElement=function registerCustomElement(tagName,dataFlowNode){if(typeof tagName!=="string"||typeof dataFlowNode!=="object"){throw new Error("registerCustomElement requires parameters `tagName` and "+"`dataFlowNode`.")}if(!dataFlowNode.get("vtree$")){throw new Error("The dataFlowNode for a custom element must export "+"`vtree$`.")}tagName=tagName.toUpperCase();if(Renderer._customElements&&Renderer._customElements.hasOwnProperty(tagName)){throw new Error("Cannot register custom element `"+tagName+"` "+"in Renderer because that tagName is already registered.")}var WidgetClass=CustomElements.makeConstructor();WidgetClass.prototype.init=CustomElements.makeInit(tagName,dataFlowNode);WidgetClass.prototype.update=CustomElements.makeUpdate();Renderer._customElements=Renderer._customElements||{};Renderer._customElements[tagName]=WidgetClass};module.exports=Renderer},{"./custom-elements":51,"./data-flow-sink":54,"virtual-dom":14,"virtual-dom/diff":12,"virtual-dom/patch":22}],60:[function(require,module,exports){"use strict";function endsWithDolarSign(str){if(typeof str!=="string"){return false}return str.indexOf("$",str.length-1)!==-1}module.exports={endsWithDolarSign:endsWithDolarSign}},{}],61:[function(require,module,exports){(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):global.Immutable=factory()})(this,function(){"use strict";var SLICE$0=Array.prototype.slice;function createClass(ctor,superClass){if(superClass){ctor.prototype=Object.create(superClass.prototype)}ctor.prototype.constructor=ctor}var DELETE="delete";var SHIFT=5;var SIZE=1<=0?+index:ensureSize(iter)+ +index}function returnTrue(){return true}function wholeSlice(begin,end,size){return(begin===0||size!==undefined&&begin<=-size)&&(end===undefined||size!==undefined&&end>=size)}function resolveBegin(begin,size){return resolveIndex(begin,size,0)}function resolveEnd(end,size){return resolveIndex(end,size,size)}function resolveIndex(index,size,defaultIndex){return index===undefined?defaultIndex:index<0?Math.max(0,size+index):size===undefined?index:Math.min(size,index)}function Iterable(value){return isIterable(value)?value:Seq(value)}createClass(KeyedIterable,Iterable);function KeyedIterable(value){return isKeyed(value)?value:KeyedSeq(value)}createClass(IndexedIterable,Iterable);function IndexedIterable(value){return isIndexed(value)?value:IndexedSeq(value)}createClass(SetIterable,Iterable);function SetIterable(value){return isIterable(value)&&!isAssociative(value)?value:SetSeq(value)}function isIterable(maybeIterable){return!!(maybeIterable&&maybeIterable[IS_ITERABLE_SENTINEL])}function isKeyed(maybeKeyed){return!!(maybeKeyed&&maybeKeyed[IS_KEYED_SENTINEL])}function isIndexed(maybeIndexed){return!!(maybeIndexed&&maybeIndexed[IS_INDEXED_SENTINEL])}function isAssociative(maybeAssociative){return isKeyed(maybeAssociative)||isIndexed(maybeAssociative)}function isOrdered(maybeOrdered){return!!(maybeOrdered&&maybeOrdered[IS_ORDERED_SENTINEL])}Iterable.isIterable=isIterable;Iterable.isKeyed=isKeyed;Iterable.isIndexed=isIndexed;Iterable.isAssociative=isAssociative;Iterable.isOrdered=isOrdered;Iterable.Keyed=KeyedIterable;Iterable.Indexed=IndexedIterable;Iterable.Set=SetIterable;var IS_ITERABLE_SENTINEL="@@__IMMUTABLE_ITERABLE__@@";var IS_KEYED_SENTINEL="@@__IMMUTABLE_KEYED__@@";var IS_INDEXED_SENTINEL="@@__IMMUTABLE_INDEXED__@@";var IS_ORDERED_SENTINEL="@@__IMMUTABLE_ORDERED__@@";var ITERATE_KEYS=0;var ITERATE_VALUES=1;var ITERATE_ENTRIES=2;var REAL_ITERATOR_SYMBOL=typeof Symbol==="function"&&Symbol.iterator;var FAUX_ITERATOR_SYMBOL="@@iterator";var ITERATOR_SYMBOL=REAL_ITERATOR_SYMBOL||FAUX_ITERATOR_SYMBOL;function Iterator(next){this.next=next}Iterator.prototype.toString=function(){return"[Iterator]"};Iterator.KEYS=ITERATE_KEYS;Iterator.VALUES=ITERATE_VALUES;Iterator.ENTRIES=ITERATE_ENTRIES;Iterator.prototype.inspect=Iterator.prototype.toSource=function(){return this.toString()};Iterator.prototype[ITERATOR_SYMBOL]=function(){return this};function iteratorValue(type,k,v,iteratorResult){var value=type===0?k:type===1?v:[k,v];iteratorResult?iteratorResult.value=value:iteratorResult={value:value,done:false};return iteratorResult}function iteratorDone(){return{value:undefined,done:true}}function hasIterator(maybeIterable){return!!getIteratorFn(maybeIterable)}function isIterator(maybeIterator){return maybeIterator&&typeof maybeIterator.next==="function"}function getIterator(iterable){var iteratorFn=getIteratorFn(iterable);return iteratorFn&&iteratorFn.call(iterable)}function getIteratorFn(iterable){var iteratorFn=iterable&&(REAL_ITERATOR_SYMBOL&&iterable[REAL_ITERATOR_SYMBOL]||iterable[FAUX_ITERATOR_SYMBOL]);if(typeof iteratorFn==="function"){return iteratorFn}}function isArrayLike(value){return value&&typeof value.length==="number"}createClass(Seq,Iterable);function Seq(value){return value===null||value===undefined?emptySequence():isIterable(value)?value.toSeq():seqFromValue(value)}Seq.of=function(){return Seq(arguments)};Seq.prototype.toSeq=function(){return this};Seq.prototype.toString=function(){return this.__toString("Seq {","}")};Seq.prototype.cacheResult=function(){if(!this._cache&&this.__iterateUncached){this._cache=this.entrySeq().toArray();this.size=this._cache.length}return this};Seq.prototype.__iterate=function(fn,reverse){return seqIterate(this,fn,reverse,true)};Seq.prototype.__iterator=function(type,reverse){return seqIterator(this,type,reverse,true)};createClass(KeyedSeq,Seq);function KeyedSeq(value){return value===null||value===undefined?emptySequence().toKeyedSeq():isIterable(value)?isKeyed(value)?value.toSeq():value.fromEntrySeq():keyedSeqFromValue(value)}KeyedSeq.of=function(){return KeyedSeq(arguments)};KeyedSeq.prototype.toKeyedSeq=function(){return this};KeyedSeq.prototype.toSeq=function(){return this};createClass(IndexedSeq,Seq);function IndexedSeq(value){return value===null||value===undefined?emptySequence():!isIterable(value)?indexedSeqFromValue(value):isKeyed(value)?value.entrySeq():value.toIndexedSeq()}IndexedSeq.of=function(){return IndexedSeq(arguments)};IndexedSeq.prototype.toIndexedSeq=function(){return this};IndexedSeq.prototype.toString=function(){return this.__toString("Seq [","]")};IndexedSeq.prototype.__iterate=function(fn,reverse){return seqIterate(this,fn,reverse,false)};IndexedSeq.prototype.__iterator=function(type,reverse){return seqIterator(this,type,reverse,false)};createClass(SetSeq,Seq);function SetSeq(value){return(value===null||value===undefined?emptySequence():!isIterable(value)?indexedSeqFromValue(value):isKeyed(value)?value.entrySeq():value).toSetSeq()}SetSeq.of=function(){return SetSeq(arguments)};SetSeq.prototype.toSetSeq=function(){return this};Seq.isSeq=isSeq;Seq.Keyed=KeyedSeq;Seq.Set=SetSeq;Seq.Indexed=IndexedSeq;var IS_SEQ_SENTINEL="@@__IMMUTABLE_SEQ__@@";Seq.prototype[IS_SEQ_SENTINEL]=true;createClass(ArraySeq,IndexedSeq);function ArraySeq(array){this._array=array;this.size=array.length}ArraySeq.prototype.get=function(index,notSetValue){return this.has(index)?this._array[wrapIndex(this,index)]:notSetValue};ArraySeq.prototype.__iterate=function(fn,reverse){var array=this._array;var maxIndex=array.length-1;for(var ii=0;ii<=maxIndex;ii++){if(fn(array[reverse?maxIndex-ii:ii],ii,this)===false){return ii+1}}return ii};ArraySeq.prototype.__iterator=function(type,reverse){var array=this._array;var maxIndex=array.length-1;var ii=0;return new Iterator(function(){return ii>maxIndex?iteratorDone():iteratorValue(type,ii,array[reverse?maxIndex-ii++:ii++])})};createClass(ObjectSeq,KeyedSeq);function ObjectSeq(object){var keys=Object.keys(object);this._object=object;this._keys=keys;this.size=keys.length}ObjectSeq.prototype.get=function(key,notSetValue){if(notSetValue!==undefined&&!this.has(key)){return notSetValue}return this._object[key]};ObjectSeq.prototype.has=function(key){return this._object.hasOwnProperty(key)};ObjectSeq.prototype.__iterate=function(fn,reverse){var object=this._object;var keys=this._keys;var maxIndex=keys.length-1;for(var ii=0;ii<=maxIndex;ii++){var key=keys[reverse?maxIndex-ii:ii];if(fn(object[key],key,this)===false){return ii+1}}return ii};ObjectSeq.prototype.__iterator=function(type,reverse){var object=this._object;var keys=this._keys;var maxIndex=keys.length-1;var ii=0;return new Iterator(function(){var key=keys[reverse?maxIndex-ii:ii];return ii++>maxIndex?iteratorDone():iteratorValue(type,key,object[key])})};ObjectSeq.prototype[IS_ORDERED_SENTINEL]=true;createClass(IterableSeq,IndexedSeq);function IterableSeq(iterable){this._iterable=iterable;this.size=iterable.length||iterable.size}IterableSeq.prototype.__iterateUncached=function(fn,reverse){if(reverse){return this.cacheResult().__iterate(fn,reverse) }var iterable=this._iterable;var iterator=getIterator(iterable);var iterations=0;if(isIterator(iterator)){var step;while(!(step=iterator.next()).done){if(fn(step.value,iterations++,this)===false){break}}}return iterations};IterableSeq.prototype.__iteratorUncached=function(type,reverse){if(reverse){return this.cacheResult().__iterator(type,reverse)}var iterable=this._iterable;var iterator=getIterator(iterable);if(!isIterator(iterator)){return new Iterator(iteratorDone)}var iterations=0;return new Iterator(function(){var step=iterator.next();return step.done?step:iteratorValue(type,iterations++,step.value)})};createClass(IteratorSeq,IndexedSeq);function IteratorSeq(iterator){this._iterator=iterator;this._iteratorCache=[]}IteratorSeq.prototype.__iterateUncached=function(fn,reverse){if(reverse){return this.cacheResult().__iterate(fn,reverse)}var iterator=this._iterator;var cache=this._iteratorCache;var iterations=0;while(iterations=cache.length){var step=iterator.next();if(step.done){return step}cache[iterations]=step.value}return iteratorValue(type,iterations,cache[iterations++])})};function isSeq(maybeSeq){return!!(maybeSeq&&maybeSeq[IS_SEQ_SENTINEL])}var EMPTY_SEQ;function emptySequence(){return EMPTY_SEQ||(EMPTY_SEQ=new ArraySeq([]))}function keyedSeqFromValue(value){var seq=Array.isArray(value)?new ArraySeq(value).fromEntrySeq():isIterator(value)?new IteratorSeq(value).fromEntrySeq():hasIterator(value)?new IterableSeq(value).fromEntrySeq():typeof value==="object"?new ObjectSeq(value):undefined;if(!seq){throw new TypeError("Expected Array or iterable object of [k, v] entries, "+"or keyed object: "+value)}return seq}function indexedSeqFromValue(value){var seq=maybeIndexedSeqFromValue(value);if(!seq){throw new TypeError("Expected Array or iterable object of values: "+value)}return seq}function seqFromValue(value){var seq=maybeIndexedSeqFromValue(value)||typeof value==="object"&&new ObjectSeq(value);if(!seq){throw new TypeError("Expected Array or iterable object of values, or keyed object: "+value)}return seq}function maybeIndexedSeqFromValue(value){return isArrayLike(value)?new ArraySeq(value):isIterator(value)?new IteratorSeq(value):hasIterator(value)?new IterableSeq(value):undefined}function seqIterate(seq,fn,reverse,useKeys){var cache=seq._cache;if(cache){var maxIndex=cache.length-1;for(var ii=0;ii<=maxIndex;ii++){var entry=cache[reverse?maxIndex-ii:ii];if(fn(entry[1],useKeys?entry[0]:ii,seq)===false){return ii+1}}return ii}return seq.__iterateUncached(fn,reverse)}function seqIterator(seq,type,reverse,useKeys){var cache=seq._cache;if(cache){var maxIndex=cache.length-1;var ii=0;return new Iterator(function(){var entry=cache[reverse?maxIndex-ii:ii];return ii++>maxIndex?iteratorDone():iteratorValue(type,useKeys?entry[0]:ii-1,entry[1])})}return seq.__iteratorUncached(type,reverse)}createClass(Collection,Iterable);function Collection(){throw TypeError("Abstract")}createClass(KeyedCollection,Collection);function KeyedCollection(){}createClass(IndexedCollection,Collection);function IndexedCollection(){}createClass(SetCollection,Collection);function SetCollection(){}Collection.Keyed=KeyedCollection;Collection.Indexed=IndexedCollection;Collection.Set=SetCollection;function is(valueA,valueB){if(valueA===valueB||valueA!==valueA&&valueB!==valueB){return true}if(!valueA||!valueB){return false}if(typeof valueA.valueOf==="function"&&typeof valueB.valueOf==="function"){valueA=valueA.valueOf();valueB=valueB.valueOf()}return typeof valueA.equals==="function"&&typeof valueB.equals==="function"?valueA.equals(valueB):valueA===valueB||valueA!==valueA&&valueB!==valueB}function fromJS(json,converter){return converter?fromJSWith(converter,json,"",{"":json}):fromJSDefault(json)}function fromJSWith(converter,json,key,parentJSON){if(Array.isArray(json)){return converter.call(parentJSON,key,IndexedSeq(json).map(function(v,k){return fromJSWith(converter,v,k,json)}))}if(isPlainObj(json)){return converter.call(parentJSON,key,KeyedSeq(json).map(function(v,k){return fromJSWith(converter,v,k,json)}))}return json}function fromJSDefault(json){if(Array.isArray(json)){return IndexedSeq(json).map(fromJSDefault).toList()}if(isPlainObj(json)){return KeyedSeq(json).map(fromJSDefault).toMap()}return json}function isPlainObj(value){return value&&value.constructor===Object}var Math__imul=typeof Math.imul==="function"&&Math.imul(4294967295,2)===-2?Math.imul:function Math__imul(a,b){a=a|0;b=b|0;var c=a&65535;var d=b&65535;return c*d+((a>>>16)*d+c*(b>>>16)<<16>>>0)|0};function smi(i32){return i32>>>1&1073741824|i32&3221225471}function hash(o){if(o===false||o===null||o===undefined){return 0}if(typeof o.valueOf==="function"){o=o.valueOf();if(o===false||o===null||o===undefined){return 0}}if(o===true){return 1}var type=typeof o;if(type==="number"){var h=o|0;if(h!==o){h^=o*4294967295}while(o>4294967295){o/=4294967295;h^=o}return smi(h)}if(type==="string"){return o.length>STRING_HASH_CACHE_MIN_STRLEN?cachedHashString(o):hashString(o)}if(typeof o.hashCode==="function"){return o.hashCode()}return hashJSObj(o)}function cachedHashString(string){var hash=stringHashCache[string];if(hash===undefined){hash=hashString(string);if(STRING_HASH_CACHE_SIZE===STRING_HASH_CACHE_MAX_SIZE){STRING_HASH_CACHE_SIZE=0;stringHashCache={}}STRING_HASH_CACHE_SIZE++;stringHashCache[string]=hash}return hash}function hashString(string){var hash=0;for(var ii=0;ii0){switch(node.nodeType){case 1:return node.uniqueID;case 9:return node.documentElement&&node.documentElement.uniqueID}}}var weakMap=typeof WeakMap==="function"&&new WeakMap;var objHashUID=0;var UID_HASH_KEY="__immutablehash__";if(typeof Symbol==="function"){UID_HASH_KEY=Symbol(UID_HASH_KEY)}var STRING_HASH_CACHE_MIN_STRLEN=16;var STRING_HASH_CACHE_MAX_SIZE=255;var STRING_HASH_CACHE_SIZE=0;var stringHashCache={};function invariant(condition,error){if(!condition)throw new Error(error)}function assertNotInfinite(size){invariant(size!==Infinity,"Cannot perform this action with an infinite size.")}createClass(ToKeyedSequence,KeyedSeq);function ToKeyedSequence(indexed,useKeys){this._iter=indexed;this._useKeys=useKeys;this.size=indexed.size}ToKeyedSequence.prototype.get=function(key,notSetValue){return this._iter.get(key,notSetValue)};ToKeyedSequence.prototype.has=function(key){return this._iter.has(key)};ToKeyedSequence.prototype.valueSeq=function(){return this._iter.valueSeq()};ToKeyedSequence.prototype.reverse=function(){var this$0=this;var reversedSequence=reverseFactory(this,true);if(!this._useKeys){reversedSequence.valueSeq=function(){return this$0._iter.toSeq().reverse()}}return reversedSequence};ToKeyedSequence.prototype.map=function(mapper,context){var this$0=this;var mappedSequence=mapFactory(this,mapper,context);if(!this._useKeys){mappedSequence.valueSeq=function(){return this$0._iter.toSeq().map(mapper,context)}}return mappedSequence};ToKeyedSequence.prototype.__iterate=function(fn,reverse){var this$0=this;var ii;return this._iter.__iterate(this._useKeys?function(v,k){return fn(v,k,this$0)}:(ii=reverse?resolveSize(this):0,function(v){return fn(v,reverse?--ii:ii++,this$0)}),reverse)};ToKeyedSequence.prototype.__iterator=function(type,reverse){if(this._useKeys){return this._iter.__iterator(type,reverse)}var iterator=this._iter.__iterator(ITERATE_VALUES,reverse);var ii=reverse?resolveSize(this):0;return new Iterator(function(){var step=iterator.next();return step.done?step:iteratorValue(type,reverse?--ii:ii++,step.value,step)})};ToKeyedSequence.prototype[IS_ORDERED_SENTINEL]=true;createClass(ToIndexedSequence,IndexedSeq);function ToIndexedSequence(iter){this._iter=iter;this.size=iter.size}ToIndexedSequence.prototype.contains=function(value){return this._iter.contains(value)};ToIndexedSequence.prototype.__iterate=function(fn,reverse){var this$0=this;var iterations=0;return this._iter.__iterate(function(v){return fn(v,iterations++,this$0)},reverse)};ToIndexedSequence.prototype.__iterator=function(type,reverse){var iterator=this._iter.__iterator(ITERATE_VALUES,reverse);var iterations=0;return new Iterator(function(){var step=iterator.next();return step.done?step:iteratorValue(type,iterations++,step.value,step)})};createClass(ToSetSequence,SetSeq);function ToSetSequence(iter){this._iter=iter;this.size=iter.size}ToSetSequence.prototype.has=function(key){return this._iter.contains(key)};ToSetSequence.prototype.__iterate=function(fn,reverse){var this$0=this;return this._iter.__iterate(function(v){return fn(v,v,this$0)},reverse)};ToSetSequence.prototype.__iterator=function(type,reverse){var iterator=this._iter.__iterator(ITERATE_VALUES,reverse);return new Iterator(function(){var step=iterator.next();return step.done?step:iteratorValue(type,step.value,step.value,step)})};createClass(FromEntriesSequence,KeyedSeq);function FromEntriesSequence(entries){this._iter=entries;this.size=entries.size}FromEntriesSequence.prototype.entrySeq=function(){return this._iter.toSeq()};FromEntriesSequence.prototype.__iterate=function(fn,reverse){var this$0=this;return this._iter.__iterate(function(entry){if(entry){validateEntry(entry);return fn(entry[1],entry[0],this$0)}},reverse)};FromEntriesSequence.prototype.__iterator=function(type,reverse){var iterator=this._iter.__iterator(ITERATE_VALUES,reverse);return new Iterator(function(){while(true){var step=iterator.next();if(step.done){return step}var entry=step.value;if(entry){validateEntry(entry);return type===ITERATE_ENTRIES?step:iteratorValue(type,entry[0],entry[1],step)}}})};ToIndexedSequence.prototype.cacheResult=ToKeyedSequence.prototype.cacheResult=ToSetSequence.prototype.cacheResult=FromEntriesSequence.prototype.cacheResult=cacheResultThrough;function flipFactory(iterable){var flipSequence=makeSequence(iterable);flipSequence._iter=iterable;flipSequence.size=iterable.size;flipSequence.flip=function(){return iterable};flipSequence.reverse=function(){var reversedSequence=iterable.reverse.apply(this);reversedSequence.flip=function(){return iterable.reverse()};return reversedSequence};flipSequence.has=function(key){return iterable.contains(key)};flipSequence.contains=function(key){return iterable.has(key)};flipSequence.cacheResult=cacheResultThrough;flipSequence.__iterateUncached=function(fn,reverse){var this$0=this;return iterable.__iterate(function(v,k){return fn(k,v,this$0)!==false},reverse)};flipSequence.__iteratorUncached=function(type,reverse){if(type===ITERATE_ENTRIES){var iterator=iterable.__iterator(type,reverse);return new Iterator(function(){var step=iterator.next();if(!step.done){var k=step.value[0];step.value[0]=step.value[1];step.value[1]=k}return step})}return iterable.__iterator(type===ITERATE_VALUES?ITERATE_KEYS:ITERATE_VALUES,reverse)};return flipSequence}function mapFactory(iterable,mapper,context){var mappedSequence=makeSequence(iterable);mappedSequence.size=iterable.size;mappedSequence.has=function(key){return iterable.has(key)};mappedSequence.get=function(key,notSetValue){var v=iterable.get(key,NOT_SET);return v===NOT_SET?notSetValue:mapper.call(context,v,key,iterable)};mappedSequence.__iterateUncached=function(fn,reverse){var this$0=this;return iterable.__iterate(function(v,k,c){return fn(mapper.call(context,v,k,c),k,this$0)!==false},reverse)};mappedSequence.__iteratorUncached=function(type,reverse){var iterator=iterable.__iterator(ITERATE_ENTRIES,reverse);return new Iterator(function(){var step=iterator.next();if(step.done){return step}var entry=step.value;var key=entry[0];return iteratorValue(type,key,mapper.call(context,entry[1],key,iterable),step)})};return mappedSequence}function reverseFactory(iterable,useKeys){var reversedSequence=makeSequence(iterable);reversedSequence._iter=iterable;reversedSequence.size=iterable.size;reversedSequence.reverse=function(){return iterable};if(iterable.flip){reversedSequence.flip=function(){var flipSequence=flipFactory(iterable);flipSequence.reverse=function(){return iterable.flip()};return flipSequence}}reversedSequence.get=function(key,notSetValue){return iterable.get(useKeys?key:-1-key,notSetValue)};reversedSequence.has=function(key){return iterable.has(useKeys?key:-1-key)};reversedSequence.contains=function(value){return iterable.contains(value)};reversedSequence.cacheResult=cacheResultThrough;reversedSequence.__iterate=function(fn,reverse){var this$0=this;return iterable.__iterate(function(v,k){return fn(v,k,this$0)},!reverse)};reversedSequence.__iterator=function(type,reverse){return iterable.__iterator(type,!reverse)};return reversedSequence}function filterFactory(iterable,predicate,context,useKeys){var filterSequence=makeSequence(iterable);if(useKeys){filterSequence.has=function(key){var v=iterable.get(key,NOT_SET);return v!==NOT_SET&&!!predicate.call(context,v,key,iterable)};filterSequence.get=function(key,notSetValue){var v=iterable.get(key,NOT_SET);return v!==NOT_SET&&predicate.call(context,v,key,iterable)?v:notSetValue}}filterSequence.__iterateUncached=function(fn,reverse){var this$0=this;var iterations=0;iterable.__iterate(function(v,k,c){if(predicate.call(context,v,k,c)){iterations++;return fn(v,useKeys?k:iterations-1,this$0)}},reverse);return iterations};filterSequence.__iteratorUncached=function(type,reverse){var iterator=iterable.__iterator(ITERATE_ENTRIES,reverse);var iterations=0;return new Iterator(function(){while(true){var step=iterator.next();if(step.done){return step}var entry=step.value;var key=entry[0];var value=entry[1];if(predicate.call(context,value,key,iterable)){return iteratorValue(type,useKeys?key:iterations++,value,step)}}})};return filterSequence}function countByFactory(iterable,grouper,context){var groups=Map().asMutable();iterable.__iterate(function(v,k){groups.update(grouper.call(context,v,k,iterable),0,function(a){return a+1})});return groups.asImmutable()}function groupByFactory(iterable,grouper,context){var isKeyedIter=isKeyed(iterable);var groups=(isOrdered(iterable)?OrderedMap():Map()).asMutable();iterable.__iterate(function(v,k){groups.update(grouper.call(context,v,k,iterable),function(a){return a=a||[],a.push(isKeyedIter?[k,v]:v),a})});var coerce=iterableClass(iterable);return groups.map(function(arr){return reify(iterable,coerce(arr))})}function sliceFactory(iterable,begin,end,useKeys){var originalSize=iterable.size;if(wholeSlice(begin,end,originalSize)){return iterable}var resolvedBegin=resolveBegin(begin,originalSize);var resolvedEnd=resolveEnd(end,originalSize);if(resolvedBegin!==resolvedBegin||resolvedEnd!==resolvedEnd){return sliceFactory(iterable.toSeq().cacheResult(),begin,end,useKeys)}var sliceSize=resolvedEnd-resolvedBegin;if(sliceSize<0){sliceSize=0}var sliceSeq=makeSequence(iterable);sliceSeq.size=sliceSize===0?sliceSize:iterable.size&&sliceSize||undefined;if(!useKeys&&isSeq(iterable)&&sliceSize>=0){sliceSeq.get=function(index,notSetValue){index=wrapIndex(this,index);return index>=0&&indexsliceSize){return iteratorDone()}var step=iterator.next();if(useKeys||type===ITERATE_VALUES){return step}else if(type===ITERATE_KEYS){return iteratorValue(type,iterations-1,undefined,step)}else{return iteratorValue(type,iterations-1,step.value[1],step)}})};return sliceSeq}function takeWhileFactory(iterable,predicate,context){var takeSequence=makeSequence(iterable);takeSequence.__iterateUncached=function(fn,reverse){var this$0=this;if(reverse){return this.cacheResult().__iterate(fn,reverse)}var iterations=0;iterable.__iterate(function(v,k,c){return predicate.call(context,v,k,c)&&++iterations&&fn(v,k,this$0)});return iterations};takeSequence.__iteratorUncached=function(type,reverse){var this$0=this;if(reverse){return this.cacheResult().__iterator(type,reverse)}var iterator=iterable.__iterator(ITERATE_ENTRIES,reverse);var iterating=true;return new Iterator(function(){if(!iterating){return iteratorDone()}var step=iterator.next();if(step.done){return step}var entry=step.value;var k=entry[0];var v=entry[1];if(!predicate.call(context,v,k,this$0)){iterating=false;return iteratorDone()}return type===ITERATE_ENTRIES?step:iteratorValue(type,k,v,step)})};return takeSequence}function skipWhileFactory(iterable,predicate,context,useKeys){var skipSequence=makeSequence(iterable);skipSequence.__iterateUncached=function(fn,reverse){var this$0=this;if(reverse){return this.cacheResult().__iterate(fn,reverse)}var isSkipping=true;var iterations=0;iterable.__iterate(function(v,k,c){if(!(isSkipping&&(isSkipping=predicate.call(context,v,k,c)))){iterations++;return fn(v,useKeys?k:iterations-1,this$0)}});return iterations};skipSequence.__iteratorUncached=function(type,reverse){var this$0=this;if(reverse){return this.cacheResult().__iterator(type,reverse)}var iterator=iterable.__iterator(ITERATE_ENTRIES,reverse);var skipping=true;var iterations=0;return new Iterator(function(){var step,k,v;do{step=iterator.next();if(step.done){if(useKeys||type===ITERATE_VALUES){return step}else if(type===ITERATE_KEYS){return iteratorValue(type,iterations++,undefined,step)}else{return iteratorValue(type,iterations++,step.value[1],step)}}var entry=step.value;k=entry[0];v=entry[1];skipping&&(skipping=predicate.call(context,v,k,this$0))}while(skipping);return type===ITERATE_ENTRIES?step:iteratorValue(type,k,v,step)})};return skipSequence}function concatFactory(iterable,values){var isKeyedIterable=isKeyed(iterable);var iters=[iterable].concat(values).map(function(v){if(!isIterable(v)){v=isKeyedIterable?keyedSeqFromValue(v):indexedSeqFromValue(Array.isArray(v)?v:[v])}else if(isKeyedIterable){v=KeyedIterable(v)}return v}).filter(function(v){return v.size!==0});if(iters.length===0){return iterable}if(iters.length===1){var singleton=iters[0];if(singleton===iterable||isKeyedIterable&&isKeyed(singleton)||isIndexed(iterable)&&isIndexed(singleton)){return singleton}}var concatSeq=new ArraySeq(iters);if(isKeyedIterable){concatSeq=concatSeq.toKeyedSeq()}else if(!isIndexed(iterable)){concatSeq=concatSeq.toSetSeq()}concatSeq=concatSeq.flatten(true);concatSeq.size=iters.reduce(function(sum,seq){if(sum!==undefined){var size=seq.size;if(size!==undefined){return sum+size}}},0);return concatSeq}function flattenFactory(iterable,depth,useKeys){var flatSequence=makeSequence(iterable);flatSequence.__iterateUncached=function(fn,reverse){var iterations=0;var stopped=false;function flatDeep(iter,currentDepth){var this$0=this;iter.__iterate(function(v,k){if((!depth||currentDepth0}function zipWithFactory(keyIter,zipper,iters){var zipSequence=makeSequence(keyIter);zipSequence.size=new ArraySeq(iters).map(function(i){return i.size}).min();zipSequence.__iterate=function(fn,reverse){var iterator=this.__iterator(ITERATE_VALUES,reverse);var step;var iterations=0;while(!(step=iterator.next()).done){if(fn(step.value,iterations++,this)===false){break}}return iterations};zipSequence.__iteratorUncached=function(type,reverse){var iterators=iters.map(function(i){return i=Iterable(i),getIterator(reverse?i.reverse():i)});var iterations=0;var isDone=false;return new Iterator(function(){var steps;if(!isDone){steps=iterators.map(function(i){return i.next()});isDone=steps.some(function(s){return s.done})}if(isDone){return iteratorDone()}return iteratorValue(type,iterations++,zipper.apply(null,steps.map(function(s){return s.value})))})};return zipSequence}function reify(iter,seq){return isSeq(iter)?seq:iter.constructor(seq)}function validateEntry(entry){if(entry!==Object(entry)){throw new TypeError("Expected [K, V] tuple: "+entry)}}function resolveSize(iter){assertNotInfinite(iter.size);return ensureSize(iter)}function iterableClass(iterable){return isKeyed(iterable)?KeyedIterable:isIndexed(iterable)?IndexedIterable:SetIterable}function makeSequence(iterable){return Object.create((isKeyed(iterable)?KeyedSeq:isIndexed(iterable)?IndexedSeq:SetSeq).prototype)}function cacheResultThrough(){if(this._iter.cacheResult){this._iter.cacheResult();this.size=this._iter.size;return this}else{return Seq.prototype.cacheResult.call(this)}}function defaultComparator(a,b){return a>b?1:a=MAX_ARRAY_MAP_SIZE){return createNodes(ownerID,entries,key,value)}var isEditable=ownerID&&ownerID===this.ownerID;var newEntries=isEditable?entries:arrCopy(entries);if(exists){if(removed){idx===len-1?newEntries.pop():newEntries[idx]=newEntries.pop()}else{newEntries[idx]=[key,value]}}else{newEntries.push([key,value])}if(isEditable){this.entries=newEntries;return this}return new ArrayMapNode(ownerID,newEntries)};function BitmapIndexedNode(ownerID,bitmap,nodes){this.ownerID=ownerID;this.bitmap=bitmap;this.nodes=nodes}BitmapIndexedNode.prototype.get=function(shift,keyHash,key,notSetValue){if(keyHash===undefined){keyHash=hash(key)}var bit=1<<((shift===0?keyHash:keyHash>>>shift)&MASK);var bitmap=this.bitmap;return(bitmap&bit)===0?notSetValue:this.nodes[popCount(bitmap&bit-1)].get(shift+SHIFT,keyHash,key,notSetValue)};BitmapIndexedNode.prototype.update=function(ownerID,shift,keyHash,key,value,didChangeSize,didAlter){if(keyHash===undefined){keyHash=hash(key)}var keyHashFrag=(shift===0?keyHash:keyHash>>>shift)&MASK;var bit=1<=MAX_BITMAP_INDEXED_SIZE){return expandNodes(ownerID,nodes,bitmap,keyHashFrag,newNode)}if(exists&&!newNode&&nodes.length===2&&isLeafNode(nodes[idx^1])){return nodes[idx^1]}if(exists&&newNode&&nodes.length===1&&isLeafNode(newNode)){return newNode}var isEditable=ownerID&&ownerID===this.ownerID;var newBitmap=exists?newNode?bitmap:bitmap^bit:bitmap|bit;var newNodes=exists?newNode?setIn(nodes,idx,newNode,isEditable):spliceOut(nodes,idx,isEditable):spliceIn(nodes,idx,newNode,isEditable);if(isEditable){this.bitmap=newBitmap;this.nodes=newNodes;return this}return new BitmapIndexedNode(ownerID,newBitmap,newNodes)};function HashArrayMapNode(ownerID,count,nodes){this.ownerID=ownerID;this.count=count;this.nodes=nodes}HashArrayMapNode.prototype.get=function(shift,keyHash,key,notSetValue){if(keyHash===undefined){keyHash=hash(key)}var idx=(shift===0?keyHash:keyHash>>>shift)&MASK;var node=this.nodes[idx];return node?node.get(shift+SHIFT,keyHash,key,notSetValue):notSetValue};HashArrayMapNode.prototype.update=function(ownerID,shift,keyHash,key,value,didChangeSize,didAlter){if(keyHash===undefined){keyHash=hash(key)}var idx=(shift===0?keyHash:keyHash>>>shift)&MASK; var removed=value===NOT_SET;var nodes=this.nodes;var node=nodes[idx];if(removed&&!node){return this}var newNode=updateNode(node,ownerID,shift+SHIFT,keyHash,key,value,didChangeSize,didAlter);if(newNode===node){return this}var newCount=this.count;if(!node){newCount++}else if(!newNode){newCount--;if(newCount>>shift)&MASK;var idx2=(shift===0?keyHash:keyHash>>>shift)&MASK;var newNode;var nodes=idx1===idx2?[mergeIntoNode(node,ownerID,shift+SHIFT,keyHash,entry)]:(newNode=new ValueNode(ownerID,keyHash,entry),idx1>>=1){expandedNodes[ii]=bitmap&1?nodes[count++]:undefined}expandedNodes[including]=node;return new HashArrayMapNode(ownerID,count+1,expandedNodes)}function mergeIntoMapWith(map,merger,iterables){var iters=[];for(var ii=0;ii>1&1431655765);x=(x&858993459)+(x>>2&858993459);x=x+(x>>4)&252645135;x=x+(x>>8);x=x+(x>>16);return x&127}function setIn(array,idx,val,canEdit){var newArray=canEdit?array:arrCopy(array);newArray[idx]=val;return newArray}function spliceIn(array,idx,val,canEdit){var newLen=array.length+1;if(canEdit&&idx+1===newLen){array[idx]=val;return array}var newArray=new Array(newLen);var after=0;for(var ii=0;ii0&&size=this.size){return notSetValue}index+=this._origin;var node=listNodeFor(this,index);return node&&node.array[index&MASK]};List.prototype.set=function(index,value){return updateList(this,index,value)};List.prototype.remove=function(index){return!this.has(index)?this:index===0?this.shift():index===this.size-1?this.pop():this.splice(index,1)};List.prototype.clear=function(){if(this.size===0){return this}if(this.__ownerID){this.size=this._origin=this._capacity=0;this._level=SHIFT;this._root=this._tail=null;this.__hash=undefined;this.__altered=true;return this}return emptyList()};List.prototype.push=function(){var values=arguments;var oldSize=this.size;return this.withMutations(function(list){setListBounds(list,0,oldSize+values.length);for(var ii=0;ii>>level&MASK;if(originIndex>=this.array.length){return new VNode([],ownerID)}var removingFirst=originIndex===0;var newChild;if(level>0){var oldChild=this.array[originIndex];newChild=oldChild&&oldChild.removeBefore(ownerID,level-SHIFT,index);if(newChild===oldChild&&removingFirst){return this}}if(removingFirst&&!newChild){return this}var editable=editableVNode(this,ownerID);if(!removingFirst){for(var ii=0;ii>>level&MASK;if(sizeIndex>=this.array.length){return this}var removingLast=sizeIndex===this.array.length-1;var newChild;if(level>0){var oldChild=this.array[sizeIndex];newChild=oldChild&&oldChild.removeAfter(ownerID,level-SHIFT,index);if(newChild===oldChild&&removingLast){return this}}if(removingLast&&!newChild){return this}var editable=editableVNode(this,ownerID);if(!removingLast){editable.array.pop()}if(newChild){editable.array[sizeIndex]=newChild}return editable};var DONE={};function iterateList(list,reverse){var left=list._origin;var right=list._capacity;var tailPos=getTailOffset(right);var tail=list._tail;return iterateNodeOrLeaf(list._root,list._level,0);function iterateNodeOrLeaf(node,level,offset){return level===0?iterateLeaf(node,offset):iterateNode(node,level,offset)}function iterateLeaf(node,offset){var array=offset===tailPos?tail&&tail.array:node&&node.array;var from=offset>left?0:left-offset;var to=right-offset;if(to>SIZE){to=SIZE}return function(){if(from===to){return DONE}var idx=reverse?--to:from++;return array&&array[idx]}}function iterateNode(node,level,offset){var values;var array=node&&node.array;var from=offset>left?0:left-offset>>level;var to=(right-offset>>level)+1;if(to>SIZE){to=SIZE}return function(){do{if(values){var value=values();if(value!==DONE){return value}values=null}if(from===to){return DONE}var idx=reverse?--to:from++;values=iterateNodeOrLeaf(array&&array[idx],level-SHIFT,offset+(idx<=list.size||index<0){return list.withMutations(function(list){index<0?setListBounds(list,index).set(0,value):setListBounds(list,0,index+1).set(index,value)})}index+=list._origin;var newTail=list._tail;var newRoot=list._root;var didAlter=MakeRef(DID_ALTER);if(index>=getTailOffset(list._capacity)){newTail=updateVNode(newTail,list.__ownerID,0,index,value,didAlter)}else{newRoot=updateVNode(newRoot,list.__ownerID,list._level,index,value,didAlter)}if(!didAlter.value){return list}if(list.__ownerID){list._root=newRoot;list._tail=newTail;list.__hash=undefined;list.__altered=true;return list}return makeList(list._origin,list._capacity,list._level,newRoot,newTail)}function updateVNode(node,ownerID,level,index,value,didAlter){var idx=index>>>level&MASK;var nodeHas=node&&idx0){var lowerNode=node&&node.array[idx];var newLowerNode=updateVNode(lowerNode,ownerID,level-SHIFT,index,value,didAlter);if(newLowerNode===lowerNode){return node}newNode=editableVNode(node,ownerID);newNode.array[idx]=newLowerNode;return newNode}if(nodeHas&&node.array[idx]===value){return node}SetRef(didAlter);newNode=editableVNode(node,ownerID);if(value===undefined&&idx===newNode.array.length-1){newNode.array.pop()}else{newNode.array[idx]=value}return newNode}function editableVNode(node,ownerID){if(ownerID&&node&&ownerID===node.ownerID){return node}return new VNode(node?node.array.slice():[],ownerID)}function listNodeFor(list,rawIndex){if(rawIndex>=getTailOffset(list._capacity)){return list._tail}if(rawIndex<1<0){node=node.array[rawIndex>>>level&MASK];level-=SHIFT}return node}}function setListBounds(list,begin,end){var owner=list.__ownerID||new OwnerID;var oldOrigin=list._origin;var oldCapacity=list._capacity;var newOrigin=oldOrigin+begin;var newCapacity=end===undefined?oldCapacity:end<0?oldCapacity+end:oldOrigin+end;if(newOrigin===oldOrigin&&newCapacity===oldCapacity){return list}if(newOrigin>=newCapacity){return list.clear()}var newLevel=list._level;var newRoot=list._root;var offsetShift=0;while(newOrigin+offsetShift<0){newRoot=new VNode(newRoot&&newRoot.array.length?[undefined,newRoot]:[],owner);newLevel+=SHIFT;offsetShift+=1<=1<oldTailOffset?new VNode([],owner):oldTail;if(oldTail&&newTailOffset>oldTailOffset&&newOriginSHIFT;level-=SHIFT){var idx=oldTailOffset>>>level&MASK;node=node.array[idx]=editableVNode(node.array[idx],owner)}node.array[oldTailOffset>>>SHIFT&MASK]=oldTail}if(newCapacity=newTailOffset){newOrigin-=newTailOffset;newCapacity-=newTailOffset;newLevel=SHIFT;newRoot=null;newTail=newTail&&newTail.removeBefore(owner,0,newOrigin)}else if(newOrigin>oldOrigin||newTailOffset>>newLevel&MASK;if(beginIndex!==newTailOffset>>>newLevel&MASK){break}if(beginIndex){offsetShift+=(1<oldOrigin){newRoot=newRoot.removeBefore(owner,newLevel,newOrigin-offsetShift)}if(newRoot&&newTailOffsetmaxSize){maxSize=iter.size}if(!isIterable(value)){iter=iter.map(function(v){return fromJS(v)})}iters.push(iter)}if(maxSize>list.size){list=list.setSize(maxSize)}return mergeIntoCollectionWith(list,merger,iters)}function getTailOffset(size){return size>>SHIFT<=SIZE&&list.size>=map.size*2){newList=list.filter(function(entry,idx){return entry!==undefined&&i!==idx});newMap=newList.toKeyedSeq().map(function(entry){return entry[0]}).flip().toMap();if(omap.__ownerID){newMap.__ownerID=newList.__ownerID=omap.__ownerID}}else{newMap=map.remove(k);newList=i===list.size-1?list.pop():list.set(i,undefined)}}else{if(has){if(v===list.get(i)[1]){return omap}newMap=map;newList=list.set(i,[k,v])}else{newMap=map.set(k,list.size);newList=list.set(list.size,[k,v])}}if(omap.__ownerID){omap.size=newMap.size;omap._map=newMap;omap._list=newList;omap.__hash=undefined;return omap}return makeOrderedMap(newMap,newList)}createClass(Stack,IndexedCollection);function Stack(value){return value===null||value===undefined?emptyStack():isStack(value)?value:emptyStack().unshiftAll(value)}Stack.of=function(){return this(arguments)};Stack.prototype.toString=function(){return this.__toString("Stack [","]")};Stack.prototype.get=function(index,notSetValue){var head=this._head;while(head&&index--){head=head.next}return head?head.value:notSetValue};Stack.prototype.peek=function(){return this._head&&this._head.value};Stack.prototype.push=function(){if(arguments.length===0){return this}var newSize=this.size+arguments.length;var head=this._head;for(var ii=arguments.length-1;ii>=0;ii--){head={value:arguments[ii],next:head}}if(this.__ownerID){this.size=newSize;this._head=head;this.__hash=undefined;this.__altered=true;return this}return makeStack(newSize,head)};Stack.prototype.pushAll=function(iter){iter=IndexedIterable(iter);if(iter.size===0){return this}assertNotInfinite(iter.size);var newSize=this.size;var head=this._head;iter.reverse().forEach(function(value){newSize++;head={value:value,next:head}});if(this.__ownerID){this.size=newSize;this._head=head;this.__hash=undefined;this.__altered=true;return this}return makeStack(newSize,head)};Stack.prototype.pop=function(){return this.slice(1)};Stack.prototype.unshift=function(){return this.push.apply(this,arguments)};Stack.prototype.unshiftAll=function(iter){return this.pushAll(iter)};Stack.prototype.shift=function(){return this.pop.apply(this,arguments)};Stack.prototype.clear=function(){if(this.size===0){return this}if(this.__ownerID){this.size=0;this._head=undefined;this.__hash=undefined;this.__altered=true;return this}return emptyStack()};Stack.prototype.slice=function(begin,end){if(wholeSlice(begin,end,this.size)){return this}var resolvedBegin=resolveBegin(begin,this.size);var resolvedEnd=resolveEnd(end,this.size);if(resolvedEnd!==this.size){return IndexedCollection.prototype.slice.call(this,begin,end)}var newSize=this.size-resolvedBegin;var head=this._head;while(resolvedBegin--){head=head.next}if(this.__ownerID){this.size=newSize;this._head=head;this.__hash=undefined;this.__altered=true;return this}return makeStack(newSize,head)};Stack.prototype.__ensureOwner=function(ownerID){if(ownerID===this.__ownerID){return this}if(!ownerID){this.__ownerID=ownerID;this.__altered=false;return this}return makeStack(this.size,this._head,ownerID,this.__hash)};Stack.prototype.__iterate=function(fn,reverse){if(reverse){return this.toSeq().cacheResult.__iterate(fn,reverse)}var iterations=0;var node=this._head;while(node){if(fn(node.value,iterations++,this)===false){break}node=node.next}return iterations};Stack.prototype.__iterator=function(type,reverse){if(reverse){return this.toSeq().cacheResult().__iterator(type,reverse)}var iterations=0;var node=this._head;return new Iterator(function(){if(node){var value=node.value;node=node.next;return iteratorValue(type,iterations++,value)}return iteratorDone()})};function isStack(maybeStack){return!!(maybeStack&&maybeStack[IS_STACK_SENTINEL])}Stack.isStack=isStack;var IS_STACK_SENTINEL="@@__IMMUTABLE_STACK__@@";var StackPrototype=Stack.prototype;StackPrototype[IS_STACK_SENTINEL]=true;StackPrototype.withMutations=MapPrototype.withMutations;StackPrototype.asMutable=MapPrototype.asMutable;StackPrototype.asImmutable=MapPrototype.asImmutable;StackPrototype.wasAltered=MapPrototype.wasAltered;function makeStack(size,head,ownerID,hash){var map=Object.create(StackPrototype);map.size=size;map._head=head;map.__ownerID=ownerID;map.__hash=hash;map.__altered=false;return map}var EMPTY_STACK;function emptyStack(){return EMPTY_STACK||(EMPTY_STACK=makeStack(0))}createClass(Set,SetCollection);function Set(value){return value===null||value===undefined?emptySet():isSet(value)?value:emptySet().withMutations(function(set){var iter=SetIterable(value);assertNotInfinite(iter.size);iter.forEach(function(v){return set.add(v)})})}Set.of=function(){return this(arguments)};Set.fromKeys=function(value){return this(KeyedIterable(value).keySeq())};Set.prototype.toString=function(){return this.__toString("Set {","}")};Set.prototype.has=function(value){return this._map.has(value)};Set.prototype.add=function(value){return updateSet(this,this._map.set(value,true))};Set.prototype.remove=function(value){return updateSet(this,this._map.remove(value))};Set.prototype.clear=function(){return updateSet(this,this._map.clear())};Set.prototype.union=function(){var iters=SLICE$0.call(arguments,0);iters=iters.filter(function(x){return x.size!==0});if(iters.length===0){return this}if(this.size===0&&iters.length===1){return this.constructor(iters[0])}return this.withMutations(function(set){for(var ii=0;ii1?" by "+this._step:"")+" ]"};Range.prototype.get=function(index,notSetValue){return this.has(index)?this._start+wrapIndex(this,index)*this._step:notSetValue};Range.prototype.contains=function(searchValue){var possibleIndex=(searchValue-this._start)/this._step;return possibleIndex>=0&&possibleIndex=0&&indexmaxIndex?iteratorDone():iteratorValue(type,ii++,v)})};Range.prototype.equals=function(other){return other instanceof Range?this._start===other._start&&this._end===other._end&&this._step===other._step:deepEqual(this,other)};var EMPTY_RANGE;createClass(Repeat,IndexedSeq);function Repeat(value,times){if(!(this instanceof Repeat)){return new Repeat(value,times)}this._value=value;this.size=times===undefined?Infinity:Math.max(0,times);if(this.size===0){if(EMPTY_REPEAT){return EMPTY_REPEAT}EMPTY_REPEAT=this}}Repeat.prototype.toString=function(){if(this.size===0){return"Repeat []"}return"Repeat [ "+this._value+" "+this.size+" times ]"};Repeat.prototype.get=function(index,notSetValue){return this.has(index)?this._value:notSetValue};Repeat.prototype.contains=function(searchValue){return is(this._value,searchValue)};Repeat.prototype.slice=function(begin,end){var size=this.size;return wholeSlice(begin,end,size)?this:new Repeat(this._value,resolveEnd(end,size)-resolveBegin(begin,size))};Repeat.prototype.reverse=function(){return this};Repeat.prototype.indexOf=function(searchValue){if(is(this._value,searchValue)){return 0}return-1};Repeat.prototype.lastIndexOf=function(searchValue){if(is(this._value,searchValue)){return this.size}return-1};Repeat.prototype.__iterate=function(fn,reverse){for(var ii=0;iithis.size)?notSetValue:this.find(function(_,key){return key===index},undefined,notSetValue)},has:function(index){index=wrapIndex(this,index);return index>=0&&(this.size!==undefined?this.size===Infinity||indexb?-1:0}function hashIterable(iterable){if(iterable.size===Infinity){return 0}var ordered=isOrdered(iterable);var keyed=isKeyed(iterable);var h=ordered?1:0;var size=iterable.__iterate(keyed?ordered?function(v,k){h=31*h+hashMerge(hash(v),hash(k))|0}:function(v,k){h=h+hashMerge(hash(v),hash(k))|0}:ordered?function(v){h=31*h+hash(v)|0}:function(v){h=h+hash(v)|0});return murmurHashOfSize(size,h)}function murmurHashOfSize(size,h){h=Math__imul(h,3432918353);h=Math__imul(h<<15|h>>>-15,461845907);h=Math__imul(h<<13|h>>>-13,5);h=(h+3864292196|0)^size;h=Math__imul(h^h>>>16,2246822507);h=Math__imul(h^h>>>13,3266489909);h=smi(h^h>>>16);return h}function hashMerge(a,b){return a^b+2654435769+(a<<6)+(a>>2)|0}var Immutable={Iterable:Iterable,Seq:Seq,Collection:Collection,Map:Map,OrderedMap:OrderedMap,List:List,Stack:Stack,Set:Set,OrderedSet:OrderedSet,Record:Record,Range:Range,Repeat:Repeat,is:is,fromJS:fromJS};return Immutable})},{}],62:[function(require,module,exports){module.exports={name:"rxmarbles",version:"1.3.0",author:"Andre Staltz",repository:{type:"git",url:"git@github.com:staltz/rxmarbles.git"},license:"BSD 3-Clause",main:"js/app.js",dependencies:{cyclejs:"0.11.0",immutable:"^3.6.2"},devDependencies:{"6to5":"^2.12.6",browserify:"8.0.2",less:"^2.2.0","uglify-js":"~2.4.13",watchify:"~0.4.1"},scripts:{preinstall:"rm -rf build && rm -rf node_modules && mkdir -p ignore/es5src",postinstall:"ln -s ../ignore/es5src node_modules/rxmarbles && ln -s ../package.json node_modules/package.json",less:"lessc styles/main.less dist/css/main.css","6to5":"mkdir -p ignore/es5src && 6to5 src --out-dir ignore/es5src",browserify:"browserify -e ignore/es5src/app.js --outfile dist/js/app.js","browserify-element":"browserify -e ignore/es5src/element.js --outfile dist/js/element.js",build:"npm run less && npm run 6to5 && npm run browserify","build-production":"npm run less && npm run 6to5 && npm run browserify && npm run uglify","build-element":"npm run less && npm run 6to5 && npm run browserify-element","build-element-production":"npm run less && npm run 6to5 && npm run browserify-element && npm run uglify-element",uglify:"uglifyjs dist/js/app.js -o dist/js/app.js","uglify-element":"uglifyjs dist/js/element.js -o dist/js/element.js","update-gh-pages":"git checkout gh-pages && git merge master && rm dist/js/app.js && gulp build && git add dist/js/app.js && git commit --amend --no-edit && git push origin gh-pages && git checkout master",release:"npm run release-patch","release-patch":"git checkout master && npm run build && git commit -a -m 'Compiled' && npm version patch && git push origin master --tags && npm publish","release-minor":"git checkout master && npm run build && git commit -a -m 'Compiled' && npm version minor && git push origin master --tags && npm publish","release-major":"git checkout master && npm run build && git commit -a -m 'Compiled' && npm version major && git push origin master --tags && npm publish"}}},{}],63:[function(require,module,exports){"use strict";var Cycle=require("cyclejs");var Rx=Cycle.Rx;var packageJson=require("package.json");var RxPackageJson=require("cyclejs/node_modules/rx/package.json");var DEFAULT_EXAMPLE="merge";module.exports=Cycle.createModel(function(){return{route$:Rx.Observable.fromEvent(window,"hashchange").map(function(hashEvent){return hashEvent.target.location.hash.replace("#","")}).startWith(window.location.hash.replace("#","")||DEFAULT_EXAMPLE),appVersion$:Rx.Observable.just(packageJson.version),rxVersion$:Rx.Observable.just(RxPackageJson.version)}})},{cyclejs:52,"cyclejs/node_modules/rx/package.json":10,"package.json":62}],64:[function(require,module,exports){"use strict";var _interopRequire=function(obj){return obj&&(obj["default"]||obj)};var Cycle=_interopRequire(require("cyclejs"));var Colors=_interopRequire(require("rxmarbles/styles/colors"));var Dimens=_interopRequire(require("rxmarbles/styles/dimens"));var Fonts=_interopRequire(require("rxmarbles/styles/fonts"));var mergeStyles=require("rxmarbles/styles/utils").mergeStyles;var Rx=Cycle.Rx;var h=Cycle.h;var rxmarblesGithubUrl="https://github.com/staltz/rxmarbles";var rxjsGithubUrl="https://github.com/Reactive-Extensions/RxJS";var pageRowWidth="1060px";var sandboxWidth="820px";var pageRowStyle={position:"relative",width:pageRowWidth,margin:"0 auto"};var pageRowChildStyle={display:"inline-block",marginLeft:"-"+Dimens.spaceMedium};var pageRowFirstChildStyle=mergeStyles(pageRowChildStyle,{width:"calc("+pageRowWidth+" - "+sandboxWidth+" - "+Dimens.spaceMedium+")",marginRight:Dimens.spaceMedium});var pageRowLastChildStyle=mergeStyles(pageRowChildStyle,{width:sandboxWidth});function vrenderHeader(){return h("div",{style:pageRowStyle},[h("h1",{style:mergeStyles({fontFamily:Fonts.fontSpecial,color:Colors.greyDark},pageRowFirstChildStyle)},"RxMarbles"),h("h3",{style:mergeStyles({color:Colors.greyDark},pageRowLastChildStyle)},"Interactive diagrams of Rx Observables")])}function vrenderContent(route){return h("div",{style:mergeStyles(pageRowStyle,{marginTop:Dimens.spaceSmall})},[h("div",{style:pageRowFirstChildStyle},h("x-operators-menu")),h("div",{style:mergeStyles({position:"absolute",top:"0"},pageRowLastChildStyle)},h("x-sandbox",{route:route,width:"820px"}))])}function vrenderFooter(appVersion,rxVersion){return h("section",{style:{position:"fixed",bottom:"2px",right:Dimens.spaceMedium,color:Colors.greyDark}},[h("a",{href:""+rxmarblesGithubUrl+"/releases/tag/v"+appVersion},"v"+appVersion)," built on ",h("a",{href:""+rxjsGithubUrl+"/tree/v"+rxVersion},"RxJS v"+rxVersion)," by ",h("a",{href:"https://twitter.com/andrestaltz"},"@andrestaltz")])}module.exports=Cycle.createView(function(Model){return{vtree$:Rx.Observable.combineLatest(Model.get("route$"),Model.get("appVersion$"),Model.get("rxVersion$"),function(route,appVersion,rxVersion){return h("div",[vrenderHeader(),vrenderContent(route),vrenderFooter(appVersion,rxVersion)])})}})},{cyclejs:52,"rxmarbles/styles/colors":84,"rxmarbles/styles/dimens":85,"rxmarbles/styles/fonts":86,"rxmarbles/styles/utils":87}],65:[function(require,module,exports){"use strict";var _interopRequire=function(obj){return obj&&(obj["default"]||obj)};var Cycle=_interopRequire(require("cyclejs"));var mergeStyles=require("rxmarbles/styles/utils").mergeStyles;var textUnselectable=require("rxmarbles/styles/utils").textUnselectable;var elevation1Style=require("rxmarbles/styles/utils").elevation1Style;var Rx=Cycle.Rx;var h=Cycle.h;var DiagramCompletionComponentModel=Cycle.createModel(function(Properties,Intent){return{time$:Properties.get("time$"),isDraggable$:Properties.get("isDraggable$").startWith(false),isTall$:Properties.get("isTall$").startWith(false),style$:Properties.get("style$").startWith({}),isHighlighted$:Rx.Observable.merge(Intent.get("startHighlight$").map(function(){return true}),Intent.get("stopHighlight$").map(function(){return false})).startWith(false)}});var DiagramCompletionComponentView=Cycle.createView(function(Model){var createContainerStyle=function(inputStyle){return{display:"inline-block",position:"relative",width:"calc(8 * "+inputStyle.thickness+")",height:inputStyle.height,margin:"0 calc(-4 * "+inputStyle.thickness+")"}};var createInnerStyle=function(inputStyle){return{width:inputStyle.thickness,height:"50%",marginLeft:"calc(3.5 * "+inputStyle.thickness+")",marginTop:"calc("+inputStyle.height+" / 4.0)",backgroundColor:inputStyle.color}};var vrender=function(time,isDraggable,isTall,inputStyle,isHighlighted){var containerStyle=createContainerStyle(inputStyle);var innerStyle=createInnerStyle(inputStyle);return h("div",{style:mergeStyles({left:""+time+"%"},containerStyle,isDraggable?draggableContainerStyle:{}),onmousedown:"completionMouseDown$",onmouseenter:"mouseenter$",onmouseleave:"mouseleave$"},[h("div",{style:mergeStyles(innerStyle,isDraggable&&isHighlighted?elevation1Style:null,isTall?innerTallStyle:null)})])};var draggableContainerStyle={cursor:"ew-resize"};var innerTallStyle={height:"100%",marginTop:0};return{vtree$:Rx.Observable.combineLatest(Model.get("time$"),Model.get("isDraggable$"),Model.get("isTall$"),Model.get("style$"),Model.get("isHighlighted$"),vrender)}});var DiagramCompletionComponentIntent=Cycle.createIntent(function(View){return{startHighlight$:View.get("mouseenter$").map(function(){return 1}),stopHighlight$:View.get("mouseleave$").map(function(){return 1})}});module.exports=Cycle.createView(function(Properties){var Model=DiagramCompletionComponentModel.clone();var View=DiagramCompletionComponentView.clone();var Intent=DiagramCompletionComponentIntent.clone();Intent.inject(View).inject(Model).inject(Properties,Intent);return{vtree$:View.get("vtree$"),mousedown$:View.get("completionMouseDown$")}})},{cyclejs:52,"rxmarbles/styles/utils":87}],66:[function(require,module,exports){"use strict";var _slicedToArray=function(arr,i){if(Array.isArray(arr)){return arr}else{var _arr=[];for(var _iterator=arr[Symbol.iterator](),_step;!(_step=_iterator.next()).done;){_arr.push(_step.value);if(i&&_arr.length===i)break}return _arr}};var _interopRequire=function(obj){return obj&&(obj["default"]||obj)};var Cycle=_interopRequire(require("cyclejs"));var Immutable=_interopRequire(require("immutable"));var Rx=Cycle.Rx;module.exports=Cycle.createIntent(function(View){var getPxToPercentageRatio=function(element){var pxToPercentage=undefined;try{if(element&&element.parentElement&&element.parentElement.clientWidth){pxToPercentage=100/element.parentElement.clientWidth}else{throw new Error("Invalid marble parent or parent width.")}}catch(err){console.warn(err);pxToPercentage=.15}return pxToPercentage};var makeDeltaTime$=function(mouseDown$,resultFn){return mouseDown$.map(function(downevent){var target=downevent.currentTarget;var pxToPercentage=getPxToPercentageRatio(target);return mouseMove$.takeUntil(mouseUp$).pairwise().map(function(_ref){var _ref2=_slicedToArray(_ref,2);var ev1=_ref2[0];var ev2=_ref2[1];var dx=ev2.pageX-ev1.pageX;var deltaTime=dx*pxToPercentage;if(!!resultFn){return resultFn(deltaTime,target)}else{return deltaTime}}).filter(function(x){return x!==0})}).concatAll()};var mouseMove$=Rx.Observable.fromEvent(document,"mousemove");var mouseUp$=Rx.Observable.fromEvent(document,"mouseup");return{changeMarbleTime$:makeDeltaTime$(View.get("marbleMouseDown$"),function(deltaTime,target){return Immutable.Map({deltaTime:deltaTime,id:target.attributes["data-marble-id"].value})}),changeEndTime$:makeDeltaTime$(View.get("completionMouseDown$"))}})},{cyclejs:52,immutable:61}],67:[function(require,module,exports){"use strict";var _interopRequire=function(obj){return obj&&(obj["default"]||obj)};var Cycle=_interopRequire(require("cyclejs"));var Rx=Cycle.Rx;module.exports=Cycle.createModel(function(Properties,Intent){var findLargestMarbleTime=function(diagramData){return diagramData.get("notifications").max(function(notifA,notifB){if(notifA.get("time")notifB.get("time")){return 1}return 0}).get("time")};var applyChangeMarbleTime=function(diagramData,marbleDelta){return diagramData.set("notifications",diagramData.get("notifications").map(function(notif){if(String(notif.get("id"))===String(marbleDelta.get("id"))){var newTime=notif.get("time")+marbleDelta.get("deltaTime");return notif.set("time",newTime)}else{return notif}}))};var applyChangeEndTime=function(diagramData,endDelta){return diagramData.set("end",diagramData.get("end")+endDelta)};var applyMarbleDataConstraints=function(marbleData){var newTime=marbleData.get("time"); +}createClass(Record,KeyedCollection);function Record(defaultValues,name){var RecordType=function Record(values){if(!(this instanceof RecordType)){return new RecordType(values)}this._map=Map(values)};var keys=Object.keys(defaultValues);var RecordTypePrototype=RecordType.prototype=Object.create(RecordPrototype);RecordTypePrototype.constructor=RecordType;name&&(RecordTypePrototype._name=name);RecordTypePrototype._defaultValues=defaultValues;RecordTypePrototype._keys=keys;RecordTypePrototype.size=keys.length;try{keys.forEach(function(key){Object.defineProperty(RecordType.prototype,key,{get:function(){return this.get(key)},set:function(value){invariant(this.__ownerID,"Cannot set on an immutable record.");this.set(key,value)}})})}catch(error){}return RecordType}Record.prototype.toString=function(){return this.__toString(recordName(this)+" {","}")};Record.prototype.has=function(k){return this._defaultValues.hasOwnProperty(k)};Record.prototype.get=function(k,notSetValue){if(!this.has(k)){return notSetValue}var defaultVal=this._defaultValues[k];return this._map?this._map.get(k,defaultVal):defaultVal};Record.prototype.clear=function(){if(this.__ownerID){this._map&&this._map.clear();return this}var SuperRecord=Object.getPrototypeOf(this).constructor;return SuperRecord._empty||(SuperRecord._empty=makeRecord(this,emptyMap()))};Record.prototype.set=function(k,v){if(!this.has(k)){throw new Error('Cannot set unknown key "'+k+'" on '+recordName(this))}var newMap=this._map&&this._map.set(k,v);if(this.__ownerID||newMap===this._map){return this}return makeRecord(this,newMap)};Record.prototype.remove=function(k){if(!this.has(k)){return this}var newMap=this._map&&this._map.remove(k);if(this.__ownerID||newMap===this._map){return this}return makeRecord(this,newMap)};Record.prototype.wasAltered=function(){return this._map.wasAltered()};Record.prototype.__iterator=function(type,reverse){var this$0=this;return KeyedIterable(this._defaultValues).map(function(_,k){return this$0.get(k)}).__iterator(type,reverse)};Record.prototype.__iterate=function(fn,reverse){var this$0=this;return KeyedIterable(this._defaultValues).map(function(_,k){return this$0.get(k)}).__iterate(fn,reverse)};Record.prototype.__ensureOwner=function(ownerID){if(ownerID===this.__ownerID){return this}var newMap=this._map&&this._map.__ensureOwner(ownerID);if(!ownerID){this.__ownerID=ownerID;this._map=newMap;return this}return makeRecord(this,newMap,ownerID)};var RecordPrototype=Record.prototype;RecordPrototype[DELETE]=RecordPrototype.remove;RecordPrototype.deleteIn=RecordPrototype.removeIn=MapPrototype.removeIn;RecordPrototype.merge=MapPrototype.merge;RecordPrototype.mergeWith=MapPrototype.mergeWith;RecordPrototype.mergeIn=MapPrototype.mergeIn;RecordPrototype.mergeDeep=MapPrototype.mergeDeep;RecordPrototype.mergeDeepWith=MapPrototype.mergeDeepWith;RecordPrototype.mergeDeepIn=MapPrototype.mergeDeepIn;RecordPrototype.setIn=MapPrototype.setIn;RecordPrototype.update=MapPrototype.update;RecordPrototype.updateIn=MapPrototype.updateIn;RecordPrototype.withMutations=MapPrototype.withMutations;RecordPrototype.asMutable=MapPrototype.asMutable;RecordPrototype.asImmutable=MapPrototype.asImmutable;function makeRecord(likeRecord,map,ownerID){var record=Object.create(Object.getPrototypeOf(likeRecord));record._map=map;record.__ownerID=ownerID;return record}function recordName(record){return record._name||record.constructor.name}function deepEqual(a,b){if(a===b){return true}if(!isIterable(b)||a.size!==undefined&&b.size!==undefined&&a.size!==b.size||a.__hash!==undefined&&b.__hash!==undefined&&a.__hash!==b.__hash||isKeyed(a)!==isKeyed(b)||isIndexed(a)!==isIndexed(b)||isOrdered(a)!==isOrdered(b)){return false}if(a.size===0&&b.size===0){return true}var notAssociative=!isAssociative(a);if(isOrdered(a)){var entries=a.entries();return b.every(function(v,k){var entry=entries.next().value;return entry&&is(entry[1],v)&&(notAssociative||is(entry[0],k))})&&entries.next().done}var flipped=false;if(a.size===undefined){if(b.size===undefined){a.cacheResult()}else{flipped=true;var _=a;a=b;b=_}}var allEqual=true;var bSize=b.__iterate(function(v,k){if(notAssociative?!a.has(v):flipped?!is(v,a.get(k,NOT_SET)):!is(a.get(k,NOT_SET),v)){allEqual=false;return false}});return allEqual&&a.size===bSize}createClass(Range,IndexedSeq);function Range(start,end,step){if(!(this instanceof Range)){return new Range(start,end,step)}invariant(step!==0,"Cannot step a Range by 0");start=start||0;if(end===undefined){end=Infinity}step=step===undefined?1:Math.abs(step);if(end1?" by "+this._step:"")+" ]"};Range.prototype.get=function(index,notSetValue){return this.has(index)?this._start+wrapIndex(this,index)*this._step:notSetValue};Range.prototype.contains=function(searchValue){var possibleIndex=(searchValue-this._start)/this._step;return possibleIndex>=0&&possibleIndex=0&&indexmaxIndex?iteratorDone():iteratorValue(type,ii++,v)})};Range.prototype.equals=function(other){return other instanceof Range?this._start===other._start&&this._end===other._end&&this._step===other._step:deepEqual(this,other)};var EMPTY_RANGE;createClass(Repeat,IndexedSeq);function Repeat(value,times){if(!(this instanceof Repeat)){return new Repeat(value,times)}this._value=value;this.size=times===undefined?Infinity:Math.max(0,times);if(this.size===0){if(EMPTY_REPEAT){return EMPTY_REPEAT}EMPTY_REPEAT=this}}Repeat.prototype.toString=function(){if(this.size===0){return"Repeat []"}return"Repeat [ "+this._value+" "+this.size+" times ]"};Repeat.prototype.get=function(index,notSetValue){return this.has(index)?this._value:notSetValue};Repeat.prototype.contains=function(searchValue){return is(this._value,searchValue)};Repeat.prototype.slice=function(begin,end){var size=this.size;return wholeSlice(begin,end,size)?this:new Repeat(this._value,resolveEnd(end,size)-resolveBegin(begin,size))};Repeat.prototype.reverse=function(){return this};Repeat.prototype.indexOf=function(searchValue){if(is(this._value,searchValue)){return 0}return-1};Repeat.prototype.lastIndexOf=function(searchValue){if(is(this._value,searchValue)){return this.size}return-1};Repeat.prototype.__iterate=function(fn,reverse){for(var ii=0;iithis.size)?notSetValue:this.find(function(_,key){return key===index},undefined,notSetValue)},has:function(index){index=wrapIndex(this,index);return index>=0&&(this.size!==undefined?this.size===Infinity||indexb?-1:0}function hashIterable(iterable){if(iterable.size===Infinity){return 0}var ordered=isOrdered(iterable);var keyed=isKeyed(iterable);var h=ordered?1:0;var size=iterable.__iterate(keyed?ordered?function(v,k){h=31*h+hashMerge(hash(v),hash(k))|0}:function(v,k){h=h+hashMerge(hash(v),hash(k))|0}:ordered?function(v){h=31*h+hash(v)|0}:function(v){h=h+hash(v)|0});return murmurHashOfSize(size,h)}function murmurHashOfSize(size,h){h=Math__imul(h,3432918353);h=Math__imul(h<<15|h>>>-15,461845907);h=Math__imul(h<<13|h>>>-13,5);h=(h+3864292196|0)^size;h=Math__imul(h^h>>>16,2246822507);h=Math__imul(h^h>>>13,3266489909);h=smi(h^h>>>16);return h}function hashMerge(a,b){return a^b+2654435769+(a<<6)+(a>>2)|0}var Immutable={Iterable:Iterable,Seq:Seq,Collection:Collection,Map:Map,OrderedMap:OrderedMap,List:List,Stack:Stack,Set:Set,OrderedSet:OrderedSet,Record:Record,Range:Range,Repeat:Repeat,is:is,fromJS:fromJS};return Immutable})},{}],62:[function(require,module,exports){module.exports={name:"rxmarbles",version:"1.3.1",author:"Andre Staltz",repository:{type:"git",url:"git@github.com:staltz/rxmarbles.git"},license:"BSD 3-Clause",main:"js/app.js",dependencies:{cyclejs:"0.11.0",immutable:"^3.6.2"},devDependencies:{"6to5":"^2.12.6",browserify:"8.0.2",less:"^2.2.0","uglify-js":"~2.4.13",watchify:"~0.4.1"},scripts:{preinstall:"rm -rf build && rm -rf node_modules && mkdir -p ignore/es5src",postinstall:"ln -s ../ignore/es5src node_modules/rxmarbles && ln -s ../package.json node_modules/package.json",less:"lessc styles/main.less dist/css/main.css","6to5":"mkdir -p ignore/es5src && 6to5 src --out-dir ignore/es5src",browserify:"browserify -e ignore/es5src/app.js --outfile dist/js/app.js","browserify-element":"browserify -e ignore/es5src/element.js --outfile dist/js/element.js",build:"npm run less && npm run 6to5 && npm run browserify","build-production":"npm run less && npm run 6to5 && npm run browserify && npm run uglify","build-element":"npm run less && npm run 6to5 && npm run browserify-element","build-element-production":"npm run less && npm run 6to5 && npm run browserify-element && npm run uglify-element",uglify:"uglifyjs dist/js/app.js -o dist/js/app.js","uglify-element":"uglifyjs dist/js/element.js -o dist/js/element.js","update-gh-pages":"git checkout gh-pages && git merge master && rm dist/js/app.js && gulp build && git add dist/js/app.js && git commit --amend --no-edit && git push origin gh-pages && git checkout master",release:"npm run release-patch","release-patch":"git checkout master && npm run build && git commit -a -m 'Compiled' && npm version patch && git push origin master --tags && npm publish","release-minor":"git checkout master && npm run build && git commit -a -m 'Compiled' && npm version minor && git push origin master --tags && npm publish","release-major":"git checkout master && npm run build && git commit -a -m 'Compiled' && npm version major && git push origin master --tags && npm publish"}}},{}],63:[function(require,module,exports){"use strict";var Cycle=require("cyclejs");var Rx=Cycle.Rx;var packageJson=require("package.json");var RxPackageJson=require("cyclejs/node_modules/rx/package.json");var DEFAULT_EXAMPLE="merge";module.exports=Cycle.createModel(function(){return{route$:Rx.Observable.fromEvent(window,"hashchange").map(function(hashEvent){return hashEvent.target.location.hash.replace("#","")}).startWith(window.location.hash.replace("#","")||DEFAULT_EXAMPLE),appVersion$:Rx.Observable.just(packageJson.version),rxVersion$:Rx.Observable.just(RxPackageJson.version)}})},{cyclejs:52,"cyclejs/node_modules/rx/package.json":10,"package.json":62}],64:[function(require,module,exports){"use strict";var _interopRequire=function(obj){return obj&&(obj["default"]||obj)};var Cycle=_interopRequire(require("cyclejs"));var Colors=_interopRequire(require("rxmarbles/styles/colors"));var Dimens=_interopRequire(require("rxmarbles/styles/dimens"));var Fonts=_interopRequire(require("rxmarbles/styles/fonts"));var mergeStyles=require("rxmarbles/styles/utils").mergeStyles;var Rx=Cycle.Rx;var h=Cycle.h;var rxmarblesGithubUrl="https://github.com/staltz/rxmarbles";var rxjsGithubUrl="https://github.com/Reactive-Extensions/RxJS";var pageRowWidth="1060px";var sandboxWidth="820px";var pageRowStyle={position:"relative",width:pageRowWidth,margin:"0 auto"};var pageRowChildStyle={display:"inline-block",marginLeft:"-"+Dimens.spaceMedium};var pageRowFirstChildStyle=mergeStyles(pageRowChildStyle,{width:"calc("+pageRowWidth+" - "+sandboxWidth+" - "+Dimens.spaceMedium+")",marginRight:Dimens.spaceMedium});var pageRowLastChildStyle=mergeStyles(pageRowChildStyle,{width:sandboxWidth});function vrenderHeader(){return h("div",{style:pageRowStyle},[h("h1",{style:mergeStyles({fontFamily:Fonts.fontSpecial,color:Colors.greyDark},pageRowFirstChildStyle)},"RxMarbles"),h("h3",{style:mergeStyles({color:Colors.greyDark},pageRowLastChildStyle)},"Interactive diagrams of Rx Observables")])}function vrenderContent(route){return h("div",{style:mergeStyles(pageRowStyle,{marginTop:Dimens.spaceSmall})},[h("div",{style:pageRowFirstChildStyle},h("x-operators-menu")),h("div",{style:mergeStyles({position:"absolute",top:"0"},pageRowLastChildStyle)},h("x-sandbox",{route:route,width:"820px"}))])}function vrenderFooter(appVersion,rxVersion){return h("section",{style:{position:"fixed",bottom:"2px",right:Dimens.spaceMedium,color:Colors.greyDark}},[h("a",{href:""+rxmarblesGithubUrl+"/releases/tag/v"+appVersion},"v"+appVersion)," built on ",h("a",{href:""+rxjsGithubUrl+"/tree/v"+rxVersion},"RxJS v"+rxVersion)," by ",h("a",{href:"https://twitter.com/andrestaltz"},"@andrestaltz")])}module.exports=Cycle.createView(function(Model){return{vtree$:Rx.Observable.combineLatest(Model.get("route$"),Model.get("appVersion$"),Model.get("rxVersion$"),function(route,appVersion,rxVersion){return h("div",[vrenderHeader(),vrenderContent(route),vrenderFooter(appVersion,rxVersion)])})}})},{cyclejs:52,"rxmarbles/styles/colors":84,"rxmarbles/styles/dimens":85,"rxmarbles/styles/fonts":86,"rxmarbles/styles/utils":87}],65:[function(require,module,exports){"use strict";var _interopRequire=function(obj){return obj&&(obj["default"]||obj)};var Cycle=_interopRequire(require("cyclejs"));var mergeStyles=require("rxmarbles/styles/utils").mergeStyles;var textUnselectable=require("rxmarbles/styles/utils").textUnselectable;var elevation1Style=require("rxmarbles/styles/utils").elevation1Style;var Rx=Cycle.Rx;var h=Cycle.h;var DiagramCompletionComponentModel=Cycle.createModel(function(Properties,Intent){return{time$:Properties.get("time$"),isDraggable$:Properties.get("isDraggable$").startWith(false),isTall$:Properties.get("isTall$").startWith(false),style$:Properties.get("style$").startWith({}),isHighlighted$:Rx.Observable.merge(Intent.get("startHighlight$").map(function(){return true}),Intent.get("stopHighlight$").map(function(){return false})).startWith(false)}});var DiagramCompletionComponentView=Cycle.createView(function(Model){var createContainerStyle=function(inputStyle){return{display:"inline-block",position:"relative",width:"calc(8 * "+inputStyle.thickness+")",height:inputStyle.height,margin:"0 calc(-4 * "+inputStyle.thickness+")"}};var createInnerStyle=function(inputStyle){return{width:inputStyle.thickness,height:"50%",marginLeft:"calc(3.5 * "+inputStyle.thickness+")",marginTop:"calc("+inputStyle.height+" / 4.0)",backgroundColor:inputStyle.color}};var vrender=function(time,isDraggable,isTall,inputStyle,isHighlighted){var containerStyle=createContainerStyle(inputStyle);var innerStyle=createInnerStyle(inputStyle);return h("div",{style:mergeStyles({left:""+time+"%"},containerStyle,isDraggable?draggableContainerStyle:{}),onmousedown:"completionMouseDown$",onmouseenter:"mouseenter$",onmouseleave:"mouseleave$"},[h("div",{style:mergeStyles(innerStyle,isDraggable&&isHighlighted?elevation1Style:null,isTall?innerTallStyle:null)})])};var draggableContainerStyle={cursor:"ew-resize"};var innerTallStyle={height:"100%",marginTop:0};return{vtree$:Rx.Observable.combineLatest(Model.get("time$"),Model.get("isDraggable$"),Model.get("isTall$"),Model.get("style$"),Model.get("isHighlighted$"),vrender)}});var DiagramCompletionComponentIntent=Cycle.createIntent(function(View){return{startHighlight$:View.get("mouseenter$").map(function(){return 1}),stopHighlight$:View.get("mouseleave$").map(function(){return 1})}});module.exports=Cycle.createView(function(Properties){var Model=DiagramCompletionComponentModel.clone();var View=DiagramCompletionComponentView.clone();var Intent=DiagramCompletionComponentIntent.clone();Intent.inject(View).inject(Model).inject(Properties,Intent);return{vtree$:View.get("vtree$"),mousedown$:View.get("completionMouseDown$")}})},{cyclejs:52,"rxmarbles/styles/utils":87}],66:[function(require,module,exports){"use strict";var _slicedToArray=function(arr,i){if(Array.isArray(arr)){return arr}else{var _arr=[];for(var _iterator=arr[Symbol.iterator](),_step;!(_step=_iterator.next()).done;){_arr.push(_step.value);if(i&&_arr.length===i)break}return _arr}};var _interopRequire=function(obj){return obj&&(obj["default"]||obj)};var Cycle=_interopRequire(require("cyclejs"));var Immutable=_interopRequire(require("immutable"));var Rx=Cycle.Rx;module.exports=Cycle.createIntent(function(View){var getPxToPercentageRatio=function(element){var pxToPercentage=undefined;try{if(element&&element.parentElement&&element.parentElement.clientWidth){pxToPercentage=100/element.parentElement.clientWidth}else{throw new Error("Invalid marble parent or parent width.")}}catch(err){console.warn(err);pxToPercentage=.15}return pxToPercentage};var makeDeltaTime$=function(mouseDown$,resultFn){return mouseDown$.map(function(downevent){var target=downevent.currentTarget;var pxToPercentage=getPxToPercentageRatio(target);return mouseMove$.takeUntil(mouseUp$).pairwise().map(function(_ref){var _ref2=_slicedToArray(_ref,2);var ev1=_ref2[0];var ev2=_ref2[1];var dx=ev2.pageX-ev1.pageX;var deltaTime=dx*pxToPercentage;if(!!resultFn){return resultFn(deltaTime,target)}else{return deltaTime}}).filter(function(x){return x!==0})}).concatAll()};var mouseMove$=Rx.Observable.fromEvent(document,"mousemove");var mouseUp$=Rx.Observable.fromEvent(document,"mouseup");return{changeMarbleTime$:makeDeltaTime$(View.get("marbleMouseDown$"),function(deltaTime,target){return Immutable.Map({deltaTime:deltaTime,id:target.attributes["data-marble-id"].value})}),changeEndTime$:makeDeltaTime$(View.get("completionMouseDown$"))}})},{cyclejs:52,immutable:61}],67:[function(require,module,exports){"use strict";var _interopRequire=function(obj){return obj&&(obj["default"]||obj)};var Cycle=_interopRequire(require("cyclejs"));var Rx=Cycle.Rx;module.exports=Cycle.createModel(function(Properties,Intent){var findLargestMarbleTime=function(diagramData){return diagramData.get("notifications").max(function(notifA,notifB){if(notifA.get("time")notifB.get("time")){return 1}return 0}).get("time")};var applyChangeMarbleTime=function(diagramData,marbleDelta){return diagramData.set("notifications",diagramData.get("notifications").map(function(notif){if(String(notif.get("id"))===String(marbleDelta.get("id"))){var newTime=notif.get("time")+marbleDelta.get("deltaTime");return notif.set("time",newTime)}else{return notif}}))};var applyChangeEndTime=function(diagramData,endDelta){return diagramData.set("end",diagramData.get("end")+endDelta)};var applyMarbleDataConstraints=function(marbleData){var newTime=marbleData.get("time"); newTime=Math.round(newTime);newTime=Math.min(newTime,100);newTime=Math.max(0,newTime);return marbleData.set("time",newTime)};var applyEndTimeConstraint=function(diagramData){var largestMarbleTime=findLargestMarbleTime(diagramData);var newEndTime=diagramData.get("end");newEndTime=Math.max(newEndTime,largestMarbleTime);newEndTime=Math.round(newEndTime);newEndTime=Math.min(newEndTime,100);newEndTime=Math.max(0,newEndTime);return diagramData.set("end",newEndTime)};var applyDiagramDataConstraints=function(diagramData){var newDiagramData=diagramData.set("notifications",diagramData.get("notifications").map(applyMarbleDataConstraints));newDiagramData=applyEndTimeConstraint(newDiagramData);return newDiagramData};var newDiagramDataScanner=function(prev,curr){var currentIsDiagramData=!!curr&&!!curr.get&&!!curr.get("notifications");if(!currentIsDiagramData){var previousIsDiagramData=!!prev&&!!prev.get("notifications");if(!previousIsDiagramData){console.warn("Inconsistency in DiagramComponent.makeNewDiagramData$()")}var diagramData=prev;var changeInstructions=curr;var newDiagramData=undefined;if(typeof changeInstructions==="number"){newDiagramData=applyChangeEndTime(diagramData,changeInstructions)}else{newDiagramData=applyChangeMarbleTime(diagramData,changeInstructions)}return newDiagramData.set("isInitialData",false)}else{return curr.set("isInitialData",true)}};var makeNewDiagramData$=function(data$,changeMarbleTime$,changeEndTime$,interactive$){return data$.merge(changeMarbleTime$).merge(changeEndTime$).scan(newDiagramDataScanner).filter(function(diagramData){return!diagramData.get("isInitialData")}).map(applyDiagramDataConstraints).pausable(interactive$)};return{data$:Properties.get("data$").distinctUntilChanged(),newData$:makeNewDiagramData$(Properties.get("data$").distinctUntilChanged(),Intent.get("changeMarbleTime$"),Intent.get("changeEndTime$"),Properties.get("interactive$")),isInteractive$:Properties.get("interactive$").startWith(false)}})},{cyclejs:52}],68:[function(require,module,exports){"use strict";var _interopRequire=function(obj){return obj&&(obj["default"]||obj)};var Cycle=_interopRequire(require("cyclejs"));var Colors=_interopRequire(require("rxmarbles/styles/colors"));var Dimens=_interopRequire(require("rxmarbles/styles/dimens"));var Fonts=_interopRequire(require("rxmarbles/styles/fonts"));var mergeStyles=require("rxmarbles/styles/utils").mergeStyles;var textUnselectable=require("rxmarbles/styles/utils").textUnselectable;var Rx=Cycle.Rx;var h=Cycle.h;module.exports=Cycle.createView(function(Model){var vrenderMarble=function(marbleData){var isDraggable=arguments[1]===undefined?false:arguments[1];return h("x-marble",{data:marbleData,isDraggable:isDraggable,style:{size:diagramMarbleSize},onmousedown:"marbleMouseDown$"})};var vrenderCompletion=function(diagramData){var isDraggable=arguments[1]===undefined?false:arguments[1];var endTime=diagramData.get("end");var isTall=diagramData.get("notifications").some(function(marbleData){return Math.abs(marbleData.get("time")-diagramData.get("end"))<=MARBLE_WIDTH*.5});return h("x-diagram-completion",{time:endTime,isDraggable:isDraggable,isTall:isTall,style:{thickness:diagramArrowThickness,color:diagramArrowColor,height:diagramCompletionHeight},onmousedown:"completionMouseDown$"})};var vrenderDiagramArrow=function(){return h("div",{style:{backgroundColor:diagramArrowColor,height:diagramArrowThickness,position:"absolute",top:"calc("+diagramVerticalMargin+" + ("+diagramMarbleSize+" / 2))",left:diagramSidePadding,right:diagramSidePadding}})};var vrenderDiagramArrowHead=function(){return h("div",{style:{width:0,height:0,borderTop:""+diagramArrowHeadSize+" solid transparent",borderBottom:""+diagramArrowHeadSize+" solid transparent",borderLeft:"calc(2 * "+diagramArrowHeadSize+") solid "+diagramArrowColor,display:"inline-block",right:"calc("+diagramSidePadding+" - 1px)",position:"absolute",top:"calc("+diagramVerticalMargin+" + ("+diagramMarbleSize+" / 2) \n - "+diagramArrowHeadSize+" + ("+diagramArrowThickness+" / 2))"}})};var vrenderDiagram=function(data,isInteractive){var marblesVTree=data.get("notifications").map(function(notification){return vrenderMarble(notification,isInteractive)}).toArray();var completionVTree=vrenderCompletion(data,isInteractive);return h("div",{style:diagramStyle},[vrenderDiagramArrow(),vrenderDiagramArrowHead(),h("div",{style:diagramBodyStyle},[completionVTree].concat(marblesVTree))])};var MARBLE_WIDTH=5;var diagramSidePadding=Dimens.spaceMedium;var diagramVerticalMargin=Dimens.spaceLarge;var diagramArrowThickness="2px";var diagramArrowSidePadding=Dimens.spaceLarge;var diagramArrowHeadSize="8px";var diagramArrowColor=Colors.black;var diagramMarbleSize=Dimens.spaceLarge;var diagramCompletionHeight="44px";var diagramStyle=mergeStyles({position:"relative",display:"block",width:"100%",height:"calc("+diagramMarbleSize+" + 2 * "+diagramVerticalMargin+")",overflow:"visible",cursor:"default"},textUnselectable);var diagramBodyStyle={position:"absolute",left:"calc("+diagramArrowSidePadding+" + "+diagramSidePadding+" \n + ("+diagramMarbleSize+" / 2))",right:"calc("+diagramArrowSidePadding+" + "+diagramSidePadding+" \n + ("+diagramMarbleSize+" / 2))",top:"calc("+diagramVerticalMargin+" + ("+diagramMarbleSize+" / 2))",height:diagramCompletionHeight,marginTop:"calc(0px - ("+diagramCompletionHeight+" / 2))"};return{vtree$:Rx.Observable.combineLatest(Model.get("data$").merge(Model.get("newData$")),Model.get("isInteractive$"),vrenderDiagram)}})},{cyclejs:52,"rxmarbles/styles/colors":84,"rxmarbles/styles/dimens":85,"rxmarbles/styles/fonts":86,"rxmarbles/styles/utils":87}],69:[function(require,module,exports){"use strict";var _interopRequire=function(obj){return obj&&(obj["default"]||obj)};var Cycle=_interopRequire(require("cyclejs"));var DiagramComponentModel=_interopRequire(require("rxmarbles/components/diagram/diagram-model"));var DiagramComponentView=_interopRequire(require("rxmarbles/components/diagram/diagram-view"));var DiagramComponentIntent=_interopRequire(require("rxmarbles/components/diagram/diagram-intent"));module.exports=Cycle.createView(function(Properties){var Model=DiagramComponentModel.clone();var View=DiagramComponentView.clone();var Intent=DiagramComponentIntent.clone();Intent.inject(View).inject(Model).inject(Properties,Intent);return{vtree$:View.get("vtree$"),newdata$:Model.get("newData$")}})},{cyclejs:52,"rxmarbles/components/diagram/diagram-intent":66,"rxmarbles/components/diagram/diagram-model":67,"rxmarbles/components/diagram/diagram-view":68}],70:[function(require,module,exports){"use strict";var _interopRequire=function(obj){return obj&&(obj["default"]||obj)};var Cycle=_interopRequire(require("cyclejs"));var svg=_interopRequire(require("cyclejs/node_modules/virtual-dom/virtual-hyperscript/svg"));var Colors=_interopRequire(require("rxmarbles/styles/colors"));var mergeStyles=require("rxmarbles/styles/utils").mergeStyles;var svgElevation1Style=require("rxmarbles/styles/utils").svgElevation1Style;var textUnselectable=require("rxmarbles/styles/utils").textUnselectable;var Rx=Cycle.Rx;var h=Cycle.h;var MarbleModel=Cycle.createModel(function(Properties,Intent){return{data$:Properties.get("data$"),isDraggable$:Properties.get("isDraggable$").startWith(false),style$:Properties.get("style$").startWith({}),isHighlighted$:Rx.Observable.merge(Intent.get("startHighlight$").map(function(){return true}),Intent.get("stopHighlight$").map(function(){return false})).startWith(false)}});var MarbleView=Cycle.createView(function(Model){var createContainerStyle=function(inputStyle){return{width:inputStyle.size,height:inputStyle.size,position:"relative",display:"inline-block",margin:"calc(0px - ("+inputStyle.size+" / 2))",bottom:"calc((100% - "+inputStyle.size+") / 2)",cursor:"default"}};var vrenderSvg=function(data,isDraggable,inputStyle,isHighlighted){var color=POSSIBLE_COLORS[data.get("id")%POSSIBLE_COLORS.length];return svg("svg",{style:mergeStyles({overflow:"visible",width:inputStyle.size,height:inputStyle.size},isDraggable&&isHighlighted?svgElevation1Style:{}),attributes:{viewBox:"0 0 1 1"}},[svg("circle",{style:{stroke:Colors.black,fill:color},attributes:{cx:.5,cy:.5,r:.47,"stroke-width":"0.06px"}})])};var vrenderInnerContent=function(data,inputStyle){return h("p",{style:mergeStyles({position:"absolute",width:"100%",height:"100%",top:"0",margin:"0",textAlign:"center",lineHeight:inputStyle.size},textUnselectable)},""+data.get("content"))};var vrender=function(data,isDraggable,inputStyle,isHighlighted){return h("div",{style:mergeStyles({left:""+data.get("time")+"%",zIndex:data.get("time")},createContainerStyle(inputStyle),isDraggable?draggableContainerStyle:null),attributes:{"data-marble-id":data.get("id")},onmousedown:"mousedown$",onmouseenter:"mouseenter$",onmouseleave:"mouseleave$"},[vrenderSvg(data,isDraggable,inputStyle,isHighlighted),vrenderInnerContent(data,inputStyle)])};var POSSIBLE_COLORS=[Colors.blue,Colors.green,Colors.yellow,Colors.red];var draggableContainerStyle={cursor:"ew-resize"};return{vtree$:Rx.Observable.combineLatest(Model.get("data$"),Model.get("isDraggable$"),Model.get("style$"),Model.get("isHighlighted$"),vrender)}});var MarbleIntent=Cycle.createIntent(function(View){return{startHighlight$:View.get("mouseenter$").map(function(){return 1}),stopHighlight$:View.get("mouseleave$").map(function(){return 1})}});module.exports=Cycle.createView(function(Properties){var Model=MarbleModel.clone();var View=MarbleView.clone();var Intent=MarbleIntent.clone();Intent.inject(View).inject(Model).inject(Properties,Intent);return{vtree$:View.get("vtree$"),mousedown$:View.get("mousedown$")}})},{cyclejs:52,"cyclejs/node_modules/virtual-dom/virtual-hyperscript/svg":35,"rxmarbles/styles/colors":84,"rxmarbles/styles/utils":87}],71:[function(require,module,exports){"use strict";var _interopRequire=function(obj){return obj&&(obj["default"]||obj)};var Cycle=_interopRequire(require("cyclejs"));var Colors=_interopRequire(require("rxmarbles/styles/colors"));var Dimens=_interopRequire(require("rxmarbles/styles/dimens"));var mergeStyles=require("rxmarbles/styles/utils").mergeStyles;var Rx=Cycle.Rx;var h=Cycle.h;var OperatorsMenuLinkModel=Cycle.createModel(function(Properties,Intent){return{href$:Properties.get("href$"),content$:Properties.get("content$").startWith(""),isHighlighted$:Rx.Observable.merge(Intent.get("startHighlight$").map(function(){return true}),Intent.get("stopHighlight$").map(function(){return false})).startWith(false)}});var OperatorsMenuLinkView=Cycle.createView(function(Model){var highlightingArrow=h("span",{style:{display:"inline-block",position:"absolute",right:Dimens.spaceTiny}},"❯");return{vtree$:Rx.Observable.combineLatest(Model.get("href$"),Model.get("content$"),Model.get("isHighlighted$"),function(href,content,isHighlighted){return h("a",{style:mergeStyles({position:"relative",display:"block",color:Colors.greyDark},isHighlighted?{color:Colors.black}:null),href:href,onmouseenter:"mouseenter$",onmouseleave:"mouseleave$"},[content,isHighlighted?highlightingArrow:null])})}});var OperatorsMenuLinkIntent=Cycle.createIntent(function(View){return{startHighlight$:View.get("mouseenter$").map(function(){return 1}),stopHighlight$:View.get("mouseleave$").map(function(){return 1})}});module.exports=Cycle.createView(function(Properties){var Model=OperatorsMenuLinkModel.clone();var View=OperatorsMenuLinkView.clone();var Intent=OperatorsMenuLinkIntent.clone();Intent.inject(View).inject(Model).inject(Properties,Intent);return{vtree$:View.get("vtree$")}})},{cyclejs:52,"rxmarbles/styles/colors":84,"rxmarbles/styles/dimens":85,"rxmarbles/styles/utils":87}],72:[function(require,module,exports){"use strict";var _interopRequire=function(obj){return obj&&(obj["default"]||obj)};var Cycle=_interopRequire(require("cyclejs"));var Colors=_interopRequire(require("rxmarbles/styles/colors"));var Dimens=_interopRequire(require("rxmarbles/styles/dimens"));var Examples=_interopRequire(require("rxmarbles/data/examples"));var mergeStyles=require("rxmarbles/styles/utils").mergeStyles;var Rx=Cycle.Rx;var h=Cycle.h;var OperatorsMenuModel=Cycle.createModel(function(){var organizeExamplesByCategory=function(examples){var categoryMap={};for(var key in examples){if(!examples.hasOwnProperty(key))continue;var value=examples[key];value.key=key;if(categoryMap.hasOwnProperty(value.category)){categoryMap[value.category].push(value)}else{categoryMap[value.category]=[value]}}return categoryMap};return{categoryMap$:Rx.Observable.just(organizeExamplesByCategory(Examples))}});var OperatorsMenuView=Cycle.createView(function(Model){var vrenderMenuContent=function(categoryMap){var listItems=[];var isFirstCategory=true;for(var categoryName in categoryMap){if(!categoryMap.hasOwnProperty(categoryName))continue;listItems.push(vrenderExampleCategory(categoryName,isFirstCategory));listItems=listItems.concat(vrenderExampleItems(categoryMap[categoryName]));isFirstCategory=false}listItems.push(h("li",{style:operatorsMenuCategoryStyle},"More"));listItems.push(h("li",{style:operatorsMenuItemStyle},"Coming soon..."));return listItems};var vrenderExampleCategory=function(categoryName,isFirstCategory){return h("li",{style:mergeStyles(operatorsMenuCategoryStyle,isFirstCategory?{marginTop:"0"}:{})},""+categoryName)};var vrenderExampleItems=function(examples){var items=[];for(var i=0;iy){return 1}if(x=45?1.3:label.length>=30?1.5:2;var style={fontFamily:Fonts.fontCode,fontWeight:"400",fontSize:""+fontSize+"rem"};return h("span",{style:style},label)};var vrenderOperator=function(label){var style=mergeStyles({border:"1px solid rgba(0,0,0,0.06)",padding:Dimens.spaceMedium,textAlign:"center"},elevation2Style);return h("div",{style:style},[elevation2Before,vrenderOperatorLabel(label),elevation2After])};var getSandboxStyle=function(width){return mergeStyles({background:Colors.white,width:width,borderRadius:"2px"},elevation1Style)};return{vtree$:Rx.Observable.combineLatest(Model.get("inputDiagrams$"),Model.get("operatorLabel$"),Model.get("outputDiagram$"),Model.get("width$"),function(inputDiagrams,operatorLabel,outputDiagram,width){return h("div",{style:getSandboxStyle(width)},[inputDiagrams.get("diagrams").map(function(diagram){return h("x-diagram",{data:diagram,interactive:true,onnewdata:"diagramNewData$"})}),vrenderOperator(operatorLabel),h("x-diagram",{data:outputDiagram,interactive:false})])})}});var SandboxComponentIntent=Cycle.createIntent(function(View){return{changeInputDiagram$:View.get("diagramNewData$")}});var SandboxComponent=Cycle.createView(function(Attributes){var Model=SandboxComponentModel.clone();var View=SandboxComponentView.clone();var Intent=SandboxComponentIntent.clone();Intent.inject(View).inject(Model).inject(Attributes,Intent);return{vtree$:View.get("vtree$")}});module.exports=SandboxComponent},{cyclejs:52,immutable:61,"rxmarbles/components/sandbox/sandbox-input":73,"rxmarbles/components/sandbox/sandbox-output":74,"rxmarbles/data/examples":80,"rxmarbles/styles/colors":84,"rxmarbles/styles/dimens":85,"rxmarbles/styles/fonts":86,"rxmarbles/styles/utils":87}],76:[function(require,module,exports){"use strict";function calculateNotificationContentHash(content){var SOME_PRIME_NUMBER=877;if(typeof content==="string"){return content.split("").map(function(x){return x.charCodeAt(0)}).reduce(function(x,y){return x+y})}else if(typeof content==="number"){return content*SOME_PRIME_NUMBER}else if(typeof content==="boolean"){return content?SOME_PRIME_NUMBER:SOME_PRIME_NUMBER*3}}function calculateNotificationHash(marbleData){var SMALL_PRIME=7;var LARGE_PRIME=1046527;var MAX=1e5;var contentHash=calculateNotificationContentHash(marbleData.content);return(marbleData.time+contentHash+SMALL_PRIME)*LARGE_PRIME%MAX}module.exports={calculateNotificationHash:calculateNotificationHash,calculateNotificationContentHash:calculateNotificationContentHash}},{}],77:[function(require,module,exports){"use strict";var Rx=require("cyclejs").Rx;module.exports={every:{label:"every(x => x < 10)",inputs:[[{t:5,d:1},{t:15,d:2},{t:25,d:3},{t:35,d:4},{t:65,d:5},80]],apply:function(inputs){return inputs[0].every(function(x){return x.get("content")<10})}},some:{label:"some(x => x > 10)",inputs:[[{t:5,d:2},{t:15,d:30},{t:25,d:22},{t:35,d:5},{t:45,d:60},{t:55,d:1}]],apply:function(inputs){return inputs[0].some(function(x){return x.get("content")>10})}},contains:{label:"contains(22)",inputs:[[{t:5,d:2},{t:15,d:30},{t:25,d:22},{t:35,d:5},{t:45,d:60},{t:55,d:1}]],apply:function(inputs){return inputs[0].map(function(x){return x.get("content")}).contains(22)}},sequenceEqual:{label:"sequenceEqual",inputs:[[{t:5,d:1},{t:15,d:2},{t:25,d:3},{t:35,d:4},{t:65,d:5},85],[{t:2,d:1},{t:20,d:2},{t:40,d:3},{t:70,d:4},{t:77,d:5},85]],apply:function(inputs){return inputs[0].sequenceEqual(inputs[1],function(x,y){return x.get("content")===y.get("content")})}}}},{cyclejs:52}],78:[function(require,module,exports){"use strict";var Rx=require("cyclejs").Rx;module.exports={combineLatest:{label:'combineLatest((x, y) => "" + x + y)',inputs:[[{t:0,d:1},{t:20,d:2},{t:65,d:3},{t:75,d:4},{t:92,d:5}],[{t:10,d:"A"},{t:25,d:"B"},{t:50,d:"C"},{t:57,d:"D"}]],apply:function(inputs){return Rx.Observable.combineLatest(inputs[0],inputs[1],function(x,y){return""+x.get("content")+y.get("content")})}},concat:{label:"concat",inputs:[[{t:0,d:1},{t:15,d:1},{t:50,d:1},57],[{t:0,d:2},{t:8,d:2},12]],apply:function(inputs){return Rx.Observable.concat(inputs)}},merge:{label:"merge",inputs:[[{t:0,d:20},{t:15,d:40},{t:30,d:60},{t:45,d:80},{t:60,d:100}],[{t:37,d:1},{t:68,d:1}]],apply:function(inputs){return Rx.Observable.merge(inputs)}},sample:{label:"sample",inputs:[[{t:0,d:1},{t:20,d:2},{t:40,d:3},{t:60,d:4},{t:80,d:5}],[{t:10,d:"A"},{t:25,d:"B"},{t:33,d:"C"},{t:70,d:"D"},90]],apply:function(inputs){return inputs[0].sample(inputs[1])}},startWith:{label:"startWith(1)",inputs:[[{t:30,d:2},{t:40,d:3}]],apply:function(inputs,scheduler){return inputs[0].startWith(scheduler,1)}},withLatestFrom:{label:'withLatestFrom((x, y) => "" + x + y)',inputs:[[{t:0,d:1},{t:20,d:2},{t:65,d:3},{t:75,d:4},{t:92,d:5}],[{t:10,d:"A"},{t:25,d:"B"},{t:50,d:"C"},{t:57,d:"D"}]],apply:function(inputs){return inputs[0].withLatestFrom(inputs[1],function(x,y){return""+x.get("content")+y.get("content")})}},zip:{label:"zip",inputs:[[{t:0,d:1},{t:20,d:2},{t:65,d:3},{t:75,d:4},{t:92,d:5}],[{t:10,d:"A"},{t:25,d:"B"},{t:50,d:"C"},{t:57,d:"D"}]],apply:function(inputs){return Rx.Observable.zip(inputs[0],inputs[1],function(x,y){return""+x.get("content")+y.get("content")})}}}},{cyclejs:52}],79:[function(require,module,exports){"use strict";var Rx=require("cyclejs").Rx;module.exports={amb:{label:"amb",inputs:[[{t:10,d:20},{t:20,d:40},{t:30,d:60}],[{t:5,d:1},{t:15,d:2},{t:25,d:3}],[{t:20,d:0},{t:32,d:0},{t:44,d:0}]],apply:function(inputs){return Rx.Observable.amb(inputs)}}}},{cyclejs:52}],80:[function(require,module,exports){"use strict";var transformExamples=require("rxmarbles/data/transform-examples");var combineExamples=require("rxmarbles/data/combine-examples");var filterExamples=require("rxmarbles/data/filter-examples");var mathExamples=require("rxmarbles/data/math-examples");var booleanExamples=require("rxmarbles/data/boolean-examples");var conditionalExamples=require("rxmarbles/data/conditional-examples");function merge(){var args=1<=arguments.length?Array.prototype.slice.call(arguments):[];var result={};for(var i=0;i x > 10)",inputs:[[{t:5,d:2},{t:15,d:30},{t:25,d:22},{t:35,d:5},{t:45,d:60},{t:55,d:1}]],apply:function(inputs){return inputs[0].filter(function(x){return x.get("content")>10})}},find:{label:"find(x => x > 10)",inputs:[[{t:5,d:2},{t:15,d:30},{t:25,d:22},{t:35,d:5},{t:45,d:60},{t:55,d:1}]],apply:function(inputs,scheduler){return inputs[0].find(function(x){return x.get("content")>10})}},first:{label:"first",inputs:[[{t:30,d:1},{t:40,d:2},{t:65,d:3},{t:75,d:4},85]],apply:function(inputs){return inputs[0].first()}},last:{label:"last",inputs:[[{t:30,d:1},{t:40,d:2},{t:65,d:3},{t:75,d:4},85]],apply:function(inputs){return inputs[0].last()}},pausable:{label:"pausable",inputs:[[{t:0,d:1},{t:10,d:2},{t:20,d:3},{t:30,d:4},{t:40,d:5},{t:50,d:6},{t:60,d:7},{t:70,d:8},{t:80,d:9}],[{t:15,d:true},{t:35,d:false},{t:55,d:true}]],apply:function(inputs){inputs[0].subscribe(function(){return 0});var subject=new Rx.Subject;inputs[1].subscribe(function(x){return subject.onNext(x.get("content"))});return inputs[0].pausable(subject)}},pausableBuffered:{label:"pausableBuffered",inputs:[[{t:0,d:1},{t:10,d:2},{t:20,d:3},{t:30,d:4},{t:40,d:5},{t:50,d:6},{t:60,d:7},{t:70,d:8},{t:80,d:9}],[{t:15,d:true},{t:35,d:false},{t:55,d:true}]],apply:function(inputs){inputs[0].subscribe(function(){return 0});var subject=new Rx.Subject;inputs[1].subscribe(function(x){return subject.onNext(x.get("content"))});return inputs[0].pausableBuffered(subject)}},skip:{label:"skip(2)",inputs:[[{t:30,d:1},{t:40,d:2},{t:65,d:3},{t:75,d:4}]],apply:function(inputs){return inputs[0].skip(2)}},skipLast:{label:"skipLast(2)",inputs:[[{t:30,d:1},{t:40,d:2},{t:65,d:3},{t:75,d:4}]],apply:function(inputs){return inputs[0].skipLast(2)}},skipUntil:{label:"skipUntil",inputs:[[{t:0,d:1},{t:10,d:2},{t:20,d:3},{t:30,d:4},{t:40,d:5},{t:50,d:6},{t:60,d:7},{t:70,d:8},{t:80,d:9}],[{t:45,d:0},{t:73,d:0}]],apply:function(inputs){return inputs[0].skipUntil(inputs[1])}},take:{label:"take(2)",inputs:[[{t:30,d:1},{t:40,d:2},{t:65,d:3},{t:75,d:4},85]],apply:function(inputs,scheduler){return inputs[0].take(2,scheduler)}},takeLast:{label:"takeLast(1)",inputs:[[{t:30,d:1},{t:40,d:2},{t:65,d:3},{t:75,d:4},85]],apply:function(inputs){return inputs[0].takeLast(1)}},takeUntil:{label:"takeUntil",inputs:[[{t:0,d:1},{t:10,d:2},{t:20,d:3},{t:30,d:4},{t:40,d:5},{t:50,d:6},{t:60,d:7},{t:70,d:8},{t:80,d:9}],[{t:45,d:0},{t:73,d:0}]],apply:function(inputs){return inputs[0].takeUntil(inputs[1])}}}},{cyclejs:52}],82:[function(require,module,exports){"use strict";var Rx=require("cyclejs").Rx;module.exports={average:{label:"average",inputs:[[{t:5,d:1},{t:15,d:2},{t:30,d:2},{t:50,d:2},{t:65,d:5},80]],apply:function(inputs){return inputs[0].average(function(x){return x.get("content")})}},count:{label:"count(x => x > 10)",inputs:[[{t:5,d:2},{t:15,d:30},{t:25,d:22},{t:35,d:5},{t:45,d:60},{t:55,d:1},80]],apply:function(inputs){return inputs[0].count(function(x){return x.get("content")>10 })}},max:{label:"max",inputs:[[{t:5,d:2},{t:15,d:30},{t:25,d:22},{t:35,d:5},{t:45,d:60},{t:55,d:1},80]],apply:function(inputs){return inputs[0].max(function(x,y){if(x.get("content")>y.get("content")){return 1}if(x.get("content")y.get("content")){return 1}if(x.get("content") x + y)",inputs:[[{t:5,d:1},{t:15,d:2},{t:25,d:3},{t:35,d:4},{t:65,d:5},80]],apply:function(inputs){return inputs[0].reduce(function(x,y){return y.set("content",x.get("content")+y.get("content")).set("id",x.get("id")+y.get("id"))})}},sum:{label:"sum",inputs:[[{t:5,d:1},{t:15,d:2},{t:25,d:3},{t:35,d:4},{t:65,d:5},80]],apply:function(inputs){return inputs[0].sum(function(x){return x.get("content")})}}}},{cyclejs:52}],83:[function(require,module,exports){"use strict";var Rx=require("cyclejs").Rx;module.exports={delay:{label:"delay",inputs:[[{t:0,d:1},{t:10,d:2},{t:20,d:1}]],apply:function(inputs,scheduler){return inputs[0].delay(20,scheduler)}},delayWithSelector:{label:"delayWithSelector(x => Rx.Observable.timer(20 * x))",inputs:[[{t:0,d:1},{t:10,d:2},{t:20,d:1}]],apply:function(inputs,scheduler){return inputs[0].delayWithSelector(function(x){return Rx.Observable.timer(Number(x.get("content"))*20,1e3,scheduler)})}},findIndex:{label:"findIndex(x => x > 10)",inputs:[[{t:5,d:2},{t:15,d:30},{t:25,d:22},{t:35,d:5},{t:45,d:60},{t:55,d:1}]],apply:function(inputs,scheduler){return inputs[0].findIndex(function(x){return x.get("content")>10})}},map:{label:"map(x => 10 * x)",inputs:[[{t:10,d:1},{t:20,d:2},{t:50,d:3}]],apply:function(inputs){return inputs[0].map(function(x){return x.set("content",x.get("content")*10)})}},scan:{label:"scan((x, y) => x + y)",inputs:[[{t:5,d:1},{t:15,d:2},{t:25,d:3},{t:35,d:4},{t:65,d:5}]],apply:function(inputs){return inputs[0].scan(function(x,y){return y.set("content",x.get("content")+y.get("content")).set("id",x.get("id")+y.get("id"))})}},debounce:{label:"debounce",inputs:[[{t:0,d:1},{t:26,d:2},{t:34,d:3},{t:40,d:4},{t:45,d:5},{t:79,d:6}]],apply:function(inputs,scheduler){return inputs[0].debounce(10,scheduler)}},debounceWithSelector:{label:"debounceWithSelector(x => Rx.Observable.timer(10 * x))",inputs:[[{t:0,d:1},{t:26,d:2},{t:34,d:1},{t:40,d:1},{t:45,d:2},{t:79,d:1}]],apply:function(inputs,scheduler){return inputs[0].debounceWithSelector(function(x){return Rx.Observable.timer(Number(x.get("content"))*10,1e3,scheduler)})}}}},{cyclejs:52}],84:[function(require,module,exports){"use strict";var white=exports.white="#FFFFFF";var almostWhite=exports.almostWhite="#ECECEC";var greyLight=exports.greyLight="#D4D4D4";var grey=exports.grey="#A7A7A7";var greyDark=exports.greyDark="#7C7C7C";var black=exports.black="#323232";var blue=exports.blue="#3EA1CB";var yellow=exports.yellow="#FFCB46";var red=exports.red="#FF6946";var green=exports.green="#82D736"},{}],85:[function(require,module,exports){"use strict";var spaceTiny=exports.spaceTiny="5px";var spaceSmall=exports.spaceSmall="10px";var spaceMedium=exports.spaceMedium="22px";var spaceLarge=exports.spaceLarge="32px";var animationDurationQuick=exports.animationDurationQuick="100ms";var animationDurationNormal=exports.animationDurationNormal="200ms";var animationDurationSlow=exports.animationDurationSlow="400ms"},{}],86:[function(require,module,exports){"use strict";var fontBase=exports.fontBase="'Source Sans Pro', sans-serif";var fontSpecial=exports.fontSpecial="'Signika', Helvetica, serif";var fontCode=exports.fontCode="'Source Code Pro', monospace"},{}],87:[function(require,module,exports){"use strict";var _interopRequire=function(obj){return obj&&(obj["default"]||obj)};exports.mergeStyles=mergeStyles;var Immutable=_interopRequire(require("immutable"));var Cycle=_interopRequire(require("cyclejs"));var h=Cycle.h;var isTruthy=function(style){return!!style};function mergeStyles(){for(var _len=arguments.length,styleObjects=Array(_len),_key=0;_key<_len;_key++){styleObjects[_key]=arguments[_key]}return styleObjects.filter(isTruthy).reduce(function(styleA,styleB){var mapA=Immutable.Map(styleA);var mapB=Immutable.Map(styleB);return mapA.merge(mapB).toObject()},{})}var elevation1Style=exports.elevation1Style={"-webkit-box-shadow":"0px 1px 2px 1px rgba(0,0,0,0.17)","-moz-box-shadow":"0px 1px 2px 1px rgba(0,0,0,0.17)","box-shadow":"0px 1px 2px 1px rgba(0,0,0,0.17)"};var elevation2Style=exports.elevation2Style={position:"relative"};function getElevationPseudoElementStyle(dy,blur,opacity){return{display:"block",position:"absolute",left:"0",top:"0",right:"0",bottom:"0","-webkit-box-shadow":"0 "+dy+" "+blur+" 0 rgba(0,0,0,"+opacity+")","-moz-box-shadow":"0 "+dy+" "+blur+" 0 rgba(0,0,0,"+opacity+")","box-shadow":"0 "+dy+" "+blur+" 0 rgba(0,0,0,"+opacity+")"}}var elevation2Before=exports.elevation2Before=h("div",{style:getElevationPseudoElementStyle("2px","10px","0.17")},"");var elevation2After=exports.elevation2After=h("div",{style:getElevationPseudoElementStyle("2px","5px","0.26")},"");var elevation3Before=exports.elevation3Before=h("div",{style:getElevationPseudoElementStyle("6px","20px","0.19")},"");var elevation3After=exports.elevation3After=h("div",{style:getElevationPseudoElementStyle("6px","17px","0.2")},"");var svgElevation1Style=exports.svgElevation1Style={"-webkit-filter":"drop-shadow(0px 3px 2px rgba(0,0,0,0.26))",filter:"drop-shadow(0px 3px 2px rgba(0,0,0,0.26))"};var textUnselectable=exports.textUnselectable={"-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"-moz-none","-o-user-select":"none","user-select":"none"}},{cyclejs:52,immutable:61}]},{},[1]); \ No newline at end of file diff --git a/dist/js/element.js b/dist/js/element.js index a4c30df..a98bbc7 100644 --- a/dist/js/element.js +++ b/dist/js/element.js @@ -1,4 +1,4 @@ -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o0&&this._events[type].length>m){this._events[type].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[type].length);if(typeof console.trace==="function"){console.trace()}}}return this};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.once=function(type,listener){if(!isFunction(listener))throw TypeError("listener must be a function");var fired=false;function g(){this.removeListener(type,g);if(!fired){fired=true;listener.apply(this,arguments)}}g.listener=listener;this.on(type,g);return this};EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;list=this._events[type];length=list.length;position=-1;if(list===listener||isFunction(list.listener)&&list.listener===listener){delete this._events[type];if(this._events.removeListener)this.emit("removeListener",type,listener)}else if(isObject(list)){for(i=length;i-->0;){if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}}if(position<0)return this;if(list.length===1){list.length=0;delete this._events[type]}else{list.splice(position,1)}if(this._events.removeListener)this.emit("removeListener",type,listener)}return this};EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[type])delete this._events[type];return this}if(arguments.length===0){for(key in this._events){if(key==="removeListener")continue;this.removeAllListeners(key)}this.removeAllListeners("removeListener");this._events={};return this}listeners=this._events[type];if(isFunction(listeners)){this.removeListener(type,listeners)}else{while(listeners.length)this.removeListener(type,listeners[listeners.length-1])}delete this._events[type];return this};EventEmitter.prototype.listeners=function(type){var ret;if(!this._events||!this._events[type])ret=[];else if(isFunction(this._events[type]))ret=[this._events[type]];else ret=this._events[type].slice();return ret};EventEmitter.listenerCount=function(emitter,type){var ret;if(!emitter._events||!emitter._events[type])ret=0;else if(isFunction(emitter._events[type]))ret=1;else ret=emitter._events[type].length;return ret};function isFunction(arg){return typeof arg==="function"}function isNumber(arg){return typeof arg==="number"}function isObject(arg){return typeof arg==="object"&&arg!==null}function isUndefined(arg){return arg===void 0}},{}],4:[function(require,module,exports){var process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canMutationObserver=typeof window!=="undefined"&&window.MutationObserver;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}var queue=[];if(canMutationObserver){var hiddenDiv=document.createElement("div");var observer=new MutationObserver(function(){var queueList=queue.slice();queue.length=0;queueList.forEach(function(fn){fn()})});observer.observe(hiddenDiv,{attributes:true});return function nextTick(fn){if(!queue.length){hiddenDiv.setAttribute("yes","no")}queue.push(fn)}}if(canPost){window.addEventListener("message",function(ev){var source=ev.source;if((source===window||source===null)&&ev.data==="process-tick"){ev.stopPropagation();if(queue.length>0){var fn=queue.shift();fn()}}},true);return function nextTick(fn){queue.push(fn);window.postMessage("process-tick","*")}}return function nextTick(fn){setTimeout(fn,0)}}();process.title="browser";process.browser=true;process.env={};process.argv=[];function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")}},{}],5:[function(require,module,exports){(function(process,global){(function(undefined){var objectTypes={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false};var root=objectTypes[typeof window]&&window||this,freeExports=objectTypes[typeof exports]&&exports&&!exports.nodeType&&exports,freeModule=objectTypes[typeof module]&&module&&!module.nodeType&&module,moduleExports=freeModule&&freeModule.exports===freeExports&&freeExports,freeGlobal=objectTypes[typeof global]&&global;if(freeGlobal&&(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal)){root=freeGlobal}var Rx={internals:{},config:{Promise:root.Promise},helpers:{}};var noop=Rx.helpers.noop=function(){},notDefined=Rx.helpers.notDefined=function(x){return typeof x==="undefined"},isScheduler=Rx.helpers.isScheduler=function(x){return x instanceof Rx.Scheduler},identity=Rx.helpers.identity=function(x){return x},pluck=Rx.helpers.pluck=function(property){return function(x){return x[property]}},just=Rx.helpers.just=function(value){return function(){return value}},defaultNow=Rx.helpers.defaultNow=Date.now,defaultComparer=Rx.helpers.defaultComparer=function(x,y){return isEqual(x,y)},defaultSubComparer=Rx.helpers.defaultSubComparer=function(x,y){return x>y?1:x=rStartingLine&&lineNumber<=rEndingLine}function isNodeFrame(stackLine){return stackLine.indexOf("(module.js:")!==-1||stackLine.indexOf("(node.js:")!==-1}function captureLine(){if(!hasStacks){return}try{throw new Error}catch(e){var lines=e.stack.split("\n");var firstLine=lines[0].indexOf("@")>0?lines[1]:lines[2];var fileNameAndLineNumber=getFileNameAndLineNumber(firstLine);if(!fileNameAndLineNumber){return}rFileName=fileNameAndLineNumber[0];return fileNameAndLineNumber[1]}}function getFileNameAndLineNumber(stackLine){var attempt1=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine);if(attempt1){return[attempt1[1],Number(attempt1[2])]}var attempt2=/at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine);if(attempt2){return[attempt2[1],Number(attempt2[2])]}var attempt3=/.*@(.+):(\d+)$/.exec(stackLine);if(attempt3){return[attempt3[1],Number(attempt3[2])]}}var $iterator$=typeof Symbol==="function"&&Symbol.iterator||"_es6shim_iterator_";if(root.Set&&typeof(new root.Set)["@@iterator"]==="function"){$iterator$="@@iterator"}var doneEnumerator=Rx.doneEnumerator={done:true,value:undefined};var isIterable=Rx.helpers.isIterable=function(o){return o[$iterator$]!==undefined};var isArrayLike=Rx.helpers.isArrayLike=function(o){return o&&o.length!==undefined};Rx.helpers.iterator=$iterator$;var bindCallback=Rx.internals.bindCallback=function(func,thisArg,argCount){if(typeof thisArg==="undefined"){return func}switch(argCount){case 0:return function(){return func.call(thisArg)};case 1:return function(arg){return func.call(thisArg,arg)};case 2:return function(value,index){return func.call(thisArg,value,index)};case 3:return function(value,index,collection){return func.call(thisArg,value,index,collection)}}return function(){return func.apply(thisArg,arguments)}};var dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],dontEnumsLength=dontEnums.length;var argsClass="[object Arguments]",arrayClass="[object Array]",boolClass="[object Boolean]",dateClass="[object Date]",errorClass="[object Error]",funcClass="[object Function]",numberClass="[object Number]",objectClass="[object Object]",regexpClass="[object RegExp]",stringClass="[object String]";var toString=Object.prototype.toString,hasOwnProperty=Object.prototype.hasOwnProperty,supportsArgsClass=toString.call(arguments)==argsClass,supportNodeClass,errorProto=Error.prototype,objectProto=Object.prototype,stringProto=String.prototype,propertyIsEnumerable=objectProto.propertyIsEnumerable;try{supportNodeClass=!(toString.call(document)==objectClass&&!({toString:0}+""))}catch(e){supportNodeClass=true}var nonEnumProps={};nonEnumProps[arrayClass]=nonEnumProps[dateClass]=nonEnumProps[numberClass]={constructor:true,toLocaleString:true,toString:true,valueOf:true};nonEnumProps[boolClass]=nonEnumProps[stringClass]={constructor:true,toString:true,valueOf:true};nonEnumProps[errorClass]=nonEnumProps[funcClass]=nonEnumProps[regexpClass]={constructor:true,toString:true};nonEnumProps[objectClass]={constructor:true};var support={};(function(){var ctor=function(){this.x=1},props=[];ctor.prototype={valueOf:1,y:1};for(var key in new ctor){props.push(key)}for(key in arguments){}support.enumErrorProps=propertyIsEnumerable.call(errorProto,"message")||propertyIsEnumerable.call(errorProto,"name");support.enumPrototypes=propertyIsEnumerable.call(ctor,"prototype");support.nonEnumArgs=key!=0;support.nonEnumShadows=!/valueOf/.test(props)})(1);var isObject=Rx.internals.isObject=function(value){var type=typeof value;return value&&(type=="function"||type=="object")||false};function keysIn(object){var result=[];if(!isObject(object)){return result}if(support.nonEnumArgs&&object.length&&isArguments(object)){object=slice.call(object)}var skipProto=support.enumPrototypes&&typeof object=="function",skipErrorProps=support.enumErrorProps&&(object===errorProto||object instanceof Error);for(var key in object){if(!(skipProto&&key=="prototype")&&!(skipErrorProps&&(key=="message"||key=="name"))){result.push(key)}}if(support.nonEnumShadows&&object!==objectProto){var ctor=object.constructor,index=-1,length=dontEnumsLength;if(object===(ctor&&ctor.prototype)){var className=object===stringProto?stringClass:object===errorProto?errorClass:toString.call(object),nonEnum=nonEnumProps[className]}while(++index-1}})}}stackA.pop();stackB.pop();return result}var slice=Array.prototype.slice;function argsOrArray(args,idx){return args.length===1&&Array.isArray(args[idx])?args[idx]:slice.call(args)}var hasProp={}.hasOwnProperty;var inherits=this.inherits=Rx.internals.inherits=function(child,parent){function __(){this.constructor=child}__.prototype=parent.prototype;child.prototype=new __};var addProperties=Rx.internals.addProperties=function(obj){var sources=slice.call(arguments,1);for(var i=0,len=sources.length;i=this.length||index<0){return}var parent=index-1>>1;if(parent<0||parent===index){return}if(this.isHigherPriority(index,parent)){var temp=this.items[index];this.items[index]=this.items[parent];this.items[parent]=temp;this.percolate(parent)}};priorityProto.heapify=function(index){+index||(index=0);if(index>=this.length||index<0){return}var left=2*index+1,right=2*index+2,first=index;if(left0){}return action(this,state)}function scheduleAbsolute(state,dueTime,action){return this.scheduleWithRelativeAndState(state,dueTime-this.now(),action)}return new Scheduler(defaultNow,scheduleNow,scheduleRelative,scheduleAbsolute)}();var currentThreadScheduler=Scheduler.currentThread=function(){var queue;function runTrampoline(q){var item;while(q.length>0){item=q.dequeue();if(!item.isCancelled()){while(item.dueTime-Scheduler.now()>0){}if(!item.isCancelled()){item.invoke()}}}}function scheduleNow(state,action){return this.scheduleWithRelativeAndState(state,0,action)}function scheduleRelative(state,dueTime,action){var dt=this.now()+Scheduler.normalize(dueTime),si=new ScheduledItem(this,state,action,dt);if(!queue){queue=new PriorityQueue(4);queue.enqueue(si);try{runTrampoline(queue)}catch(e){throw e}finally{queue=null}}else{queue.enqueue(si)}return si.disposable}function scheduleAbsolute(state,dueTime,action){return this.scheduleWithRelativeAndState(state,dueTime-this.now(),action)}var currentScheduler=new Scheduler(defaultNow,scheduleNow,scheduleRelative,scheduleAbsolute);currentScheduler.scheduleRequired=function(){return!queue};currentScheduler.ensureTrampoline=function(action){if(!queue){this.schedule(action)}else{action()}};return currentScheduler}();var scheduleMethod,clearMethod=noop;var localTimer=function(){var localSetTimeout,localClearTimeout=noop;if("WScript"in this){localSetTimeout=function(fn,time){WScript.Sleep(time);fn()}}else if(!!root.setTimeout){localSetTimeout=root.setTimeout;localClearTimeout=root.clearTimeout}else{throw new Error("No concurrency detected!")}return{setTimeout:localSetTimeout,clearTimeout:localClearTimeout}}();var localSetTimeout=localTimer.setTimeout,localClearTimeout=localTimer.clearTimeout;(function(){var reNative=RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$");var setImmediate=typeof(setImmediate=freeGlobal&&moduleExports&&freeGlobal.setImmediate)=="function"&&!reNative.test(setImmediate)&&setImmediate,clearImmediate=typeof(clearImmediate=freeGlobal&&moduleExports&&freeGlobal.clearImmediate)=="function"&&!reNative.test(clearImmediate)&&clearImmediate;function postMessageSupported(){if(!root.postMessage||root.importScripts){return false}var isAsync=false,oldHandler=root.onmessage;root.onmessage=function(){isAsync=true};root.postMessage("","*");root.onmessage=oldHandler;return isAsync}if(typeof setImmediate==="function"){scheduleMethod=setImmediate;clearMethod=clearImmediate}else if(typeof process!=="undefined"&&{}.toString.call(process)==="[object process]"){scheduleMethod=process.nextTick +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o0&&this._events[type].length>m){this._events[type].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[type].length);if(typeof console.trace==="function"){console.trace()}}}return this};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.once=function(type,listener){if(!isFunction(listener))throw TypeError("listener must be a function");var fired=false;function g(){this.removeListener(type,g);if(!fired){fired=true;listener.apply(this,arguments)}}g.listener=listener;this.on(type,g);return this};EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;list=this._events[type];length=list.length;position=-1;if(list===listener||isFunction(list.listener)&&list.listener===listener){delete this._events[type];if(this._events.removeListener)this.emit("removeListener",type,listener)}else if(isObject(list)){for(i=length;i-->0;){if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}}if(position<0)return this;if(list.length===1){list.length=0;delete this._events[type]}else{list.splice(position,1)}if(this._events.removeListener)this.emit("removeListener",type,listener)}return this};EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[type])delete this._events[type];return this}if(arguments.length===0){for(key in this._events){if(key==="removeListener")continue;this.removeAllListeners(key)}this.removeAllListeners("removeListener");this._events={};return this}listeners=this._events[type];if(isFunction(listeners)){this.removeListener(type,listeners)}else{while(listeners.length)this.removeListener(type,listeners[listeners.length-1])}delete this._events[type];return this};EventEmitter.prototype.listeners=function(type){var ret;if(!this._events||!this._events[type])ret=[];else if(isFunction(this._events[type]))ret=[this._events[type]];else ret=this._events[type].slice();return ret};EventEmitter.listenerCount=function(emitter,type){var ret;if(!emitter._events||!emitter._events[type])ret=0;else if(isFunction(emitter._events[type]))ret=1;else ret=emitter._events[type].length;return ret};function isFunction(arg){return typeof arg==="function"}function isNumber(arg){return typeof arg==="number"}function isObject(arg){return typeof arg==="object"&&arg!==null}function isUndefined(arg){return arg===void 0}},{}],4:[function(require,module,exports){var process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canMutationObserver=typeof window!=="undefined"&&window.MutationObserver;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}var queue=[];if(canMutationObserver){var hiddenDiv=document.createElement("div");var observer=new MutationObserver(function(){var queueList=queue.slice();queue.length=0;queueList.forEach(function(fn){fn()})});observer.observe(hiddenDiv,{attributes:true});return function nextTick(fn){if(!queue.length){hiddenDiv.setAttribute("yes","no")}queue.push(fn)}}if(canPost){window.addEventListener("message",function(ev){var source=ev.source;if((source===window||source===null)&&ev.data==="process-tick"){ev.stopPropagation();if(queue.length>0){var fn=queue.shift();fn()}}},true);return function nextTick(fn){queue.push(fn);window.postMessage("process-tick","*")}}return function nextTick(fn){setTimeout(fn,0)}}();process.title="browser";process.browser=true;process.env={};process.argv=[];function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")}},{}],5:[function(require,module,exports){(function(process,global){(function(undefined){var objectTypes={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false};var root=objectTypes[typeof window]&&window||this,freeExports=objectTypes[typeof exports]&&exports&&!exports.nodeType&&exports,freeModule=objectTypes[typeof module]&&module&&!module.nodeType&&module,moduleExports=freeModule&&freeModule.exports===freeExports&&freeExports,freeGlobal=objectTypes[typeof global]&&global;if(freeGlobal&&(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal)){root=freeGlobal}var Rx={internals:{},config:{Promise:root.Promise},helpers:{}};var noop=Rx.helpers.noop=function(){},notDefined=Rx.helpers.notDefined=function(x){return typeof x==="undefined"},isScheduler=Rx.helpers.isScheduler=function(x){return x instanceof Rx.Scheduler},identity=Rx.helpers.identity=function(x){return x},pluck=Rx.helpers.pluck=function(property){return function(x){return x[property]}},just=Rx.helpers.just=function(value){return function(){return value}},defaultNow=Rx.helpers.defaultNow=Date.now,defaultComparer=Rx.helpers.defaultComparer=function(x,y){return isEqual(x,y)},defaultSubComparer=Rx.helpers.defaultSubComparer=function(x,y){return x>y?1:x=rStartingLine&&lineNumber<=rEndingLine}function isNodeFrame(stackLine){return stackLine.indexOf("(module.js:")!==-1||stackLine.indexOf("(node.js:")!==-1}function captureLine(){if(!hasStacks){return}try{throw new Error}catch(e){var lines=e.stack.split("\n");var firstLine=lines[0].indexOf("@")>0?lines[1]:lines[2];var fileNameAndLineNumber=getFileNameAndLineNumber(firstLine);if(!fileNameAndLineNumber){return}rFileName=fileNameAndLineNumber[0];return fileNameAndLineNumber[1]}}function getFileNameAndLineNumber(stackLine){var attempt1=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine);if(attempt1){return[attempt1[1],Number(attempt1[2])]}var attempt2=/at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine);if(attempt2){return[attempt2[1],Number(attempt2[2])]}var attempt3=/.*@(.+):(\d+)$/.exec(stackLine);if(attempt3){return[attempt3[1],Number(attempt3[2])]}}var $iterator$=typeof Symbol==="function"&&Symbol.iterator||"_es6shim_iterator_";if(root.Set&&typeof(new root.Set)["@@iterator"]==="function"){$iterator$="@@iterator"}var doneEnumerator=Rx.doneEnumerator={done:true,value:undefined};var isIterable=Rx.helpers.isIterable=function(o){return o[$iterator$]!==undefined};var isArrayLike=Rx.helpers.isArrayLike=function(o){return o&&o.length!==undefined};Rx.helpers.iterator=$iterator$;var bindCallback=Rx.internals.bindCallback=function(func,thisArg,argCount){if(typeof thisArg==="undefined"){return func}switch(argCount){case 0:return function(){return func.call(thisArg)};case 1:return function(arg){return func.call(thisArg,arg)};case 2:return function(value,index){return func.call(thisArg,value,index)};case 3:return function(value,index,collection){return func.call(thisArg,value,index,collection)}}return function(){return func.apply(thisArg,arguments)}};var dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],dontEnumsLength=dontEnums.length;var argsClass="[object Arguments]",arrayClass="[object Array]",boolClass="[object Boolean]",dateClass="[object Date]",errorClass="[object Error]",funcClass="[object Function]",numberClass="[object Number]",objectClass="[object Object]",regexpClass="[object RegExp]",stringClass="[object String]";var toString=Object.prototype.toString,hasOwnProperty=Object.prototype.hasOwnProperty,supportsArgsClass=toString.call(arguments)==argsClass,supportNodeClass,errorProto=Error.prototype,objectProto=Object.prototype,stringProto=String.prototype,propertyIsEnumerable=objectProto.propertyIsEnumerable;try{supportNodeClass=!(toString.call(document)==objectClass&&!({toString:0}+""))}catch(e){supportNodeClass=true}var nonEnumProps={};nonEnumProps[arrayClass]=nonEnumProps[dateClass]=nonEnumProps[numberClass]={constructor:true,toLocaleString:true,toString:true,valueOf:true};nonEnumProps[boolClass]=nonEnumProps[stringClass]={constructor:true,toString:true,valueOf:true};nonEnumProps[errorClass]=nonEnumProps[funcClass]=nonEnumProps[regexpClass]={constructor:true,toString:true};nonEnumProps[objectClass]={constructor:true};var support={};(function(){var ctor=function(){this.x=1},props=[];ctor.prototype={valueOf:1,y:1};for(var key in new ctor){props.push(key)}for(key in arguments){}support.enumErrorProps=propertyIsEnumerable.call(errorProto,"message")||propertyIsEnumerable.call(errorProto,"name");support.enumPrototypes=propertyIsEnumerable.call(ctor,"prototype");support.nonEnumArgs=key!=0;support.nonEnumShadows=!/valueOf/.test(props)})(1);var isObject=Rx.internals.isObject=function(value){var type=typeof value;return value&&(type=="function"||type=="object")||false};function keysIn(object){var result=[];if(!isObject(object)){return result}if(support.nonEnumArgs&&object.length&&isArguments(object)){object=slice.call(object)}var skipProto=support.enumPrototypes&&typeof object=="function",skipErrorProps=support.enumErrorProps&&(object===errorProto||object instanceof Error);for(var key in object){if(!(skipProto&&key=="prototype")&&!(skipErrorProps&&(key=="message"||key=="name"))){result.push(key)}}if(support.nonEnumShadows&&object!==objectProto){var ctor=object.constructor,index=-1,length=dontEnumsLength;if(object===(ctor&&ctor.prototype)){var className=object===stringProto?stringClass:object===errorProto?errorClass:toString.call(object),nonEnum=nonEnumProps[className]}while(++index-1}})}}stackA.pop();stackB.pop();return result}var slice=Array.prototype.slice;function argsOrArray(args,idx){return args.length===1&&Array.isArray(args[idx])?args[idx]:slice.call(args)}var hasProp={}.hasOwnProperty;var inherits=this.inherits=Rx.internals.inherits=function(child,parent){function __(){this.constructor=child}__.prototype=parent.prototype;child.prototype=new __};var addProperties=Rx.internals.addProperties=function(obj){var sources=slice.call(arguments,1);for(var i=0,len=sources.length;i=this.length||index<0){return}var parent=index-1>>1;if(parent<0||parent===index){return}if(this.isHigherPriority(index,parent)){var temp=this.items[index];this.items[index]=this.items[parent];this.items[parent]=temp;this.percolate(parent)}};priorityProto.heapify=function(index){+index||(index=0);if(index>=this.length||index<0){return}var left=2*index+1,right=2*index+2,first=index;if(left0){}return action(this,state)}function scheduleAbsolute(state,dueTime,action){return this.scheduleWithRelativeAndState(state,dueTime-this.now(),action)}return new Scheduler(defaultNow,scheduleNow,scheduleRelative,scheduleAbsolute)}();var currentThreadScheduler=Scheduler.currentThread=function(){var queue;function runTrampoline(q){var item;while(q.length>0){item=q.dequeue();if(!item.isCancelled()){while(item.dueTime-Scheduler.now()>0){}if(!item.isCancelled()){item.invoke()}}}}function scheduleNow(state,action){return this.scheduleWithRelativeAndState(state,0,action)}function scheduleRelative(state,dueTime,action){var dt=this.now()+Scheduler.normalize(dueTime),si=new ScheduledItem(this,state,action,dt);if(!queue){queue=new PriorityQueue(4);queue.enqueue(si);try{runTrampoline(queue)}catch(e){throw e}finally{queue=null}}else{queue.enqueue(si)}return si.disposable}function scheduleAbsolute(state,dueTime,action){return this.scheduleWithRelativeAndState(state,dueTime-this.now(),action)}var currentScheduler=new Scheduler(defaultNow,scheduleNow,scheduleRelative,scheduleAbsolute);currentScheduler.scheduleRequired=function(){return!queue};currentScheduler.ensureTrampoline=function(action){if(!queue){this.schedule(action)}else{action()}};return currentScheduler}();var scheduleMethod,clearMethod=noop;var localTimer=function(){var localSetTimeout,localClearTimeout=noop;if("WScript"in this){localSetTimeout=function(fn,time){WScript.Sleep(time);fn()}}else if(!!root.setTimeout){localSetTimeout=root.setTimeout;localClearTimeout=root.clearTimeout}else{throw new Error("No concurrency detected!")}return{setTimeout:localSetTimeout,clearTimeout:localClearTimeout}}();var localSetTimeout=localTimer.setTimeout,localClearTimeout=localTimer.clearTimeout;(function(){var reNative=RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$");var setImmediate=typeof(setImmediate=freeGlobal&&moduleExports&&freeGlobal.setImmediate)=="function"&&!reNative.test(setImmediate)&&setImmediate,clearImmediate=typeof(clearImmediate=freeGlobal&&moduleExports&&freeGlobal.clearImmediate)=="function"&&!reNative.test(clearImmediate)&&clearImmediate;function postMessageSupported(){if(!root.postMessage||root.importScripts){return false}var isAsync=false,oldHandler=root.onmessage;root.onmessage=function(){isAsync=true};root.postMessage("","*");root.onmessage=oldHandler;return isAsync}if(typeof setImmediate==="function"){scheduleMethod=setImmediate;clearMethod=clearImmediate}else if(typeof process!=="undefined"&&{}.toString.call(process)==="[object process]"){scheduleMethod=process.nextTick }else if(postMessageSupported()){var MSG_PREFIX="ms.rx.schedule"+Math.random(),tasks={},taskId=0;var onGlobalPostMessage=function(event){if(typeof event.data==="string"&&event.data.substring(0,MSG_PREFIX.length)===MSG_PREFIX){var handleId=event.data.substring(MSG_PREFIX.length),action=tasks[handleId];action();delete tasks[handleId]}};if(root.addEventListener){root.addEventListener("message",onGlobalPostMessage,false)}else{root.attachEvent("onmessage",onGlobalPostMessage,false)}scheduleMethod=function(action){var currentId=taskId++;tasks[currentId]=action;root.postMessage(MSG_PREFIX+currentId,"*")}}else if(!!root.MessageChannel){var channel=new root.MessageChannel,channelTasks={},channelTaskId=0;channel.port1.onmessage=function(event){var id=event.data,action=channelTasks[id];action();delete channelTasks[id]};scheduleMethod=function(action){var id=channelTaskId++;channelTasks[id]=action;channel.port2.postMessage(id)}}else if("document"in root&&"onreadystatechange"in root.document.createElement("script")){scheduleMethod=function(action){var scriptElement=root.document.createElement("script");scriptElement.onreadystatechange=function(){action();scriptElement.onreadystatechange=null;scriptElement.parentNode.removeChild(scriptElement);scriptElement=null};root.document.documentElement.appendChild(scriptElement)}}else{scheduleMethod=function(action){return localSetTimeout(action,0)};clearMethod=localClearTimeout}})();var timeoutScheduler=Scheduler.timeout=function(){function scheduleNow(state,action){var scheduler=this,disposable=new SingleAssignmentDisposable;var id=scheduleMethod(function(){if(!disposable.isDisposed){disposable.setDisposable(action(scheduler,state))}});return new CompositeDisposable(disposable,disposableCreate(function(){clearMethod(id)}))}function scheduleRelative(state,dueTime,action){var scheduler=this,dt=Scheduler.normalize(dueTime);if(dt===0){return scheduler.scheduleWithState(state,action)}var disposable=new SingleAssignmentDisposable;var id=localSetTimeout(function(){if(!disposable.isDisposed){disposable.setDisposable(action(scheduler,state))}},dt);return new CompositeDisposable(disposable,disposableCreate(function(){localClearTimeout(id)}))}function scheduleAbsolute(state,dueTime,action){return this.scheduleWithRelativeAndState(state,dueTime-this.now(),action)}return new Scheduler(defaultNow,scheduleNow,scheduleRelative,scheduleAbsolute)}();var CatchScheduler=function(__super__){function scheduleNow(state,action){return this._scheduler.scheduleWithState(state,this._wrap(action))}function scheduleRelative(state,dueTime,action){return this._scheduler.scheduleWithRelativeAndState(state,dueTime,this._wrap(action))}function scheduleAbsolute(state,dueTime,action){return this._scheduler.scheduleWithAbsoluteAndState(state,dueTime,this._wrap(action))}inherits(CatchScheduler,__super__);function CatchScheduler(scheduler,handler){this._scheduler=scheduler;this._handler=handler;this._recursiveOriginal=null;this._recursiveWrapper=null;__super__.call(this,this._scheduler.now.bind(this._scheduler),scheduleNow,scheduleRelative,scheduleAbsolute)}CatchScheduler.prototype._clone=function(scheduler){return new CatchScheduler(scheduler,this._handler)};CatchScheduler.prototype._wrap=function(action){var parent=this;return function(self,state){try{return action(parent._getRecursiveWrapper(self),state)}catch(e){if(!parent._handler(e)){throw e}return disposableEmpty}}};CatchScheduler.prototype._getRecursiveWrapper=function(scheduler){if(this._recursiveOriginal!==scheduler){this._recursiveOriginal=scheduler;var wrapper=this._clone(scheduler);wrapper._recursiveOriginal=scheduler;wrapper._recursiveWrapper=wrapper;this._recursiveWrapper=wrapper}return this._recursiveWrapper};CatchScheduler.prototype.schedulePeriodicWithState=function(state,period,action){var self=this,failed=false,d=new SingleAssignmentDisposable;d.setDisposable(this._scheduler.schedulePeriodicWithState(state,period,function(state1){if(failed){return null}try{return action(state1)}catch(e){failed=true;if(!self._handler(e)){throw e}d.dispose();return null}}));return d};return CatchScheduler}(Scheduler);var Notification=Rx.Notification=function(){function Notification(kind,hasValue){this.hasValue=hasValue==null?false:hasValue;this.kind=kind}Notification.prototype.accept=function(observerOrOnNext,onError,onCompleted){return observerOrOnNext&&typeof observerOrOnNext==="object"?this._acceptObservable(observerOrOnNext):this._accept(observerOrOnNext,onError,onCompleted)};Notification.prototype.toObservable=function(scheduler){var notification=this;isScheduler(scheduler)||(scheduler=immediateScheduler);return new AnonymousObservable(function(observer){return scheduler.schedule(function(){notification._acceptObservable(observer);notification.kind==="N"&&observer.onCompleted()})})};return Notification}();var notificationCreateOnNext=Notification.createOnNext=function(){function _accept(onNext){return onNext(this.value)}function _acceptObservable(observer){return observer.onNext(this.value)}function toString(){return"OnNext("+this.value+")"}return function(value){var notification=new Notification("N",true);notification.value=value;notification._accept=_accept;notification._acceptObservable=_acceptObservable;notification.toString=toString;return notification}}();var notificationCreateOnError=Notification.createOnError=function(){function _accept(onNext,onError){return onError(this.exception)}function _acceptObservable(observer){return observer.onError(this.exception)}function toString(){return"OnError("+this.exception+")"}return function(e){var notification=new Notification("E");notification.exception=e;notification._accept=_accept;notification._acceptObservable=_acceptObservable;notification.toString=toString;return notification}}();var notificationCreateOnCompleted=Notification.createOnCompleted=function(){function _accept(onNext,onError,onCompleted){return onCompleted()}function _acceptObservable(observer){return observer.onCompleted()}function toString(){return"OnCompleted()"}return function(){var notification=new Notification("C");notification._accept=_accept;notification._acceptObservable=_acceptObservable;notification.toString=toString;return notification}}();var Enumerator=Rx.internals.Enumerator=function(next){this._next=next};Enumerator.prototype.next=function(){return this._next()};Enumerator.prototype[$iterator$]=function(){return this};var Enumerable=Rx.internals.Enumerable=function(iterator){this._iterator=iterator};Enumerable.prototype[$iterator$]=function(){return this._iterator()};Enumerable.prototype.concat=function(){var sources=this;return new AnonymousObservable(function(observer){var e;try{e=sources[$iterator$]()}catch(err){observer.onError(err);return}var isDisposed,subscription=new SerialDisposable;var cancelable=immediateScheduler.scheduleRecursive(function(self){var currentItem;if(isDisposed){return}try{currentItem=e.next()}catch(ex){observer.onError(ex);return}if(currentItem.done){observer.onCompleted();return}var currentValue=currentItem.value;isPromise(currentValue)&&(currentValue=observableFromPromise(currentValue));var d=new SingleAssignmentDisposable;subscription.setDisposable(d);d.setDisposable(currentValue.subscribe(observer.onNext.bind(observer),observer.onError.bind(observer),function(){self()}))});return new CompositeDisposable(subscription,cancelable,disposableCreate(function(){isDisposed=true}))})};Enumerable.prototype.catchError=function(){var sources=this;return new AnonymousObservable(function(observer){var e;try{e=sources[$iterator$]()}catch(err){observer.onError(err);return}var isDisposed,lastException,subscription=new SerialDisposable;var cancelable=immediateScheduler.scheduleRecursive(function(self){if(isDisposed){return}var currentItem;try{currentItem=e.next()}catch(ex){observer.onError(ex);return}if(currentItem.done){if(lastException){observer.onError(lastException)}else{observer.onCompleted()}return}var currentValue=currentItem.value;isPromise(currentValue)&&(currentValue=observableFromPromise(currentValue));var d=new SingleAssignmentDisposable;subscription.setDisposable(d);d.setDisposable(currentValue.subscribe(observer.onNext.bind(observer),function(exn){lastException=exn;self()},observer.onCompleted.bind(observer)))});return new CompositeDisposable(subscription,cancelable,disposableCreate(function(){isDisposed=true}))})};Enumerable.prototype.catchErrorWhen=function(notificationHandler){var sources=this;return new AnonymousObservable(function(observer){var e;var exceptions=new Subject;var handled=notificationHandler(exceptions);var notifier=new Subject;var notificationDisposable=handled.subscribe(notifier);try{e=sources[$iterator$]()}catch(err){observer.onError(err);return}var isDisposed,lastException,subscription=new SerialDisposable;var cancelable=immediateScheduler.scheduleRecursive(function(self){if(isDisposed){return}var currentItem;try{currentItem=e.next()}catch(ex){observer.onError(ex);return}if(currentItem.done){if(lastException){observer.onError(lastException)}else{observer.onCompleted()}return}var currentValue=currentItem.value;isPromise(currentValue)&&(currentValue=observableFromPromise(currentValue));var outer=new SingleAssignmentDisposable;var inner=new SingleAssignmentDisposable;subscription.setDisposable(new CompositeDisposable(inner,outer));outer.setDisposable(currentValue.subscribe(observer.onNext.bind(observer),function(exn){inner.setDisposable(notifier.subscribe(function(){self()},function(ex){observer.onError(ex)},function(){observer.onCompleted()}));exceptions.onNext(exn)},observer.onCompleted.bind(observer)))});return new CompositeDisposable(notificationDisposable,subscription,cancelable,disposableCreate(function(){isDisposed=true}))})};var enumerableRepeat=Enumerable.repeat=function(value,repeatCount){if(repeatCount==null){repeatCount=-1}return new Enumerable(function(){var left=repeatCount;return new Enumerator(function(){if(left===0){return doneEnumerator}if(left>0){left--}return{done:false,value:value}})})};var enumerableOf=Enumerable.of=function(source,selector,thisArg){selector||(selector=identity);return new Enumerable(function(){var index=-1;return new Enumerator(function(){return++index0){isOwner=!this.isAcquired;this.isAcquired=true}if(isOwner){this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(self){var work;if(parent.queue.length>0){work=parent.queue.shift()}else{parent.isAcquired=false;return}try{work()}catch(ex){parent.queue=[];parent.hasFaulted=true;throw ex}self()}))}};ScheduledObserver.prototype.dispose=function(){__super__.prototype.dispose.call(this);this.disposable.dispose()};return ScheduledObserver}(AbstractObserver);var ObserveOnObserver=function(__super__){inherits(ObserveOnObserver,__super__);function ObserveOnObserver(scheduler,observer,cancel){__super__.call(this,scheduler,observer);this._cancel=cancel}ObserveOnObserver.prototype.next=function(value){__super__.prototype.next.call(this,value);this.ensureActive()};ObserveOnObserver.prototype.error=function(e){__super__.prototype.error.call(this,e);this.ensureActive()};ObserveOnObserver.prototype.completed=function(){__super__.prototype.completed.call(this);this.ensureActive()};ObserveOnObserver.prototype.dispose=function(){__super__.prototype.dispose.call(this);this._cancel&&this._cancel.dispose();this._cancel=null};return ObserveOnObserver}(ScheduledObserver);var observableProto;var Observable=Rx.Observable=function(){function Observable(subscribe){if(Rx.config.longStackSupport&&hasStacks){try{throw new Error}catch(e){this.stack=e.stack.substring(e.stack.indexOf("\n")+1)}var self=this;this._subscribe=function(observer){var oldOnError=observer.onError.bind(observer);observer.onError=function(err){makeStackTraceLong(err,self);oldOnError(err)};return subscribe.call(self,observer)}}else{this._subscribe=subscribe}}observableProto=Observable.prototype;observableProto.subscribe=observableProto.forEach=function(observerOrOnNext,onError,onCompleted){return this._subscribe(typeof observerOrOnNext==="object"?observerOrOnNext:observerCreate(observerOrOnNext,onError,onCompleted))};observableProto.subscribeOnNext=function(onNext,thisArg){return this._subscribe(observerCreate(arguments.length===2?function(x){onNext.call(thisArg,x)}:onNext))};observableProto.subscribeOnError=function(onError,thisArg){return this._subscribe(observerCreate(null,arguments.length===2?function(e){onError.call(thisArg,e)}:onError))};observableProto.subscribeOnCompleted=function(onCompleted,thisArg){return this._subscribe(observerCreate(null,null,arguments.length===2?function(){onCompleted.call(thisArg)}:onCompleted))};return Observable}();observableProto.observeOn=function(scheduler){var source=this;return new AnonymousObservable(function(observer){return source.subscribe(new ObserveOnObserver(scheduler,observer))},source)};observableProto.subscribeOn=function(scheduler){var source=this;return new AnonymousObservable(function(observer){var m=new SingleAssignmentDisposable,d=new SerialDisposable;d.setDisposable(m);m.setDisposable(scheduler.schedule(function(){d.setDisposable(new ScheduledDisposable(scheduler,source.subscribe(observer)))}));return d},source)};var observableFromPromise=Observable.fromPromise=function(promise){return observableDefer(function(){var subject=new Rx.AsyncSubject;promise.then(function(value){subject.onNext(value);subject.onCompleted()},subject.onError.bind(subject));return subject})};observableProto.toPromise=function(promiseCtor){promiseCtor||(promiseCtor=Rx.config.Promise);if(!promiseCtor){throw new TypeError("Promise type not provided nor in Rx.config.Promise")}var source=this;return new promiseCtor(function(resolve,reject){var value,hasValue=false;source.subscribe(function(v){value=v;hasValue=true},reject,function(){hasValue&&resolve(value)})})};observableProto.toArray=function(){var source=this;return new AnonymousObservable(function(observer){var arr=[];return source.subscribe(function(x){arr.push(x)},function(e){observer.onError(e)},function(){observer.onNext(arr);observer.onCompleted()})},source)};Observable.create=Observable.createWithDisposable=function(subscribe,parent){return new AnonymousObservable(subscribe,parent)};var observableDefer=Observable.defer=function(observableFactory){return new AnonymousObservable(function(observer){var result;try{result=observableFactory()}catch(e){return observableThrow(e).subscribe(observer)}isPromise(result)&&(result=observableFromPromise(result));return result.subscribe(observer)})};var observableEmpty=Observable.empty=function(scheduler){isScheduler(scheduler)||(scheduler=immediateScheduler);return new AnonymousObservable(function(observer){return scheduler.schedule(function(){observer.onCompleted()})})};var maxSafeInteger=Math.pow(2,53)-1;function StringIterable(str){this._s=s}StringIterable.prototype[$iterator$]=function(){return new StringIterator(this._s)};function StringIterator(str){this._s=s;this._l=s.length;this._i=0}StringIterator.prototype[$iterator$]=function(){return this};StringIterator.prototype.next=function(){if(this._imaxSafeInteger){return maxSafeInteger}return len}var observableFrom=Observable.from=function(iterable,mapFn,thisArg,scheduler){if(iterable==null){throw new Error("iterable cannot be null.")}if(mapFn&&!isFunction(mapFn)){throw new Error("mapFn when provided must be a function")}if(mapFn){var mapper=bindCallback(mapFn,thisArg,2)}isScheduler(scheduler)||(scheduler=currentThreadScheduler);var list=Object(iterable),it=getIterable(list);return new AnonymousObservable(function(observer){var i=0;return scheduler.scheduleRecursive(function(self){var next;try{next=it.next()}catch(e){observer.onError(e);return}if(next.done){observer.onCompleted();return}var result=next.value;if(mapper){try{result=mapper(result,i)}catch(e){observer.onError(e);return}}observer.onNext(result);i++;self()})})};var observableFromArray=Observable.fromArray=function(array,scheduler){isScheduler(scheduler)||(scheduler=currentThreadScheduler);return new AnonymousObservable(function(observer){var count=0,len=array.length;return scheduler.scheduleRecursive(function(self){if(count0){subscribe(q.shift())}else{activeCount--;isStopped&&activeCount===0&&o.onCompleted()}}))}group.add(sources.subscribe(function(innerSource){if(activeCount0})){try{queuedValues=queues.map(function(x){return x.shift()});res=resultSelector.apply(parent,queuedValues)}catch(ex){observer.onError(ex);return}observer.onNext(res)}else if(isDone.filter(function(x,j){return j!==i}).every(identity)){observer.onCompleted()}}function done(i){isDone[i]=true;if(isDone.every(function(x){return x})){observer.onCompleted()}}var subscriptions=new Array(n);for(var idx=0;idx0})){var res=queues.map(function(x){return x.shift()});observer.onNext(res)}else if(isDone.filter(function(x,j){return j!==i}).every(identity)){observer.onCompleted();return}}function done(i){isDone[i]=true;if(isDone.every(identity)){observer.onCompleted();return}}var subscriptions=new Array(n);for(var idx=0;idx0})};observableProto.dematerialize=function(){var source=this;return new AnonymousObservable(function(o){return source.subscribe(function(x){return x.accept(o)},function(e){o.onError(e)},function(){o.onCompleted()})},this)};observableProto.distinctUntilChanged=function(keySelector,comparer){var source=this;keySelector||(keySelector=identity);comparer||(comparer=defaultComparer);return new AnonymousObservable(function(o){var hasCurrentKey=false,currentKey;return source.subscribe(function(value){var comparerEquals=false,key;try{key=keySelector(value)}catch(e){o.onError(e);return}if(hasCurrentKey){try{comparerEquals=comparer(currentKey,key)}catch(e){o.onError(e);return}}if(!hasCurrentKey||!comparerEquals){hasCurrentKey=true;currentKey=key;o.onNext(value)}},function(e){o.onError(e)},function(){o.onCompleted()})},this)};observableProto["do"]=observableProto.tap=function(observerOrOnNext,onError,onCompleted){var source=this,onNextFunc;if(typeof observerOrOnNext==="function"){onNextFunc=observerOrOnNext}else{onNextFunc=function(x){observerOrOnNext.onNext(x)};onError=function(e){observerOrOnNext.onError(e)};onCompleted=function(){observerOrOnNext.onCompleted()}}return new AnonymousObservable(function(observer){return source.subscribe(function(x){try{onNextFunc(x)}catch(e){observer.onError(e)}observer.onNext(x)},function(err){if(onError){try{onError(err)}catch(e){observer.onError(e)}}observer.onError(err)},function(){if(onCompleted){try{onCompleted()}catch(e){observer.onError(e)}}observer.onCompleted()})},this)};observableProto.doAction=function(){return this.tap.apply(this,arguments)};observableProto.doOnNext=observableProto.tapOnNext=function(onNext,thisArg){return this.tap(typeof thisArg!=="undefined"?function(x){onNext.call(thisArg,x)}:onNext)};observableProto.doOnError=observableProto.tapOnError=function(onError,thisArg){return this.tap(noop,typeof thisArg!=="undefined"?function(e){onError.call(thisArg,e)}:onError)};observableProto.doOnCompleted=observableProto.tapOnCompleted=function(onCompleted,thisArg){return this.tap(noop,null,typeof thisArg!=="undefined"?function(){onCompleted.call(thisArg)}:onCompleted)};observableProto["finally"]=observableProto.ensure=function(action){var source=this;return new AnonymousObservable(function(observer){var subscription;try{subscription=source.subscribe(observer)}catch(e){action();throw e}return disposableCreate(function(){try{subscription.dispose()}catch(e){throw e}finally{action()}})},this)};observableProto.finallyAction=function(action){return this.ensure(action)};observableProto.ignoreElements=function(){var source=this;return new AnonymousObservable(function(o){return source.subscribe(noop,function(e){o.onError(e)},function(){o.onCompleted()})},source)};observableProto.materialize=function(){var source=this;return new AnonymousObservable(function(observer){return source.subscribe(function(value){observer.onNext(notificationCreateOnNext(value))},function(e){observer.onNext(notificationCreateOnError(e));observer.onCompleted()},function(){observer.onNext(notificationCreateOnCompleted());observer.onCompleted()})},source)};observableProto.repeat=function(repeatCount){return enumerableRepeat(this,repeatCount).concat()};observableProto.retry=function(retryCount){return enumerableRepeat(this,retryCount).catchError()};observableProto.retryWhen=function(notifier){return enumerableRepeat(this).catchErrorWhen(notifier)};observableProto.scan=function(){var hasSeed=false,seed,accumulator,source=this;if(arguments.length===2){hasSeed=true;seed=arguments[0];accumulator=arguments[1]}else{accumulator=arguments[0]}return new AnonymousObservable(function(o){var hasAccumulation,accumulation,hasValue;return source.subscribe(function(x){!hasValue&&(hasValue=true);try{if(hasAccumulation){accumulation=accumulator(accumulation,x)}else{accumulation=hasSeed?accumulator(seed,x):x;hasAccumulation=true}}catch(e){o.onError(e);return}o.onNext(accumulation)},function(e){o.onError(e)},function(){!hasValue&&hasSeed&&o.onNext(seed);o.onCompleted()})},source)};observableProto.skipLast=function(count){var source=this;return new AnonymousObservable(function(o){var q=[];return source.subscribe(function(x){q.push(x);q.length>count&&o.onNext(q.shift())},function(e){o.onError(e)},function(){o.onCompleted()})},source)};observableProto.startWith=function(){var values,scheduler,start=0;if(!!arguments.length&&isScheduler(arguments[0])){scheduler=arguments[0];start=1}else{scheduler=immediateScheduler}values=slice.call(arguments,start);return enumerableOf([observableFromArray(values,scheduler),this]).concat()};observableProto.takeLast=function(count){var source=this;return new AnonymousObservable(function(o){var q=[];return source.subscribe(function(x){q.push(x);q.length>count&&q.shift()},function(e){o.onError(e)},function(){while(q.length>0){o.onNext(q.shift())}o.onCompleted()})},source)};observableProto.takeLastBuffer=function(count){var source=this;return new AnonymousObservable(function(o){var q=[];return source.subscribe(function(x){q.push(x);q.length>count&&q.shift()},function(e){o.onError(e)},function(){o.onNext(q);o.onCompleted()})},source)};observableProto.windowWithCount=function(count,skip){var source=this;+count||(count=0);Math.abs(count)===Infinity&&(count=0);if(count<=0){throw new Error(argumentOutOfRange)}skip==null&&(skip=count);+skip||(skip=0);Math.abs(skip)===Infinity&&(skip=0);if(skip<=0){throw new Error(argumentOutOfRange)}return new AnonymousObservable(function(observer){var m=new SingleAssignmentDisposable,refCountDisposable=new RefCountDisposable(m),n=0,q=[];function createWindow(){var s=new Subject;q.push(s);observer.onNext(addRef(s,refCountDisposable))}createWindow();m.setDisposable(source.subscribe(function(x){for(var i=0,len=q.length;i=0&&c%skip===0&&q.shift().onCompleted();++n%skip===0&&createWindow()},function(e){while(q.length>0){q.shift().onError(e)}observer.onError(e)},function(){while(q.length>0){q.shift().onCompleted()}observer.onCompleted()}));return refCountDisposable},source)};function concatMap(source,selector,thisArg){var selectorFunc=bindCallback(selector,thisArg,3);return source.map(function(x,i){var result=selectorFunc(x,i,source);isPromise(result)&&(result=observableFromPromise(result));(isArrayLike(result)||isIterable(result))&&(result=observableFrom(result));return result}).concatAll()}observableProto.selectConcat=observableProto.concatMap=function(selector,resultSelector,thisArg){if(isFunction(selector)&&isFunction(resultSelector)){return this.concatMap(function(x,i){var selectorResult=selector(x,i);isPromise(selectorResult)&&(selectorResult=observableFromPromise(selectorResult));(isArrayLike(selectorResult)||isIterable(selectorResult))&&(selectorResult=observableFrom(selectorResult));return selectorResult.map(function(y,i2){return resultSelector(x,y,i,i2)})})}return isFunction(selector)?concatMap(this,selector,thisArg):concatMap(this,function(){return selector})};observableProto.concatMapObserver=observableProto.selectConcatObserver=function(onNext,onError,onCompleted,thisArg){var source=this,onNextFunc=bindCallback(onNext,thisArg,2),onErrorFunc=bindCallback(onError,thisArg,1),onCompletedFunc=bindCallback(onCompleted,thisArg,0);return new AnonymousObservable(function(observer){var index=0;return source.subscribe(function(x){var result;try{result=onNextFunc(x,index++)}catch(e){observer.onError(e);return}isPromise(result)&&(result=observableFromPromise(result));observer.onNext(result)},function(err){var result;try{result=onErrorFunc(err)}catch(e){observer.onError(e);return}isPromise(result)&&(result=observableFromPromise(result));observer.onNext(result);observer.onCompleted()},function(){var result;try{result=onCompletedFunc()}catch(e){observer.onError(e);return}isPromise(result)&&(result=observableFromPromise(result));observer.onNext(result);observer.onCompleted()})},this).concatAll()};observableProto.defaultIfEmpty=function(defaultValue){var source=this;defaultValue===undefined&&(defaultValue=null);return new AnonymousObservable(function(observer){var found=false;return source.subscribe(function(x){found=true;observer.onNext(x)},function(e){observer.onError(e)},function(){!found&&observer.onNext(defaultValue);observer.onCompleted()})},source)};function arrayIndexOfComparer(array,item,comparer){for(var i=0,len=array.length;i0){o.onNext(x);remaining===0&&o.onCompleted()}},function(e){o.onError(e)},function(){o.onCompleted()})},source)};observableProto.takeWhile=function(predicate,thisArg){var source=this,callback=bindCallback(predicate,thisArg,3);return new AnonymousObservable(function(o){var i=0,running=true;return source.subscribe(function(x){if(running){try{running=callback(x,i++,source)}catch(e){o.onError(e);return}if(running){o.onNext(x)}else{o.onCompleted()}}},function(e){o.onError(e)},function(){o.onCompleted()})},source)};observableProto.where=observableProto.filter=function(predicate,thisArg){var source=this;predicate=bindCallback(predicate,thisArg,3);return new AnonymousObservable(function(o){var count=0;return source.subscribe(function(value){try{var shouldRun=predicate(value,count++,source)}catch(e){o.onError(e);return}shouldRun&&o.onNext(value)},function(e){o.onError(e)},function(){o.onCompleted()})},source)};function extremaBy(source,keySelector,comparer){return new AnonymousObservable(function(o){var hasValue=false,lastKey=null,list=[];return source.subscribe(function(x){var comparison,key;try{key=keySelector(x)}catch(ex){o.onError(ex);return}comparison=0;if(!hasValue){hasValue=true;lastKey=key}else{try{comparison=comparer(key,lastKey)}catch(ex1){o.onError(ex1);return}}if(comparison>0){lastKey=key;list=[]}if(comparison>=0){list.push(x)}},function(e){o.onError(e)},function(){o.onNext(list);o.onCompleted()})},source)}function firstOnly(x){if(x.length===0){throw new Error(sequenceContainsNoElements)}return x[0]}observableProto.aggregate=function(){var hasSeed=false,accumulator,seed,source=this;if(arguments.length===2){hasSeed=true;seed=arguments[0];accumulator=arguments[1]}else{accumulator=arguments[0]}return new AnonymousObservable(function(o){var hasAccumulation,accumulation,hasValue;return source.subscribe(function(x){!hasValue&&(hasValue=true);try{if(hasAccumulation){accumulation=accumulator(accumulation,x)}else{accumulation=hasSeed?accumulator(seed,x):x;hasAccumulation=true}}catch(e){o.onError(e);return}},function(e){o.onError(e)},function(){hasValue&&o.onNext(accumulation);!hasValue&&hasSeed&&o.onNext(seed);!hasValue&&!hasSeed&&o.onError(new Error(sequenceContainsNoElements));o.onCompleted()})},source)};observableProto.reduce=function(accumulator){var hasSeed=false,seed,source=this;if(arguments.length===2){hasSeed=true;seed=arguments[1]}return new AnonymousObservable(function(o){var hasAccumulation,accumulation,hasValue;return source.subscribe(function(x){!hasValue&&(hasValue=true);try{if(hasAccumulation){accumulation=accumulator(accumulation,x)}else{accumulation=hasSeed?accumulator(seed,x):x;hasAccumulation=true}}catch(e){o.onError(e);return}},function(e){o.onError(e)},function(){hasValue&&o.onNext(accumulation);!hasValue&&hasSeed&&o.onNext(seed);!hasValue&&!hasSeed&&o.onError(new Error(sequenceContainsNoElements));o.onCompleted()})},source)};observableProto.some=function(predicate,thisArg){var source=this;return predicate?source.filter(predicate,thisArg).some():new AnonymousObservable(function(observer){return source.subscribe(function(){observer.onNext(true);observer.onCompleted()},function(e){observer.onError(e)},function(){observer.onNext(false);observer.onCompleted()})},source)};observableProto.any=function(){return this.some.apply(this,arguments)};observableProto.isEmpty=function(){return this.any().map(not)};observableProto.every=function(predicate,thisArg){return this.filter(function(v){return!predicate(v)},thisArg).some().map(not)};observableProto.all=function(){return this.every.apply(this,arguments)};observableProto.contains=function(searchElement,fromIndex){var source=this;function comparer(a,b){return a===0&&b===0||(a===b||isNaN(a)&&isNaN(b))}return new AnonymousObservable(function(o){var i=0,n=+fromIndex||0;Math.abs(n)===Infinity&&(n=0);if(n<0){o.onNext(false);o.onCompleted();return disposableEmpty}return source.subscribe(function(x){if(i++>=n&&comparer(x,searchElement)){o.onNext(true);o.onCompleted()}},function(e){o.onError(e)},function(){o.onNext(false);o.onCompleted()})},this)};observableProto.count=function(predicate,thisArg){return predicate?this.filter(predicate,thisArg).count():this.reduce(function(count){return count+1},0)};observableProto.indexOf=function(searchElement,fromIndex){var source=this;return new AnonymousObservable(function(o){var i=0,n=+fromIndex||0;Math.abs(n)===Infinity&&(n=0);if(n<0){o.onNext(-1);o.onCompleted();return disposableEmpty}return source.subscribe(function(x){if(i>=n&&x===searchElement){o.onNext(i);o.onCompleted()}i++},function(e){o.onError(e)},function(){o.onNext(-1);o.onCompleted()})},source)};observableProto.sum=function(keySelector,thisArg){return keySelector&&isFunction(keySelector)?this.map(keySelector,thisArg).sum():this.reduce(function(prev,curr){return prev+curr},0)};observableProto.minBy=function(keySelector,comparer){comparer||(comparer=defaultSubComparer);return extremaBy(this,keySelector,function(x,y){return comparer(x,y)*-1})};observableProto.min=function(comparer){return this.minBy(identity,comparer).map(function(x){return firstOnly(x)})};observableProto.maxBy=function(keySelector,comparer){comparer||(comparer=defaultSubComparer);return extremaBy(this,keySelector,comparer)};observableProto.max=function(comparer){return this.maxBy(identity,comparer).map(function(x){return firstOnly(x)})};observableProto.average=function(keySelector,thisArg){return keySelector&&isFunction(keySelector)?this.map(keySelector,thisArg).average():this.reduce(function(prev,cur){return{sum:prev.sum+cur,count:prev.count+1}},{sum:0,count:0}).map(function(s){if(s.count===0){throw new Error(sequenceContainsNoElements)}return s.sum/s.count})};observableProto.sequenceEqual=function(second,comparer){var first=this;comparer||(comparer=defaultComparer);return new AnonymousObservable(function(o){var donel=false,doner=false,ql=[],qr=[];var subscription1=first.subscribe(function(x){var equal,v;if(qr.length>0){v=qr.shift();try{equal=comparer(v,x)}catch(e){o.onError(e);return}if(!equal){o.onNext(false);o.onCompleted()}}else if(doner){o.onNext(false);o.onCompleted()}else{ql.push(x)}},function(e){o.onError(e)},function(){donel=true;if(ql.length===0){if(qr.length>0){o.onNext(false);o.onCompleted()}else if(doner){o.onNext(true);o.onCompleted()}}});(isArrayLike(second)||isIterable(second))&&(second=observableFrom(second));isPromise(second)&&(second=observableFromPromise(second));var subscription2=second.subscribe(function(x){var equal;if(ql.length>0){var v=ql.shift();try{equal=comparer(v,x)}catch(exception){o.onError(exception);return}if(!equal){o.onNext(false);o.onCompleted()}}else if(donel){o.onNext(false);o.onCompleted()}else{qr.push(x)}},function(e){o.onError(e)},function(){doner=true;if(qr.length===0){if(ql.length>0){o.onNext(false);o.onCompleted()}else if(donel){o.onNext(true);o.onCompleted()}}});return new CompositeDisposable(subscription1,subscription2)},first)};function elementAtOrDefault(source,index,hasDefault,defaultValue){if(index<0){throw new Error(argumentOutOfRange)}return new AnonymousObservable(function(o){var i=index;return source.subscribe(function(x){if(i--===0){o.onNext(x);o.onCompleted()}},function(e){o.onError(e)},function(){if(!hasDefault){o.onError(new Error(argumentOutOfRange))}else{o.onNext(defaultValue);o.onCompleted()}})},source)}observableProto.elementAt=function(index){return elementAtOrDefault(this,index,false)};observableProto.elementAtOrDefault=function(index,defaultValue){return elementAtOrDefault(this,index,true,defaultValue)};function singleOrDefaultAsync(source,hasDefault,defaultValue){return new AnonymousObservable(function(o){var value=defaultValue,seenValue=false;return source.subscribe(function(x){if(seenValue){o.onError(new Error("Sequence contains more than one element"))}else{value=x;seenValue=true}},function(e){o.onError(e)},function(){if(!seenValue&&!hasDefault){o.onError(new Error(sequenceContainsNoElements))}else{o.onNext(value);o.onCompleted()}})},source)}observableProto.single=function(predicate,thisArg){return predicate&&isFunction(predicate)?this.where(predicate,thisArg).single():singleOrDefaultAsync(this,false)};observableProto.singleOrDefault=function(predicate,defaultValue,thisArg){return predicate&&isFunction(predicate)?this.filter(predicate,thisArg).singleOrDefault(null,defaultValue):singleOrDefaultAsync(this,true,defaultValue)};function firstOrDefaultAsync(source,hasDefault,defaultValue){return new AnonymousObservable(function(o){return source.subscribe(function(x){o.onNext(x);o.onCompleted()},function(e){o.onError(e)},function(){if(!hasDefault){o.onError(new Error(sequenceContainsNoElements))}else{o.onNext(defaultValue);o.onCompleted()}})},source)}observableProto.first=function(predicate,thisArg){return predicate?this.where(predicate,thisArg).first():firstOrDefaultAsync(this,false)};observableProto.firstOrDefault=function(predicate,defaultValue,thisArg){return predicate?this.where(predicate).firstOrDefault(null,defaultValue):firstOrDefaultAsync(this,true,defaultValue)};function lastOrDefaultAsync(source,hasDefault,defaultValue){return new AnonymousObservable(function(o){var value=defaultValue,seenValue=false;return source.subscribe(function(x){value=x;seenValue=true},function(e){o.onError(e)},function(){if(!seenValue&&!hasDefault){o.onError(new Error(sequenceContainsNoElements))}else{o.onNext(value);o.onCompleted()}})},source)}observableProto.last=function(predicate,thisArg){return predicate?this.where(predicate,thisArg).last():lastOrDefaultAsync(this,false)};observableProto.lastOrDefault=function(predicate,defaultValue,thisArg){return predicate?this.where(predicate,thisArg).lastOrDefault(null,defaultValue):lastOrDefaultAsync(this,true,defaultValue)};function findValue(source,predicate,thisArg,yieldIndex){var callback=bindCallback(predicate,thisArg,3);return new AnonymousObservable(function(o){var i=0;return source.subscribe(function(x){var shouldRun;try{shouldRun=callback(x,i,source)}catch(e){o.onError(e);return}if(shouldRun){o.onNext(yieldIndex?i:x);o.onCompleted()}else{i++}},function(e){o.onError(e)},function(){o.onNext(yieldIndex?-1:undefined);o.onCompleted()})},source)}observableProto.find=function(predicate,thisArg){return findValue(this,predicate,thisArg,false)};observableProto.findIndex=function(predicate,thisArg){return findValue(this,predicate,thisArg,true)};observableProto.toSet=function(){if(typeof root.Set==="undefined"){throw new TypeError}var source=this;return new AnonymousObservable(function(o){var s=new root.Set;return source.subscribe(function(x){s.add(x)},function(e){o.onError(e)},function(){o.onNext(s);o.onCompleted()})},source)};observableProto.toMap=function(keySelector,elementSelector){if(typeof root.Map==="undefined"){throw new TypeError}var source=this;return new AnonymousObservable(function(o){var m=new root.Map;return source.subscribe(function(x){var key;try{key=keySelector(x)}catch(e){o.onError(e);return}var element=x;if(elementSelector){try{element=elementSelector(x)}catch(e){o.onError(e);return}}m.set(key,element)},function(e){o.onError(e)},function(){o.onNext(m);o.onCompleted()})},source)};var fnString="function",throwString="throw",isObject=Rx.internals.isObject;function toThunk(obj,ctx){if(Array.isArray(obj)){return objectToThunk.call(ctx,obj)}if(isGeneratorFunction(obj)){return observableSpawn(obj.call(ctx))}if(isGenerator(obj)){return observableSpawn(obj)}if(isObservable(obj)){return observableToThunk(obj)}if(isPromise(obj)){return promiseToThunk(obj)}if(typeof obj===fnString){return obj}if(isObject(obj)||Array.isArray(obj)){return objectToThunk.call(ctx,obj)}return obj}function objectToThunk(obj){var ctx=this;return function(done){var keys=Object.keys(obj),pending=keys.length,results=new obj.constructor,finished;if(!pending){timeoutScheduler.schedule(function(){done(null,results)});return}for(var i=0,len=keys.length;i2){res=slice.call(arguments,1)}if(err){try{ret=gen[throwString](err)}catch(e){return exit(e)}}if(!err){try{ret=gen.next(res)}catch(e){return exit(e)}}if(ret.done){return exit(null,ret.value)}ret.value=toThunk(ret.value,ctx);if(typeof ret.value===fnString){var called=false;try{ret.value.call(ctx,function(){if(called){return}called=true;next.apply(ctx,arguments)})}catch(e){timeoutScheduler.schedule(function(){if(called){return}called=true;next.call(ctx,e)})}return}next(new TypeError("Rx.spawn only supports a function, Promise, Observable, Object or Array."))}}};function handleError(err){if(!err){return}timeoutScheduler.schedule(function(){throw err})}Observable.start=function(func,context,scheduler){return observableToAsync(func,context,scheduler)()};var observableToAsync=Observable.toAsync=function(func,context,scheduler){isScheduler(scheduler)||(scheduler=timeoutScheduler);return function(){var args=arguments,subject=new AsyncSubject;scheduler.schedule(function(){var result;try{result=func.apply(context,args)}catch(e){subject.onError(e);return}subject.onNext(result);subject.onCompleted()});return subject.asObservable()}};Observable.fromCallback=function(func,context,selector){return function(){var args=slice.call(arguments,0);return new AnonymousObservable(function(observer){function handler(){var results=arguments;if(selector){try{results=selector(results)}catch(err){observer.onError(err);return}observer.onNext(results)}else{if(results.length<=1){observer.onNext.apply(observer,results)}else{observer.onNext(results)}}observer.onCompleted()}args.push(handler);func.apply(context,args)}).publishLast().refCount()}};Observable.fromNodeCallback=function(func,context,selector){return function(){var args=slice.call(arguments,0);return new AnonymousObservable(function(observer){function handler(err){if(err){observer.onError(err);return}var results=slice.call(arguments,1);if(selector){try{results=selector(results)}catch(e){observer.onError(e);return}observer.onNext(results)}else{if(results.length<=1){observer.onNext.apply(observer,results)}else{observer.onNext(results)}}observer.onCompleted()}args.push(handler);func.apply(context,args)}).publishLast().refCount()}};function createListener(element,name,handler){if(element.addEventListener){element.addEventListener(name,handler,false);return disposableCreate(function(){element.removeEventListener(name,handler,false)})}throw new Error("No listener found")}function createEventListener(el,eventName,handler){var disposables=new CompositeDisposable;if(Object.prototype.toString.call(el)==="[object NodeList]"){for(var i=0,len=el.length;i0){o.onNext(q.shift())}}}else{previousShouldFire=results.shouldFire;if(results.shouldFire){o.onNext(results.data)}else{q.push(results.data)}}},function(err){while(q.length>0){o.onNext(q.shift())}o.onError(err)},function(){while(q.length>0){o.onNext(q.shift())}o.onCompleted()});return subscription}function PausableBufferedObservable(source,pauser){this.source=source;this.controller=new Subject;if(pauser&&pauser.subscribe){this.pauser=this.controller.merge(pauser)}else{this.pauser=this.controller}__super__.call(this,subscribe,source)}PausableBufferedObservable.prototype.pause=function(){this.controller.onNext(false)};PausableBufferedObservable.prototype.resume=function(){this.controller.onNext(true)};return PausableBufferedObservable}(Observable);observableProto.pausableBuffered=function(subject){return new PausableBufferedObservable(this,subject)};var ControlledObservable=function(__super__){inherits(ControlledObservable,__super__);function subscribe(observer){return this.source.subscribe(observer)}function ControlledObservable(source,enableQueue){__super__.call(this,subscribe,source);this.subject=new ControlledSubject(enableQueue);this.source=source.multicast(this.subject).refCount()}ControlledObservable.prototype.request=function(numberOfItems){if(numberOfItems==null){numberOfItems=-1}return this.subject.request(numberOfItems)};return ControlledObservable}(Observable);var ControlledSubject=function(__super__){function subscribe(observer){return this.subject.subscribe(observer)}inherits(ControlledSubject,__super__);function ControlledSubject(enableQueue){enableQueue==null&&(enableQueue=true);__super__.call(this,subscribe);this.subject=new Subject;this.enableQueue=enableQueue;this.queue=enableQueue?[]:null;this.requestedCount=0;this.requestedDisposable=disposableEmpty;this.error=null;this.hasFailed=false;this.hasCompleted=false;this.controlledDisposable=disposableEmpty}addProperties(ControlledSubject.prototype,Observer,{onCompleted:function(){this.hasCompleted=true;(!this.enableQueue||this.queue.length===0)&&this.subject.onCompleted()},onError:function(error){this.hasFailed=true;this.error=error;(!this.enableQueue||this.queue.length===0)&&this.subject.onError(error)},onNext:function(value){var hasRequested=false;if(this.requestedCount===0){this.enableQueue&&this.queue.push(value)}else{this.requestedCount!==-1&&this.requestedCount--===0&&this.disposeCurrentRequest();hasRequested=true}hasRequested&&this.subject.onNext(value)},_processRequest:function(numberOfItems){if(this.enableQueue){while(this.queue.length>=numberOfItems&&numberOfItems>0){this.subject.onNext(this.queue.shift());numberOfItems--}return this.queue.length!==0?{numberOfItems:numberOfItems,returnValue:true}:{numberOfItems:numberOfItems,returnValue:false}}if(this.hasFailed){this.subject.onError(this.error);this.controlledDisposable.dispose();this.controlledDisposable=disposableEmpty}else if(this.hasCompleted){this.subject.onCompleted();this.controlledDisposable.dispose();this.controlledDisposable=disposableEmpty}return{numberOfItems:numberOfItems,returnValue:false}},request:function(number){this.disposeCurrentRequest();var self=this,r=this._processRequest(number);var number=r.numberOfItems;if(!r.returnValue){this.requestedCount=number;this.requestedDisposable=disposableCreate(function(){self.requestedCount=0});return this.requestedDisposable}else{return disposableEmpty}},disposeCurrentRequest:function(){this.requestedDisposable.dispose();this.requestedDisposable=disposableEmpty}});return ControlledSubject}(Observable);observableProto.controlled=function(enableQueue){if(enableQueue==null){enableQueue=true}return new ControlledObservable(this,enableQueue)};var StopAndWaitObservable=function(__super__){function subscribe(observer){this.subscription=this.source.subscribe(new StopAndWaitObserver(observer,this,this.subscription));var self=this;timeoutScheduler.schedule(function(){self.source.request(1)});return this.subscription}inherits(StopAndWaitObservable,__super__);function StopAndWaitObservable(source){__super__.call(this,subscribe,source);this.source=source}var StopAndWaitObserver=function(__sub__){inherits(StopAndWaitObserver,__sub__);function StopAndWaitObserver(observer,observable,cancel){__sub__.call(this);this.observer=observer;this.observable=observable;this.cancel=cancel}var stopAndWaitObserverProto=StopAndWaitObserver.prototype;stopAndWaitObserverProto.completed=function(){this.observer.onCompleted();this.dispose()};stopAndWaitObserverProto.error=function(error){this.observer.onError(error);this.dispose()};stopAndWaitObserverProto.next=function(value){this.observer.onNext(value);var self=this;timeoutScheduler.schedule(function(){self.observable.source.request(1)})};stopAndWaitObserverProto.dispose=function(){this.observer=null;if(this.cancel){this.cancel.dispose();this.cancel=null}__sub__.prototype.dispose.call(this)};return StopAndWaitObserver}(AbstractObserver);return StopAndWaitObservable}(Observable);ControlledObservable.prototype.stopAndWait=function(){return new StopAndWaitObservable(this)};var WindowedObservable=function(__super__){function subscribe(observer){this.subscription=this.source.subscribe(new WindowedObserver(observer,this,this.subscription));var self=this;timeoutScheduler.schedule(function(){self.source.request(self.windowSize)});return this.subscription}inherits(WindowedObservable,__super__);function WindowedObservable(source,windowSize){__super__.call(this,subscribe,source);this.source=source;this.windowSize=windowSize}var WindowedObserver=function(__sub__){inherits(WindowedObserver,__sub__);function WindowedObserver(observer,observable,cancel){this.observer=observer;this.observable=observable;this.cancel=cancel;this.received=0}var windowedObserverPrototype=WindowedObserver.prototype;windowedObserverPrototype.completed=function(){this.observer.onCompleted();this.dispose()};windowedObserverPrototype.error=function(error){this.observer.onError(error);this.dispose()};windowedObserverPrototype.next=function(value){this.observer.onNext(value);this.received=++this.received%this.observable.windowSize;if(this.received===0){var self=this;timeoutScheduler.schedule(function(){self.observable.source.request(self.observable.windowSize)})}};windowedObserverPrototype.dispose=function(){this.observer=null;if(this.cancel){this.cancel.dispose();this.cancel=null}__sub__.prototype.dispose.call(this)};return WindowedObserver}(AbstractObserver);return WindowedObservable}(Observable);ControlledObservable.prototype.windowed=function(windowSize){return new WindowedObservable(this,windowSize)};observableProto.multicast=function(subjectOrSubjectSelector,selector){var source=this;return typeof subjectOrSubjectSelector==="function"?new AnonymousObservable(function(observer){var connectable=source.multicast(subjectOrSubjectSelector());return new CompositeDisposable(selector(connectable).subscribe(observer),connectable.connect())},source):new ConnectableObservable(source,subjectOrSubjectSelector)};observableProto.publish=function(selector){return selector&&isFunction(selector)?this.multicast(function(){return new Subject},selector):this.multicast(new Subject)};observableProto.share=function(){return this.publish().refCount()};observableProto.publishLast=function(selector){return selector&&isFunction(selector)?this.multicast(function(){return new AsyncSubject},selector):this.multicast(new AsyncSubject)};observableProto.publishValue=function(initialValueOrSelector,initialValue){return arguments.length===2?this.multicast(function(){return new BehaviorSubject(initialValue)},initialValueOrSelector):this.multicast(new BehaviorSubject(initialValueOrSelector))};observableProto.shareValue=function(initialValue){return this.publishValue(initialValue).refCount()};observableProto.replay=function(selector,bufferSize,window,scheduler){return selector&&isFunction(selector)?this.multicast(function(){return new ReplaySubject(bufferSize,window,scheduler)},selector):this.multicast(new ReplaySubject(bufferSize,window,scheduler))};observableProto.shareReplay=function(bufferSize,window,scheduler){return this.replay(null,bufferSize,window,scheduler).refCount()};var InnerSubscription=function(subject,observer){this.subject=subject;this.observer=observer};InnerSubscription.prototype.dispose=function(){if(!this.subject.isDisposed&&this.observer!==null){var idx=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(idx,1);this.observer=null}};var BehaviorSubject=Rx.BehaviorSubject=function(__super__){function subscribe(observer){checkDisposed.call(this);if(!this.isStopped){this.observers.push(observer);observer.onNext(this.value);return new InnerSubscription(this,observer)}if(this.hasError){observer.onError(this.error)}else{observer.onCompleted()}return disposableEmpty}inherits(BehaviorSubject,__super__);function BehaviorSubject(value){__super__.call(this,subscribe);this.value=value,this.observers=[],this.isDisposed=false,this.isStopped=false,this.hasError=false}addProperties(BehaviorSubject.prototype,Observer,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){checkDisposed.call(this);if(this.isStopped){return}this.isStopped=true;for(var i=0,os=this.observers.slice(0),len=os.length;i0},_trim:function(now){while(this.q.length>this.bufferSize){this.q.shift()}while(this.q.length>0&&now-this.q[0].interval>this.windowSize){this.q.shift()}},onNext:function(value){checkDisposed.call(this);if(this.isStopped){return}var now=this.scheduler.now();this.q.push({interval:now,value:value});this._trim(now);var o=this.observers.slice(0);for(var i=0,len=o.length;i=min){return num}}candidate=min|1;while(candidate>>16;key=key+(key<<3);key=key^key>>>4;key=key*c2;key=key^key>>>15;return key}var getHashCode=function(){var uniqueIdCounter=0;return function(obj){if(obj==null){throw new Error(noSuchkey)}if(typeof obj==="string"){return stringHashFn(obj)}if(typeof obj==="number"){return numberHashFn(obj)}if(typeof obj==="boolean"){return obj===true?1:0}if(obj instanceof Date){return numberHashFn(obj.valueOf())}if(obj instanceof RegExp){return stringHashFn(obj.toString())}if(typeof obj.valueOf==="function"){var valueOf=obj.valueOf();if(typeof valueOf==="number"){return numberHashFn(valueOf)}if(typeof obj==="string"){return stringHashFn(valueOf)}}if(obj.hashCode){return obj.hashCode()}var id=17*uniqueIdCounter++;obj.hashCode=function(){return id};return id}}();function newEntry(){return{key:null,value:null,next:0,hashCode:0}}function Dictionary(capacity,comparer){if(capacity<0){throw new Error("out of range")}if(capacity>0){this._initialize(capacity)}this.comparer=comparer||defaultComparer;this.freeCount=0;this.size=0;this.freeList=-1}var dictionaryProto=Dictionary.prototype;dictionaryProto._initialize=function(capacity){var prime=getPrime(capacity),i;this.buckets=new Array(prime);this.entries=new Array(prime);for(i=0;i=0;index2=this.entries[index2].next){if(this.entries[index2].hashCode===num&&this.comparer(this.entries[index2].key,key)){if(add){throw new Error(duplicatekey)}this.entries[index2].value=value;return}}if(this.freeCount>0){index3=this.freeList;this.freeList=this.entries[index3].next;--this.freeCount}else{if(this.size===this.entries.length){this._resize();index1=num%this.buckets.length}index3=this.size;++this.size}this.entries[index3].hashCode=num;this.entries[index3].next=this.buckets[index1];this.entries[index3].key=key;this.entries[index3].value=value;this.buckets[index1]=index3};dictionaryProto._resize=function(){var prime=getPrime(this.size*2),numArray=new Array(prime);for(index=0;index=0;index3=this.entries[index3].next){if(this.entries[index3].hashCode===num&&this.comparer(this.entries[index3].key,key)){if(index2<0){this.buckets[index1]=this.entries[index3].next}else{this.entries[index2].next=this.entries[index3].next}this.entries[index3].hashCode=-1;this.entries[index3].next=this.freeList;this.entries[index3].key=null;this.entries[index3].value=null;this.freeList=index3;++this.freeCount;return true}else{index2=index3}}}return false};dictionaryProto.clear=function(){var index,len;if(this.size<=0){return}for(index=0,len=this.buckets.length;index=0;index=this.entries[index].next){if(this.entries[index].hashCode===num&&this.comparer(this.entries[index].key,key)){return index}}}return-1};dictionaryProto.count=function(){return this.size-this.freeCount};dictionaryProto.tryGetValue=function(key){var entry=this._findEntry(key);return entry>=0?this.entries[entry].value:undefined};dictionaryProto.getValues=function(){var index=0,results=[];if(this.entries){for(var index1=0;index1=0){results[index++]=this.entries[index1].value}}}return results};dictionaryProto.get=function(key){var entry=this._findEntry(key);if(entry>=0){return this.entries[entry].value}throw new Error(noSuchkey)};dictionaryProto.set=function(key,value){this._insert(key,value,false)};dictionaryProto.containskey=function(key){return this._findEntry(key)>=0};return Dictionary}();observableProto.join=function(right,leftDurationSelector,rightDurationSelector,resultSelector){var left=this;return new AnonymousObservable(function(observer){var group=new CompositeDisposable;var leftDone=false,rightDone=false;var leftId=0,rightId=0;var leftMap=new Dictionary,rightMap=new Dictionary;group.add(left.subscribe(function(value){var id=leftId++;var md=new SingleAssignmentDisposable;leftMap.add(id,value);group.add(md);var expire=function(){leftMap.remove(id)&&leftMap.count()===0&&leftDone&&observer.onCompleted();group.remove(md)};var duration;try{duration=leftDurationSelector(value)}catch(e){observer.onError(e);return}md.setDisposable(duration.take(1).subscribe(noop,observer.onError.bind(observer),expire));rightMap.getValues().forEach(function(v){var result;try{result=resultSelector(value,v)}catch(exn){observer.onError(exn);return}observer.onNext(result)})},observer.onError.bind(observer),function(){leftDone=true;(rightDone||leftMap.count()===0)&&observer.onCompleted()}));group.add(right.subscribe(function(value){var id=rightId++;var md=new SingleAssignmentDisposable;rightMap.add(id,value);group.add(md);var expire=function(){rightMap.remove(id)&&rightMap.count()===0&&rightDone&&observer.onCompleted();group.remove(md)};var duration;try{duration=rightDurationSelector(value)}catch(e){observer.onError(e);return}md.setDisposable(duration.take(1).subscribe(noop,observer.onError.bind(observer),expire));leftMap.getValues().forEach(function(v){var result;try{result=resultSelector(v,value)}catch(exn){observer.onError(exn);return}observer.onNext(result)})},observer.onError.bind(observer),function(){rightDone=true;(leftDone||rightMap.count()===0)&&observer.onCompleted()}));return group},left)};observableProto.groupJoin=function(right,leftDurationSelector,rightDurationSelector,resultSelector){var left=this;return new AnonymousObservable(function(observer){var group=new CompositeDisposable;var r=new RefCountDisposable(group);var leftMap=new Dictionary,rightMap=new Dictionary;var leftId=0,rightId=0;function handleError(e){return function(v){v.onError(e)}}group.add(left.subscribe(function(value){var s=new Subject;var id=leftId++;leftMap.add(id,s);var result;try{result=resultSelector(value,addRef(s,r))}catch(e){leftMap.getValues().forEach(handleError(e));observer.onError(e);return}observer.onNext(result);rightMap.getValues().forEach(function(v){s.onNext(v)});var md=new SingleAssignmentDisposable;group.add(md);var expire=function(){leftMap.remove(id)&&s.onCompleted();group.remove(md)};var duration;try{duration=leftDurationSelector(value)}catch(e){leftMap.getValues().forEach(handleError(e));observer.onError(e);return}md.setDisposable(duration.take(1).subscribe(noop,function(e){leftMap.getValues().forEach(handleError(e));observer.onError(e)},expire))},function(e){leftMap.getValues().forEach(handleError(e));observer.onError(e)},observer.onCompleted.bind(observer)));group.add(right.subscribe(function(value){var id=rightId++;rightMap.add(id,value);var md=new SingleAssignmentDisposable;group.add(md);var expire=function(){rightMap.remove(id);group.remove(md)};var duration;try{duration=rightDurationSelector(value)}catch(e){leftMap.getValues().forEach(handleError(e));observer.onError(e);return}md.setDisposable(duration.take(1).subscribe(noop,function(e){leftMap.getValues().forEach(handleError(e));observer.onError(e)},expire));leftMap.getValues().forEach(function(v){v.onNext(value)})},function(e){leftMap.getValues().forEach(handleError(e));observer.onError(e)}));return r},left)};observableProto.buffer=function(bufferOpeningsOrClosingSelector,bufferClosingSelector){return this.window.apply(this,arguments).selectMany(function(x){return x.toArray()})};observableProto.window=function(windowOpeningsOrClosingSelector,windowClosingSelector){if(arguments.length===1&&typeof arguments[0]!=="function"){return observableWindowWithBoundaries.call(this,windowOpeningsOrClosingSelector)}return typeof windowOpeningsOrClosingSelector==="function"?observableWindowWithClosingSelector.call(this,windowOpeningsOrClosingSelector):observableWindowWithOpenings.call(this,windowOpeningsOrClosingSelector,windowClosingSelector)};function observableWindowWithOpenings(windowOpenings,windowClosingSelector){return windowOpenings.groupJoin(this,windowClosingSelector,observableEmpty,function(_,win){return win})}function observableWindowWithBoundaries(windowBoundaries){var source=this;return new AnonymousObservable(function(observer){var win=new Subject,d=new CompositeDisposable,r=new RefCountDisposable(d);observer.onNext(addRef(win,r));d.add(source.subscribe(function(x){win.onNext(x)},function(err){win.onError(err);observer.onError(err)},function(){win.onCompleted();observer.onCompleted()}));isPromise(windowBoundaries)&&(windowBoundaries=observableFromPromise(windowBoundaries));d.add(windowBoundaries.subscribe(function(w){win.onCompleted();win=new Subject;observer.onNext(addRef(win,r))},function(err){win.onError(err);observer.onError(err)},function(){win.onCompleted();observer.onCompleted()}));return r},source)}function observableWindowWithClosingSelector(windowClosingSelector){var source=this;return new AnonymousObservable(function(observer){var m=new SerialDisposable,d=new CompositeDisposable(m),r=new RefCountDisposable(d),win=new Subject;observer.onNext(addRef(win,r));d.add(source.subscribe(function(x){win.onNext(x)},function(err){win.onError(err);observer.onError(err)},function(){win.onCompleted();observer.onCompleted()}));function createWindowClose(){var windowClose;try{windowClose=windowClosingSelector()}catch(e){observer.onError(e);return}isPromise(windowClose)&&(windowClose=observableFromPromise(windowClose));var m1=new SingleAssignmentDisposable;m.setDisposable(m1);m1.setDisposable(windowClose.take(1).subscribe(noop,function(err){win.onError(err);observer.onError(err)},function(){win.onCompleted();win=new Subject;observer.onNext(addRef(win,r));createWindowClose()}))}createWindowClose();return r},source) diff --git a/package.json b/package.json index c7bf30d..5991ca8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rxmarbles", - "version": "1.3.0", + "version": "1.3.1", "author": "Andre Staltz", "repository": { "type": "git", diff --git a/src/element.js b/src/element.js index 553cd3c..14dc455 100644 --- a/src/element.js +++ b/src/element.js @@ -20,6 +20,6 @@ SandboxPrototype.createdCallback = function createdCallback() { Renderer.inject(View); }; -var XRxMarbles = document.registerElement('x-rxmarbles', { +var XRxMarbles = document.registerElement('rx-marbles', { prototype: SandboxPrototype }); diff --git a/test-custom-element.html b/test-custom-element.html index 8a2c7f1..a6d851e 100644 --- a/test-custom-element.html +++ b/test-custom-element.html @@ -16,6 +16,6 @@ - +