domsubi
Version:
A Virtual-DOM Library for JavaScript
34 lines (32 loc) • 77.6 kB
JavaScript
/*!
* domsubi v0.1.0
* https://github.com/junkieta/domsubi#readme
* Copyright (c) 2021 junkieta
* License: MIT
*
* SodiumFRP/sodium-typescript (required by domsubi)
* https://github.com/SodiumFRP/sodium-typescript/
* Copyright (c) 2012-2015 Stephen Blackheath and Anthony Jones
* License: BSD 3-Clause(https://opensource.org/licenses/BSD-3-Clause)
*
* basarat/typescript-collections (required by SodiumFRP/sodium-typescript)
* https://github.com/basarat/typescript-collections
* Copyright (c) 2010-2017 Tomasz Ciborski
* License: MIT
*
* sanctuary-js/sanctuary-type-classes (required by SodiumFRP/sodium-typescript)
* https://github.com/sanctuary-js/sanctuary-type-classes
* Copyright (c) 2020 Sanctuary
* License: MIT
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).domsubi={})}(this,(function(t){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n={},r={},i={};!function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Object.prototype.hasOwnProperty;function n(t){return"function"==typeof t}function r(t){return void 0===t}function i(t){return"[object String]"===Object.prototype.toString.call(t)}t.has=function(t,n){return e.call(t,n)},t.defaultCompare=function(t,e){return t<e?-1:t===e?0:1},t.defaultEquals=function(t,e){return t===e},t.defaultToString=function(t){return null===t?"COLLECTION_NULL":r(t)?"COLLECTION_UNDEFINED":i(t)?"$s"+t:"$o"+t.toString()},t.makeString=function(e,n){if(void 0===n&&(n=","),null===e)return"COLLECTION_NULL";if(r(e))return"COLLECTION_UNDEFINED";if(i(e))return e.toString();var o="{",s=!0;for(var u in e)t.has(e,u)&&(s?s=!1:o+=n,o=o+u+":"+e[u]);return o+"}"},t.isFunction=n,t.isUndefined=r,t.isString=i,t.reverseCompareFunction=function(t){return r(t)||!n(t)?function(t,e){return t<e?1:t===e?0:-1}:function(e,n){return-1*t(e,n)}},t.compareToEquals=function(t){return function(e,n){return 0===t(e,n)}}}(i),Object.defineProperty(r,"__esModule",{value:!0});var o=i;function s(t,e,n){for(var r=n||o.defaultEquals,i=t.length,s=0;s<i;s++)if(r(t[s],e))return s;return-1}r.indexOf=s,r.lastIndexOf=function(t,e,n){for(var r=n||o.defaultEquals,i=t.length-1;i>=0;i--)if(r(t[i],e))return i;return-1},r.contains=function(t,e,n){return s(t,e,n)>=0},r.remove=function(t,e,n){var r=s(t,e,n);return!(r<0)&&(t.splice(r,1),!0)},r.frequency=function(t,e,n){for(var r=n||o.defaultEquals,i=t.length,s=0,u=0;u<i;u++)r(t[u],e)&&s++;return s},r.equals=function(t,e,n){var r=n||o.defaultEquals;if(t.length!==e.length)return!1;for(var i=t.length,s=0;s<i;s++)if(!r(t[s],e[s]))return!1;return!0},r.copy=function(t){return t.concat()},r.swap=function(t,e,n){if(e<0||e>=t.length||n<0||n>=t.length)return!1;var r=t[e];return t[e]=t[n],t[n]=r,!0},r.toString=function(t){return"["+t.toString()+"]"},r.forEach=function(t,e){for(var n=0,r=t;n<r.length;n++){if(!1===e(r[n]))return}};var u={},a={};Object.defineProperty(a,"__esModule",{value:!0});var l=i,c=function(){function t(t){this.table={},this.nElements=0,this.toStr=t||l.defaultToString}return t.prototype.getValue=function(t){var e=this.table["$"+this.toStr(t)];if(!l.isUndefined(e))return e.value},t.prototype.setValue=function(t,e){if(!l.isUndefined(t)&&!l.isUndefined(e)){var n,r="$"+this.toStr(t),i=this.table[r];return l.isUndefined(i)?(this.nElements++,n=void 0):n=i.value,this.table[r]={key:t,value:e},n}},t.prototype.remove=function(t){var e="$"+this.toStr(t),n=this.table[e];if(!l.isUndefined(n))return delete this.table[e],this.nElements--,n.value},t.prototype.keys=function(){var t=[];for(var e in this.table)if(l.has(this.table,e)){var n=this.table[e];t.push(n.key)}return t},t.prototype.values=function(){var t=[];for(var e in this.table)if(l.has(this.table,e)){var n=this.table[e];t.push(n.value)}return t},t.prototype.forEach=function(t){for(var e in this.table)if(l.has(this.table,e)){var n=this.table[e];if(!1===t(n.key,n.value))return}},t.prototype.containsKey=function(t){return!l.isUndefined(this.getValue(t))},t.prototype.clear=function(){this.table={},this.nElements=0},t.prototype.size=function(){return this.nElements},t.prototype.isEmpty=function(){return this.nElements<=0},t.prototype.toString=function(){var t="{";return this.forEach((function(e,n){t+="\n\t"+e+" : "+n})),t+"\n}"},t}();a.default=c;var f={};Object.defineProperty(f,"__esModule",{value:!0});var h=i,p=r,d=a,y=function(){function t(t){this.dictionary=new d.default(t)}return t.prototype.contains=function(t){return this.dictionary.containsKey(t)},t.prototype.add=function(t){return!this.contains(t)&&!h.isUndefined(t)&&(this.dictionary.setValue(t,t),!0)},t.prototype.intersection=function(t){var e=this;this.forEach((function(n){return t.contains(n)||e.remove(n),!0}))},t.prototype.union=function(t){var e=this;t.forEach((function(t){return e.add(t),!0}))},t.prototype.difference=function(t){var e=this;t.forEach((function(t){return e.remove(t),!0}))},t.prototype.isSubsetOf=function(t){if(this.size()>t.size())return!1;var e=!0;return this.forEach((function(n){return!!t.contains(n)||(e=!1,!1)})),e},t.prototype.remove=function(t){return!!this.contains(t)&&(this.dictionary.remove(t),!0)},t.prototype.forEach=function(t){this.dictionary.forEach((function(e,n){return t(n)}))},t.prototype.toArray=function(){return this.dictionary.values()},t.prototype.isEmpty=function(){return this.dictionary.isEmpty()},t.prototype.size=function(){return this.dictionary.size()},t.prototype.clear=function(){this.dictionary.clear()},t.prototype.toString=function(){return p.toString(this.toArray())},t}();f.default=y,Object.defineProperty(u,"__esModule",{value:!0});var v=i,m=a,_=f,g=function(){function t(t){this.toStrF=t||v.defaultToString,this.dictionary=new m.default(this.toStrF),this.nElements=0}return t.prototype.add=function(t,e){if(void 0===e&&(e=1),v.isUndefined(t)||e<=0)return!1;if(this.contains(t))this.dictionary.getValue(t).copies+=e;else{var n={value:t,copies:e};this.dictionary.setValue(t,n)}return this.nElements+=e,!0},t.prototype.count=function(t){return this.contains(t)?this.dictionary.getValue(t).copies:0},t.prototype.contains=function(t){return this.dictionary.containsKey(t)},t.prototype.remove=function(t,e){if(void 0===e&&(e=1),v.isUndefined(t)||e<=0)return!1;if(this.contains(t)){var n=this.dictionary.getValue(t);return e>n.copies?this.nElements-=n.copies:this.nElements-=e,n.copies-=e,n.copies<=0&&this.dictionary.remove(t),!0}return!1},t.prototype.toArray=function(){for(var t=[],e=0,n=this.dictionary.values();e<n.length;e++)for(var r=n[e],i=r.value,o=r.copies,s=0;s<o;s++)t.push(i);return t},t.prototype.toSet=function(){for(var t=new _.default(this.toStrF),e=0,n=this.dictionary.values();e<n.length;e++){var r=n[e].value;t.add(r)}return t},t.prototype.forEach=function(t){this.dictionary.forEach((function(e,n){for(var r=n.value,i=n.copies,o=0;o<i;o++)if(!1===t(r))return!1;return!0}))},t.prototype.size=function(){return this.nElements},t.prototype.isEmpty=function(){return 0===this.nElements},t.prototype.clear=function(){this.nElements=0,this.dictionary.clear()},t}();u.default=g;var x={},w={},b={},E={};Object.defineProperty(E,"__esModule",{value:!0});var N=i,I=r,T=function(){function t(){this.firstNode=null,this.lastNode=null,this.nElements=0}return t.prototype.add=function(t,e){if(N.isUndefined(e)&&(e=this.nElements),e<0||e>this.nElements||N.isUndefined(t))return!1;var n=this.createNode(t);if(0===this.nElements||null===this.lastNode)this.firstNode=n,this.lastNode=n;else if(e===this.nElements)this.lastNode.next=n,this.lastNode=n;else if(0===e)n.next=this.firstNode,this.firstNode=n;else{var r=this.nodeAtIndex(e-1);if(null===r)return!1;n.next=r.next,r.next=n}return this.nElements++,!0},t.prototype.first=function(){if(null!==this.firstNode)return this.firstNode.element},t.prototype.last=function(){if(null!==this.lastNode)return this.lastNode.element},t.prototype.elementAtIndex=function(t){var e=this.nodeAtIndex(t);if(null!==e)return e.element},t.prototype.indexOf=function(t,e){var n=e||N.defaultEquals;if(N.isUndefined(t))return-1;for(var r=this.firstNode,i=0;null!==r;){if(n(r.element,t))return i;i++,r=r.next}return-1},t.prototype.contains=function(t,e){return this.indexOf(t,e)>=0},t.prototype.remove=function(t,e){var n=e||N.defaultEquals;if(this.nElements<1||N.isUndefined(t))return!1;for(var r=null,i=this.firstNode;null!==i;){if(n(i.element,t))return null===r?(this.firstNode=i.next,i===this.lastNode&&(this.lastNode=null)):i===this.lastNode?(this.lastNode=r,r.next=i.next,i.next=null):(r.next=i.next,i.next=null),this.nElements--,!0;r=i,i=i.next}return!1},t.prototype.clear=function(){this.firstNode=null,this.lastNode=null,this.nElements=0},t.prototype.equals=function(e,n){var r=n||N.defaultEquals;return e instanceof t&&(this.size()===e.size()&&this.equalsAux(this.firstNode,e.firstNode,r))},t.prototype.equalsAux=function(t,e,n){for(;null!==t&&null!==e;){if(!n(t.element,e.element))return!1;t=t.next,e=e.next}return!0},t.prototype.removeElementAtIndex=function(t){if(!(t<0||t>=this.nElements||null===this.firstNode||null===this.lastNode)){var e;if(1===this.nElements)e=this.firstNode.element,this.firstNode=null,this.lastNode=null;else{var n=this.nodeAtIndex(t-1);null===n?(e=this.firstNode.element,this.firstNode=this.firstNode.next):n.next===this.lastNode&&(e=this.lastNode.element,this.lastNode=n),null!==n&&null!==n.next&&(e=n.next.element,n.next=n.next.next)}return this.nElements--,e}},t.prototype.forEach=function(t){for(var e=this.firstNode;null!==e&&!1!==t(e.element);)e=e.next},t.prototype.reverse=function(){for(var t=null,e=this.firstNode,n=null;null!==e;)n=e.next,e.next=t,t=e,e=n;n=this.firstNode,this.firstNode=this.lastNode,this.lastNode=n},t.prototype.toArray=function(){for(var t=[],e=this.firstNode;null!==e;)t.push(e.element),e=e.next;return t},t.prototype.size=function(){return this.nElements},t.prototype.isEmpty=function(){return this.nElements<=0},t.prototype.toString=function(){return I.toString(this.toArray())},t.prototype.nodeAtIndex=function(t){if(t<0||t>=this.nElements)return null;if(t===this.nElements-1)return this.lastNode;for(var e=this.firstNode,n=0;n<t&&null!==e;n++)e=e.next;return e},t.prototype.createNode=function(t){return{element:t,next:null}},t}();E.default=T,Object.defineProperty(b,"__esModule",{value:!0});var C=E,A=function(){function t(){this.list=new C.default}return t.prototype.enqueue=function(t){return this.list.add(t)},t.prototype.add=function(t){return this.list.add(t)},t.prototype.dequeue=function(){if(0!==this.list.size()){var t=this.list.first();return this.list.removeElementAtIndex(0),t}},t.prototype.peek=function(){if(0!==this.list.size())return this.list.first()},t.prototype.size=function(){return this.list.size()},t.prototype.contains=function(t,e){return this.list.contains(t,e)},t.prototype.isEmpty=function(){return this.list.size()<=0},t.prototype.clear=function(){this.list.clear()},t.prototype.forEach=function(t){this.list.forEach(t)},t}();b.default=A,Object.defineProperty(w,"__esModule",{value:!0});var S=i,k=b,O=function(){function t(t){this.root=null,this.compare=t||S.defaultCompare,this.nElements=0}return t.prototype.add=function(t){return!S.isUndefined(t)&&(null!==this.insertNode(this.createNode(t))&&(this.nElements++,!0))},t.prototype.clear=function(){this.root=null,this.nElements=0},t.prototype.isEmpty=function(){return 0===this.nElements},t.prototype.size=function(){return this.nElements},t.prototype.contains=function(t){return!S.isUndefined(t)&&null!==this.searchNode(this.root,t)},t.prototype.search=function(t){var e=this.searchNode(this.root,t);if(null!==e)return e.element},t.prototype.remove=function(t){var e=this.searchNode(this.root,t);return null!==e&&(this.removeNode(e),this.nElements--,!0)},t.prototype.inorderTraversal=function(t){this.inorderTraversalAux(this.root,t,{stop:!1})},t.prototype.preorderTraversal=function(t){this.preorderTraversalAux(this.root,t,{stop:!1})},t.prototype.postorderTraversal=function(t){this.postorderTraversalAux(this.root,t,{stop:!1})},t.prototype.levelTraversal=function(t){this.levelTraversalAux(this.root,t)},t.prototype.minimum=function(){if(!this.isEmpty()&&null!==this.root)return this.minimumAux(this.root).element},t.prototype.maximum=function(){if(!this.isEmpty()&&null!==this.root)return this.maximumAux(this.root).element},t.prototype.forEach=function(t){this.inorderTraversal(t)},t.prototype.toArray=function(){var t=[];return this.inorderTraversal((function(e){return t.push(e),!0})),t},t.prototype.height=function(){return this.heightAux(this.root)},t.prototype.searchNode=function(t,e){for(var n=1;null!==t&&0!==n;)(n=this.compare(e,t.element))<0?t=t.leftCh:n>0&&(t=t.rightCh);return t},t.prototype.transplant=function(t,e){null===t.parent?this.root=e:t===t.parent.leftCh?t.parent.leftCh=e:t.parent.rightCh=e,null!==e&&(e.parent=t.parent)},t.prototype.removeNode=function(t){if(null===t.leftCh)this.transplant(t,t.rightCh);else if(null===t.rightCh)this.transplant(t,t.leftCh);else{var e=this.minimumAux(t.rightCh);e.parent!==t&&(this.transplant(e,e.rightCh),e.rightCh=t.rightCh,e.rightCh.parent=e),this.transplant(t,e),e.leftCh=t.leftCh,e.leftCh.parent=e}},t.prototype.inorderTraversalAux=function(t,e,n){null===t||n.stop||(this.inorderTraversalAux(t.leftCh,e,n),n.stop||(n.stop=!1===e(t.element),n.stop||this.inorderTraversalAux(t.rightCh,e,n)))},t.prototype.levelTraversalAux=function(t,e){var n=new k.default;for(null!==t&&n.enqueue(t),t=n.dequeue()||null;null!=t;){if(!1===e(t.element))return;null!==t.leftCh&&n.enqueue(t.leftCh),null!==t.rightCh&&n.enqueue(t.rightCh),t=n.dequeue()||null}},t.prototype.preorderTraversalAux=function(t,e,n){null===t||n.stop||(n.stop=!1===e(t.element),n.stop||(this.preorderTraversalAux(t.leftCh,e,n),n.stop||this.preorderTraversalAux(t.rightCh,e,n)))},t.prototype.postorderTraversalAux=function(t,e,n){null===t||n.stop||(this.postorderTraversalAux(t.leftCh,e,n),n.stop||(this.postorderTraversalAux(t.rightCh,e,n),n.stop||(n.stop=!1===e(t.element))))},t.prototype.minimumAux=function(t){for(;null!=t&&null!==t.leftCh;)t=t.leftCh;return t},t.prototype.maximumAux=function(t){for(;null!=t&&null!==t.rightCh;)t=t.rightCh;return t},t.prototype.heightAux=function(t){return null===t?-1:Math.max(this.heightAux(t.leftCh),this.heightAux(t.rightCh))+1},t.prototype.insertNode=function(t){for(var e=null,n=this.root;null!==n;){var r=this.compare(t.element,n.element);if(0===r)return null;r<0?(e=n,n=n.leftCh):(e=n,n=n.rightCh)}return t.parent=e,null===e?this.root=t:this.compare(t.element,e.element)<0?e.leftCh=t:e.rightCh=t,t},t.prototype.createNode=function(t){return{element:t,leftCh:null,rightCh:null,parent:null}},t}();w.default=O;var V=e&&e.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(x,"__esModule",{value:!0});var R=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return V(e,t),e}(w.default);x.default=R;var j={};Object.defineProperty(j,"__esModule",{value:!0});var L=i,z=r,D=function(){function t(t){this.data=[],this.compare=t||L.defaultCompare}return t.prototype.leftChildIndex=function(t){return 2*t+1},t.prototype.rightChildIndex=function(t){return 2*t+2},t.prototype.parentIndex=function(t){return Math.floor((t-1)/2)},t.prototype.minIndex=function(t,e){return e>=this.data.length?t>=this.data.length?-1:t:this.compare(this.data[t],this.data[e])<=0?t:e},t.prototype.siftUp=function(t){for(var e=this.parentIndex(t);t>0&&this.compare(this.data[e],this.data[t])>0;)z.swap(this.data,e,t),t=e,e=this.parentIndex(t)},t.prototype.siftDown=function(t){for(var e=this.minIndex(this.leftChildIndex(t),this.rightChildIndex(t));e>=0&&this.compare(this.data[t],this.data[e])>0;)z.swap(this.data,e,t),t=e,e=this.minIndex(this.leftChildIndex(t),this.rightChildIndex(t))},t.prototype.peek=function(){return this.data.length>0?this.data[0]:void 0},t.prototype.add=function(t){return!L.isUndefined(t)&&(this.data.push(t),this.siftUp(this.data.length-1),!0)},t.prototype.removeRoot=function(){if(this.data.length>0){var t=this.data[0];return this.data[0]=this.data[this.data.length-1],this.data.splice(this.data.length-1,1),this.data.length>0&&this.siftDown(0),t}},t.prototype.contains=function(t){var e=L.compareToEquals(this.compare);return z.contains(this.data,t,e)},t.prototype.size=function(){return this.data.length},t.prototype.isEmpty=function(){return this.data.length<=0},t.prototype.clear=function(){this.data.length=0},t.prototype.forEach=function(t){z.forEach(this.data,t)},t}();j.default=D;var q={},P=e&&e.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(q,"__esModule",{value:!0});var U=a,M=i,F=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},t}(),Q=function(){function t(){this.key=null,this.value=null}return t.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},t}();var B=function(t){function e(e){var n=t.call(this,e)||this;return n.head=new Q,n.tail=new Q,n.head.next=n.tail,n.tail.prev=n.head,n}return P(e,t),e.prototype.appendToTail=function(t){var e=this.tail.prev;e.next=t,t.prev=e,t.next=this.tail,this.tail.prev=t},e.prototype.getLinkedDictionaryPair=function(t){if(!M.isUndefined(t)){var e="$"+this.toStr(t);return this.table[e]}},e.prototype.getValue=function(t){var e=this.getLinkedDictionaryPair(t);if(!M.isUndefined(e))return e.value},e.prototype.remove=function(e){var n=this.getLinkedDictionaryPair(e);if(!M.isUndefined(n))return t.prototype.remove.call(this,e),n.unlink(),n.value},e.prototype.clear=function(){t.prototype.clear.call(this),this.head.next=this.tail,this.tail.prev=this.head},e.prototype.replace=function(t,e){var n="$"+this.toStr(e.key);e.next=t.next,e.prev=t.prev,this.remove(t.key),e.prev.next=e,e.next.prev=e,this.table[n]=e,++this.nElements},e.prototype.setValue=function(t,e){if(!M.isUndefined(t)&&!M.isUndefined(e)){var n=this.getLinkedDictionaryPair(t),r=new F(t,e),i="$"+this.toStr(t);return M.isUndefined(n)?(this.appendToTail(r),this.table[i]=r,void++this.nElements):(this.replace(n,r),n.value)}},e.prototype.keys=function(){var t=[];return this.forEach((function(e,n){t.push(e)})),t},e.prototype.values=function(){var t=[];return this.forEach((function(e,n){t.push(n)})),t},e.prototype.forEach=function(t){for(var e=this.head.next;e.next;){if(!1===t(e.key,e.value))return;e=e.next}},e}(U.default);q.default=B;var $={};Object.defineProperty($,"__esModule",{value:!0});var H=i,W=a,G=r,K=function(){function t(t,e,n){void 0===n&&(n=!1),this.dict=new W.default(t),this.equalsF=e||H.defaultEquals,this.allowDuplicate=n}return t.prototype.getValue=function(t){var e=this.dict.getValue(t);return H.isUndefined(e)?[]:G.copy(e)},t.prototype.setValue=function(t,e){if(H.isUndefined(t)||H.isUndefined(e))return!1;var n=this.dict.getValue(t);return H.isUndefined(n)?(this.dict.setValue(t,[e]),!0):!(!this.allowDuplicate&&G.contains(n,e,this.equalsF))&&(n.push(e),!0)},t.prototype.remove=function(t,e){if(H.isUndefined(e)){var n=this.dict.remove(t);return!H.isUndefined(n)}var r=this.dict.getValue(t);return!(H.isUndefined(r)||!G.remove(r,e,this.equalsF))&&(0===r.length&&this.dict.remove(t),!0)},t.prototype.keys=function(){return this.dict.keys()},t.prototype.values=function(){for(var t=[],e=0,n=this.dict.values();e<n.length;e++)for(var r=0,i=n[e];r<i.length;r++){var o=i[r];t.push(o)}return t},t.prototype.containsKey=function(t){return this.dict.containsKey(t)},t.prototype.clear=function(){this.dict.clear()},t.prototype.size=function(){return this.dict.size()},t.prototype.isEmpty=function(){return this.dict.isEmpty()},t}();$.default=K;var J={},Y=e&&e.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(J,"__esModule",{value:!0});var X=i,Z=function(t){function e(e,n){var r=t.call(this,n)||this;return r.defaultFactoryFunction=e,r}return Y(e,t),e.prototype.setDefault=function(e,n){var r=t.prototype.getValue.call(this,e);return X.isUndefined(r)?(this.setValue(e,n),n):r},e.prototype.getValue=function(t){return this.setDefault(t,this.defaultFactoryFunction())},e}(a.default);J.default=Z;var tt={};Object.defineProperty(tt,"__esModule",{value:!0});var et=i,nt=j,rt=function(){function t(t){this.heap=new nt.default(et.reverseCompareFunction(t))}return t.prototype.enqueue=function(t){return this.heap.add(t)},t.prototype.add=function(t){return this.heap.add(t)},t.prototype.dequeue=function(){if(0!==this.heap.size()){var t=this.heap.peek();return this.heap.removeRoot(),t}},t.prototype.peek=function(){return this.heap.peek()},t.prototype.contains=function(t){return this.heap.contains(t)},t.prototype.isEmpty=function(){return this.heap.isEmpty()},t.prototype.size=function(){return this.heap.size()},t.prototype.clear=function(){this.heap.clear()},t.prototype.forEach=function(t){this.heap.forEach(t)},t}();tt.default=rt;var it={};Object.defineProperty(it,"__esModule",{value:!0});var ot=E,st=function(){function t(){this.list=new ot.default}return t.prototype.push=function(t){return this.list.add(t,0)},t.prototype.add=function(t){return this.list.add(t,0)},t.prototype.pop=function(){return this.list.removeElementAtIndex(0)},t.prototype.peek=function(){return this.list.first()},t.prototype.size=function(){return this.list.size()},t.prototype.contains=function(t,e){return this.list.contains(t,e)},t.prototype.isEmpty=function(){return this.list.isEmpty()},t.prototype.clear=function(){this.list.clear()},t.prototype.forEach=function(t){this.list.forEach(t)},t}();it.default=st;var ut,at={};Object.defineProperty(at,"__esModule",{value:!0}),function(t){t[t.BEFORE=0]="BEFORE",t[t.AFTER=1]="AFTER",t[t.INSIDE_AT_END=2]="INSIDE_AT_END",t[t.INSIDE_AT_START=3]="INSIDE_AT_START"}(ut||(ut={}));var lt=function(){function t(t,e){void 0===t&&(t=[]),void 0===e&&(e={}),this.rootIds=t,this.nodes=e,this.initRootIds(),this.initNodes()}return t.prototype.initRootIds=function(){for(var t=0,e=this.rootIds;t<e.length;t++){var n=e[t];this.createEmptyNodeIfNotExist(n)}},t.prototype.initNodes=function(){for(var t in this.nodes)if(this.nodes.hasOwnProperty(t))for(var e=0,n=this.nodes[t];e<n.length;e++){var r=n[e];this.createEmptyNodeIfNotExist(r)}},t.prototype.createEmptyNodeIfNotExist=function(t){this.nodes[t]||(this.nodes[t]=[])},t.prototype.getRootIds=function(){return this.rootIds.slice()},t.prototype.getNodes=function(){var t={};for(var e in this.nodes)this.nodes.hasOwnProperty(e)&&(t[e]=this.nodes[e].slice());return t},t.prototype.getObject=function(){return{rootIds:this.getRootIds(),nodes:this.getNodes()}},t.prototype.toObject=function(){return this.getObject()},t.prototype.flatten=function(){for(var t=this,e=[],n=0;n<this.rootIds.length;n++){var r=this.rootIds[n];e.push({id:r,level:0,hasParent:!1,childrenCount:0}),a(r,this.nodes,e,0)}for(var i=0,o=e;i<o.length;i++){var s=o[i];s.childrenCount=u(s.id)}return e;function u(e){return t.nodes[e]?t.nodes[e].length:0}function a(t,e,n,r){if(void 0===r&&(r=0),t&&e&&n&&e[t]){r++;for(var i=e[t],o=0;o<i.length;o++){var s=i[o];n.push({id:s,level:r,hasParent:!0}),a(s,e,n,r)}r--}}},t.prototype.moveIdBeforeId=function(t,e){return this.moveId(t,e,ut.BEFORE)},t.prototype.moveIdAfterId=function(t,e){return this.moveId(t,e,ut.AFTER)},t.prototype.moveIdIntoId=function(t,e,n){return void 0===n&&(n=!0),n?this.moveId(t,e,ut.INSIDE_AT_START):this.moveId(t,e,ut.INSIDE_AT_END)},t.prototype.swapRootIdWithRootId=function(t,e){var n=this.findRootId(t),r=this.findRootId(e);this.swapRootPositionWithRootPosition(n,r)},t.prototype.swapRootPositionWithRootPosition=function(t,e){var n=this.rootIds[e];this.rootIds[e]=this.rootIds[t],this.rootIds[t]=n},t.prototype.deleteId=function(t){this.rootDeleteId(t),this.nodeAndSubNodesDelete(t),this.nodeRefrencesDelete(t)},t.prototype.insertIdBeforeId=function(t,e){var n=this.findRootId(t);for(var r in n>-1&&this.insertIdIntoRoot(e,n),this.nodes)if(this.nodes.hasOwnProperty(r)){var i=this.findNodeId(r,t);i>-1&&this.insertIdIntoNode(r,e,i)}},t.prototype.insertIdAfterId=function(t,e){var n=this.findRootId(t);for(var r in n>-1&&this.insertIdIntoRoot(e,n+1),this.nodes)if(this.nodes.hasOwnProperty(r)){var i=this.findNodeId(r,t);i>-1&&this.insertIdIntoNode(r,e,i+1)}},t.prototype.insertIdIntoId=function(t,e){this.nodeInsertAtEnd(t,e),this.nodes[e]=[]},t.prototype.insertIdIntoRoot=function(t,e){if(void 0===e)this.rootInsertAtEnd(t);else if(e<0){var n=this.rootIds.length;this.rootIds.splice(e+n+1,0,t)}else this.rootIds.splice(e,0,t);this.nodes[t]=this.nodes[t]||[]},t.prototype.insertIdIntoNode=function(t,e,n){if(this.nodes[t]=this.nodes[t]||[],this.nodes[e]=this.nodes[e]||[],void 0===n)this.nodeInsertAtEnd(t,e);else if(n<0){var r=this.nodes[t].length;this.nodes[t].splice(n+r+1,0,e)}else this.nodes[t].splice(n,0,e)},t.prototype.moveId=function(t,e,n){var r=t,i=this.findRootId(r);for(var o in this.nodes[e],this.nodes)if(this.nodes.hasOwnProperty(o)){this.findNodeId(o,e);break}var s=e,u=this.findRootId(s);for(var o in this.nodes[e],this.nodes)if(this.nodes.hasOwnProperty(o)){this.findNodeId(o,e);break}if(i>-1)if(u>-1)switch(this.rootDelete(i),u>i&&u--,n){case ut.BEFORE:this.insertIdIntoRoot(r,u);break;case ut.AFTER:this.insertIdIntoRoot(r,u+1);break;case ut.INSIDE_AT_START:this.nodeInsertAtStart(s,r);break;case ut.INSIDE_AT_END:this.nodeInsertAtEnd(s,r)}else for(var o in this.rootDelete(i),this.nodes){if(this.nodes.hasOwnProperty(o))if((a=this.findNodeId(o,s))>-1){switch(n){case ut.BEFORE:this.insertIdIntoNode(o,r,a);break;case ut.AFTER:this.insertIdIntoNode(o,r,a+1);break;case ut.INSIDE_AT_START:this.nodeInsertAtStart(s,r);break;case ut.INSIDE_AT_END:this.nodeInsertAtEnd(s,r)}break}}else if(u>-1){for(var o in this.nodes){if(this.nodes.hasOwnProperty(o))if((a=this.findNodeId(o,r))>-1){this.nodeDeleteAtIndex(o,a);break}}switch(n){case ut.BEFORE:this.insertIdIntoRoot(r,u);break;case ut.AFTER:this.insertIdIntoRoot(r,u+1);break;case ut.INSIDE_AT_START:this.nodeInsertAtStart(s,r);break;case ut.INSIDE_AT_END:this.nodeInsertAtEnd(s,r)}}else{for(var o in this.nodes){if(this.nodes.hasOwnProperty(o))if((a=this.findNodeId(o,r))>-1){this.nodeDeleteAtIndex(o,a);break}}for(var o in this.nodes){var a;if(this.nodes.hasOwnProperty(o))if((a=this.findNodeId(o,s))>-1){switch(n){case ut.BEFORE:this.insertIdIntoNode(o,r,a);break;case ut.AFTER:this.insertIdIntoNode(o,r,a+1);break;case ut.INSIDE_AT_START:this.nodeInsertAtStart(s,r);break;case ut.INSIDE_AT_END:this.nodeInsertAtEnd(s,r)}break}}}},t.prototype.swapArrayElements=function(t,e,n){var r=t[e];return t[e]=t[n],t[n]=r,t},t.prototype.rootDeleteId=function(t){var e=this.findRootId(t);e>-1&&this.rootDelete(e)},t.prototype.nodeAndSubNodesDelete=function(t){for(var e=[],n=0;n<this.nodes[t].length;n++){var r=this.nodes[t][n];this.nodeAndSubNodesDelete(r),e.push(t)}this.nodeDelete(t);for(n=0;n<e.length;n++)this.nodeDelete(e[n])},t.prototype.nodeRefrencesDelete=function(t){for(var e in this.nodes)if(this.nodes.hasOwnProperty(e))for(var n=0;n<this.nodes[e].length;n++){this.nodes[e][n]===t&&this.nodeDeleteAtIndex(e,n)}},t.prototype.nodeDelete=function(t){delete this.nodes[t]},t.prototype.findRootId=function(t){return this.rootIds.indexOf(t)},t.prototype.findNodeId=function(t,e){return this.nodes[t].indexOf(e)},t.prototype.findNode=function(t){return this.nodes[t]},t.prototype.nodeInsertAtStart=function(t,e){this.nodes[t].unshift(e)},t.prototype.nodeInsertAtEnd=function(t,e){this.nodes[t].push(e)},t.prototype.rootDelete=function(t){this.rootIds.splice(t,1)},t.prototype.nodeDeleteAtIndex=function(t,e){this.nodes[t].splice(e,1)},t.prototype.rootInsertAtStart=function(t){this.rootIds.unshift(t)},t.prototype.rootInsertAtEnd=function(t){this.rootIds.push(t)},t}();at.default=lt,Object.defineProperty(n,"__esModule",{value:!0});var ct=r;n.arrays=ct;var ft=u;n.Bag=ft.default;var ht=x,pt=n.BSTree=ht.default,dt=w;n.BSTreeKV=dt.default;var yt=a,vt=n.Dictionary=yt.default,mt=j;n.Heap=mt.default;var _t=q;n.LinkedDictionary=_t.default;var gt=E;n.LinkedList=gt.default;var xt=$;n.MultiDictionary=xt.default;var wt=J;n.FactoryDictionary=wt.default;var bt=J;n.DefaultDictionary=bt.default;var Et=b;n.Queue=Et.default;var Nt=tt,It=n.PriorityQueue=Nt.default,Tt=f,Ct=n.Set=Tt.default,At=it;n.Stack=At.default;var St=at;n.MultiRootTree=St.default;var kt=i;n.util=kt;var Ot={exports:{}},Vt={exports:{}};!function(t){t.exports=function(){var t="@@type";function e(e){return null!=e&&null!=e.constructor&&e.constructor.prototype!==e&&"string"==typeof e.constructor[t]?e.constructor[t]:Object.prototype.toString.call(e).slice("[object ".length,-"]".length)}return e}()}(Vt),function(t){t.exports=function(t){if("undefined"!=typeof __doctest){__doctest.require("./test/Identity");var e=__doctest.require("./test/List"),n=__doctest.require("./test/Maybe");__doctest.require("./test/Sum"),__doctest.require("./test/Tuple"),e.Nil,e.Cons,n.Nothing,n.Just}function r(t){return function(e){return t.concat(e)}}function i(t){return function(e){return t}}function o(t,e){Object.keys(t).forEach(e,t)}function s(t,e){return Object.prototype.hasOwnProperty.call(e,t)}function u(t){return t}function a(t){return function(e){return[t,e]}}function l(e,n){return typeof e==typeof n&&t(e)===t(n)}function c(t){return function(e){return e(t)}}function f(t){return{value:t,done:!1}}function h(t){return{value:t,done:!0}}function p(t,e,n,r){if(!(this instanceof p))return new p(t,e,n,r);this.name=t,this.url=e,this.test=function(t){return n.every((function(e){return e.test(t)}))&&r(t)}}p["@@type"]="sanctuary-type-classes/TypeClass";var d="Constructor",y="Value";function v(t,e,n){for(var r=n,i=0;i<e.length;i+=1){var o=e[i];if(null==r||!t&&!s(o,r))return null;r=r[o]}return"function"==typeof r?r:null}function m(t,e){return v(!0,t,e)}function _(t){return v(!1,t,$t)}var g=s("name",(function(){}))?function(t){return t.name}:function(t){var e=/function (\w*)/.exec(t);return null==e?"":e[1]};function x(e,n,r){function i(e){var n="fantasy-land/"+e;return r[e]===d?function(t){var e=m([n],t);return null==e&&"function"==typeof t?_([g(t),n]):e}:function(e){var r=null;return null!=e&&null!=e.constructor&&e.constructor.prototype===e||(r=m([n],e)),null==r&&(r=_([t(e),"prototype",n])),r&&r.bind(e)}}var o="9.0.0",s=Object.keys(r),u=p("sanctuary-type-classes/"+e,"https://github.com/sanctuary-js/sanctuary-type-classes/tree/v"+o+"#"+e,n,(function(t){return s.every((function(e){var n=r[e]===d?t.constructor:t;return null!=i(e)(n)}))}));return u.methods=s.reduce((function(t,e){return t[e]=i(e),t}),{}),u}var w=x("Setoid",[],{equals:y}),b=x("Ord",[w],{lte:y}),E=x("Semigroupoid",[],{compose:y}),N=x("Category",[E],{id:d}),I=x("Semigroup",[],{concat:y}),T=x("Monoid",[I],{empty:d}),C=x("Group",[T],{invert:y}),A=x("Filterable",[],{filter:y}),S=x("Functor",[],{map:y}),k=x("Bifunctor",[S],{bimap:y}),O=x("Profunctor",[S],{promap:y}),V=x("Apply",[S],{ap:y}),R=x("Applicative",[V],{of:d}),j=x("Chain",[V],{chain:y}),L=x("ChainRec",[j],{chainRec:d}),z=x("Monad",[R,j],{}),D=x("Alt",[S],{alt:y}),q=x("Plus",[D],{zero:d}),P=x("Alternative",[R,q],{}),U=x("Foldable",[],{reduce:y}),M=x("Traversable",[S,U],{traverse:y}),F=x("Extend",[S],{extend:y}),Q=x("Comonad",[F],{extract:y}),B=x("Contravariant",[],{contramap:y});function $(t){return!0}function H(t){return!0}function W(t){return!0}function G(t){return!0}function K(t){return"object"==typeof this?Ht(this.valueOf(),t.valueOf()):this===t}function J(t){return"object"==typeof this?Gt(this.valueOf(),t.valueOf()):!1===this||!0===t}function Y(t){return"object"==typeof this?Ht(this.valueOf(),t.valueOf()):isNaN(this)&&isNaN(t)||this===t}function X(t){return"object"==typeof this?Gt(this.valueOf(),t.valueOf()):isNaN(this)||this<=t}function Z(t){return Ht(this.valueOf(),t.valueOf())}function tt(t){return Gt(this.valueOf(),t.valueOf())}function et(t){return t.source===this.source&&t.global===this.global&&t.ignoreCase===this.ignoreCase&&t.multiline===this.multiline&&t.sticky===this.sticky&&t.unicode===this.unicode}function nt(){return""}function rt(t){return"object"==typeof this?Ht(this.valueOf(),t.valueOf()):this===t}function it(t){return"object"==typeof this?Gt(this.valueOf(),t.valueOf()):this<=t}function ot(t){return this+t}function st(){return[]}function ut(t){return[t]}function at(t,e){for(var n=[],r={},i={head:e,tail:r};i!==r;){for(var o=r,s=t(f,h,i.head),u=0;u<s.length;u+=1){var a=s[u];a.done?n.push(a.value):o={head:a.value,tail:o}}for(i=i.tail;o!==r;)i={head:o.head,tail:i},o=o.tail}return n}function lt(){return[]}function ct(t){if(t.length!==this.length)return!1;for(var e=0;e<this.length;e+=1)if(!Ht(this[e],t[e]))return!1;return!0}function ft(t){for(var e=0;;e+=1){if(e===this.length)return!0;if(e===t.length)return!1;if(!Ht(this[e],t[e]))return Gt(this[e],t[e])}}function ht(t){return this.concat(t)}function pt(t){return this.filter((function(e){return t(e)}))}function dt(t){return this.map((function(e){return t(e)}))}function yt(t){for(var e=[],n=0;n<t.length;n+=1)for(var r=0;r<this.length;r+=1)e.push(t[n](this[r]));return e}function vt(t){for(var e=[],n=0;n<this.length;n+=1)for(var r=0,i=t(this[n]);r<i.length;r+=1)e.push(i[r]);return e}function mt(t,e){for(var n=e,r=0;r<this.length;r+=1)n=t(n,this[r]);return n}function _t(t,e){var n=this;function i(o,s){switch(s){case 0:return _e(t,[]);case 2:return de(a,e(n[o]),e(n[o+1]));default:var u=2*Math.floor(s/4);return de(r,i(o,u),i(o+u,s-u))}}return this.length%2==1?de(r,ae(ut,e(this[0])),i(1,this.length-1)):i(0,this.length)}function gt(t){return this.map((function(e,n,r){return t(r.slice(n))}))}function xt(t){return ct.call(this,t)}function wt(t){return ft.call(this,t)}function bt(t){return Ht(this.name,t.name)&&Ht(this.message,t.message)}function Et(){return{}}function Nt(){return{}}function It(t){var e=this,n=Object.keys(this).sort();return Ht(n,Object.keys(t).sort())&&n.every((function(n){return Ht(e[n],t[n])}))}function Tt(t){for(var e=Object.keys(this).sort(),n=Object.keys(t).sort();;){if(0===e.length)return!0;if(0===n.length)return!1;var r=e.shift(),i=n.shift();if(r<i)return!0;if(r>i)return!1;if(!Ht(this[r],t[r]))return Gt(this[r],t[r])}}function Ct(t){var e={};function n(t){e[t]=this[t]}return o(this,n),o(t,n),e}function At(t){var e={};return o(this,(function(n){t(this[n])&&(e[n]=this[n])})),e}function St(t){var e={};return o(this,(function(n){e[n]=t(this[n])})),e}function kt(t){var e={};return o(this,(function(n){s(n,t)&&(e[n]=t[n](this[n]))})),e}function Ot(t,e){var n=this;function r(e,r){return t(e,n[r])}return Object.keys(this).sort().reduce(r,e)}function Vt(t,e){var n=this;return Object.keys(this).reduce((function(t,r){function i(t){return function(e){var n={};return n[r]=e,Ct.call(t,n)}}return de(i,t,e(n[r]))}),_e(t,{}))}function Rt(){return u}function jt(t){return function(e){return t}}function Lt(t,e){return function(n){for(var r=f(e);!r.done;)r=t(f,h,r.value)(n);return r.value}}function zt(t){return t===this}function Dt(t){var e=this;return function(n){return t(e(n))}}function qt(t){var e=this;return function(n){return t(e(n))}}function Pt(t,e){var n=this;return function(r){return e(n(t(r)))}}function Ut(t){var e=this;return function(n){return t(n)(e(n))}}function Mt(t){var e=this;return function(n){return t(e(n))(n)}}function Ft(t){var e=this;return function(n){return t((function(t){return e(ee(n,t))}))}}function Qt(t){var e=this;return function(n){return e(t(n))}}var Bt,$t={Null:{prototype:{"fantasy-land/equals":$,"fantasy-land/lte":H}},Undefined:{prototype:{"fantasy-land/equals":W,"fantasy-land/lte":G}},Boolean:{prototype:{"fantasy-land/equals":K,"fantasy-land/lte":J}},Number:{prototype:{"fantasy-land/equals":Y,"fantasy-land/lte":X}},Date:{prototype:{"fantasy-land/equals":Z,"fantasy-land/lte":tt}},RegExp:{prototype:{"fantasy-land/equals":et}},String:{"fantasy-land/empty":nt,prototype:{"fantasy-land/equals":rt,"fantasy-land/lte":it,"fantasy-land/concat":ot}},Array:{"fantasy-land/empty":st,"fantasy-land/of":ut,"fantasy-land/chainRec":at,"fantasy-land/zero":lt,prototype:{"fantasy-land/equals":ct,"fantasy-land/lte":ft,"fantasy-land/concat":ht,"fantasy-land/filter":pt,"fantasy-land/map":dt,"fantasy-land/ap":yt,"fantasy-land/chain":vt,"fantasy-land/alt":ht,"fantasy-land/reduce":mt,"fantasy-land/traverse":_t,"fantasy-land/extend":gt}},Arguments:{prototype:{"fantasy-land/equals":xt,"fantasy-land/lte":wt}},Error:{prototype:{"fantasy-land/equals":bt}},Object:{"fantasy-land/empty":Et,"fantasy-land/zero":Nt,prototype:{"fantasy-land/equals":It,"fantasy-land/lte":Tt,"fantasy-land/concat":Ct,"fantasy-land/filter":At,"fantasy-land/map":St,"fantasy-land/ap":kt,"fantasy-land/alt":Ct,"fantasy-land/reduce":Ot,"fantasy-land/traverse":Vt}},Function:{"fantasy-land/id":Rt,"fantasy-land/of":jt,"fantasy-land/chainRec":Lt,prototype:{"fantasy-land/equals":zt,"fantasy-land/compose":Dt,"fantasy-land/map":qt,"fantasy-land/promap":Pt,"fantasy-land/ap":Ut,"fantasy-land/chain":Mt,"fantasy-land/extend":Ft,"fantasy-land/contramap":Qt}}},Ht=(Bt=[],function(t,e){if(!l(t,e))return!1;if(Bt.some((function(n){return n[0]===t&&n[1]===e})))return!0;Bt.push([t,e]);try{return w.test(t)&&w.test(e)&&w.methods.equals(t)(e)}finally{Bt.pop()}});function Wt(t,e){return l(t,e)&&!Gt(e,t)}var Gt=function(){var t=[];return function(e,n){if(!l(e,n))return!1;if(t.some((function(t){return t[0]===e&&t[1]===n})))return Ht(e,n);t.push([e,n]);try{return b.test(e)&&b.test(n)&&b.methods.lte(e)(n)}finally{t.pop()}}}();function Kt(t,e){return Wt(e,t)}function Jt(t,e){return Gt(e,t)}function Yt(t,e){return Gt(t,e)?t:e}function Xt(t,e){return Gt(t,e)?e:t}function Zt(t,e){return E.methods.compose(e)(t)}function te(t){return N.methods.id(t)()}function ee(t,e){return I.methods.concat(t)(e)}function ne(t){return T.methods.empty(t)()}function re(t){return C.methods.invert(t)()}function ie(t,e){return A.methods.filter(e)(t)}function oe(t,e){return ie((function(e){return!t(e)}),e)}function se(t,e){var n=!0;return ie((function(e){return n=n&&t(e)}),e)}function ue(t,e){var n=!1;return ie((function(e){return n=n||!t(e)}),e)}function ae(t,e){return S.methods.map(e)(t)}function le(t,e){return S.methods.map(t)(c(e))}function ce(t,e,n){return k.methods.bimap(n)(t,e)}function fe(t,e){return ce(t,u,e)}function he(t,e,n){return O.methods.promap(n)(t,e)}function pe(t,e){return V.methods.ap(e)(t)}function de(t,e,n){return pe(ae(t,e),n)}function ye(t,e,n,r){return pe(pe(ae(t,e),n),r)}function ve(t,e){return de(i,t,e)}function me(t,e){return de(i(u),t,e)}function _e(t,e){return R.methods.of(t)(e)}function ge(t,e){return ee(e,_e(e.constructor,t))}function xe(t,e){return ee(_e(e.constructor,t),e)}function we(t,e){return j.methods.chain(e)(t)}function be(t){return we(u,t)}function Ee(t,e,n){return L.methods.chainRec(t)(e,n)}function Ne(t,e){return D.methods.alt(t)(e)}function Ie(t){return q.methods.zero(t)()}function Te(t,e,n){return U.methods.reduce(n)(t,e)}function Ce(t){return Array.isArray(t)?t.length:Te((function(t,e){return t+1}),0,t)}function Ae(t,e){return Te((function(e,n){return e||Ht(t,n)}),!1,e)}function Se(t,e,n){return Te((function(t,n){return ee(t,e(n))}),ne(t),n)}function ke(t){if(Array.isArray(t))return t.slice().reverse();var e=t.constructor;return Te((function(t,n){return ee(_e(e,n),t)}),ne(e),t)}function Oe(t){return Ve(u,t)}function Ve(t,e){var n=Te((function(e,n){return e.push({idx:e.length,x:n,fx:t(n)}),e}),[],e),r=function(t){switch(typeof(t&&t.fx)){case"number":return function(t,e){return t<=e||t!=t};case"string":return function(t,e){return t<=e};default:return Gt}}(n[0]);if(n.sort((function(t,e){return r(t.fx,e.fx)?r(e.fx,t.fx)?t.idx-e.idx:-1:1})),Array.isArray(e)){for(var i=0;i<n.length;i+=1)n[i]=n[i].x;return n}var o=e.constructor,s=ne(o);for(i=0;i<n.length;i+=1)s=ee(s,_e(o,n[i].x));return s}function Re(t,e,n){return M.methods.traverse(n)(t,e)}function je(t,e){return Re(t,u,e)}function Le(t,e){return F.methods.extend(e)(t)}function ze(t){return Le(u,t)}function De(t){return Q.methods.extract(t)()}function qe(t,e){return B.methods.contramap(e)(t)}return{TypeClass:p,Setoid:w,Ord:b,Semigroupoid:E,Category:N,Semigroup:I,Monoid:T,Group:C,Filterable:A,Functor:S,Bifunctor:k,Profunctor:O,Apply:V,Applicative:R,Chain:j,ChainRec:L,Monad:z,Alt:D,Plus:q,Alternative:P,Foldable:U,Traversable:M,Extend:F,Comonad:Q,Contravariant:B,equals:Ht,lt:Wt,lte:Gt,gt:Kt,gte:Jt,min:Yt,max:Xt,compose:Zt,id:te,concat:ee,empty:ne,invert:re,filter:ie,reject:oe,map:ae,flip:le,bimap:ce,mapLeft:fe,promap:he,ap:pe,lift2:de,lift3:ye,apFirst:ve,apSecond:me,of:_e,append:ge,prepend:xe,chain:we,join:be,chainRec:Ee,alt:Ne,zero:Ie,reduce:Te,size:Ce,elem:Ae,foldMap:Se,reverse:ke,sort:Oe,sortBy:Ve,takeWhile:se,dropWhile:ue,traverse:Re,sequence:je,extend:Le,duplicate:ze,extract:De,contramap:qe}}(Vt.exports)}(Ot);var Rt=function(){function t(e,n){this.rank=e,this.action=n,this.seq=t.nextSeq++}return t.prototype.toString=function(){return this.seq.toString()},t.nextSeq=0,t}(),jt=function(){function t(){this.inCallback=0,this.toRegen=!1,this.prioritizedQ=new It((function(t,e){return t.rank.rank<e.rank.rank?1:t.rank.rank>e.rank.rank?-1:t.seq<e.seq?1:t.seq>e.seq?-1:0})),this.entries=new Ct((function(t){return t.toString()})),this.sampleQ=[],this.lastQ=[],this.postQ=null}return t.prototype.requestRegen=function(){this.toRegen=!0},t.prototype.prioritized=function(t,e){var n=new Rt(t,e);this.prioritizedQ.enqueue(n),this.entries.add(n)},t.prototype.sample=function(t){this.sampleQ.push(t)},t.prototype.last=function(t){this.lastQ.push(t)},t._collectCyclesAtEnd=function(){t.run((function(){return t.collectCyclesAtEnd=!0}))},t.prototype.post=function(t,e){for(null==this.postQ&&(this.postQ=[]);this.postQ.length<=t;)this.postQ.push(null);var n=this.postQ[t],r=null===n?e:function(){n(),e()};this.postQ[t]=r},t.prototype.checkRegen=function(){if(this.toRegen){this.toRegen=!1,this.prioritizedQ.clear();for(var t=this.entries.toArray(),e=0;e<t.length;e++)this.prioritizedQ.enqueue(t[e])}},t.prototype.isActive=function(){return!!t.currentTransaction},t.prototype.close=function(){for(;;){for(;this.checkRegen(),!this.prioritizedQ.isEmpty();){var e=this.prioritizedQ.dequeue();this.entries.remove(e),e.action()}var n=this.sampleQ;this.sampleQ=[];for(var r=0;r<n.length;r++)n[r]();if(this.prioritizedQ.isEmpty()&&this.sampleQ.length<1)break}for(r=0;r<this.lastQ.length;r++)this.lastQ[r]();if(this.lastQ=[],null!=this.postQ){for(r=0;r<this.postQ.length;r++)if(null!=this.postQ[r]){var i=t.currentTransaction;try{if(r>0){t.currentTransaction=new t;try{this.postQ[r](),t.currentTransaction.close()}catch(e){throw t.currentTransaction.close(),e}}else t.currentTransaction=null,this.postQ[r]();t.currentTransaction=i}catch(e){throw t.currentTransaction=i,e}}this.postQ=null}},t.onStart=function(e){t.onStartHooks.push(e)},t.run=function(e){var n=t.currentTransaction;if(null===n){if(!t.runningOnStartHooks){t.runningOnStartHooks=!0;try{for(var r=0;r<t.onStartHooks.length;r++)t.onStartHooks[r]()}finally{t.runningOnStartHooks=!1}}t.currentTransaction=new t}try{var i=e();return null===n&&(t.currentTransaction.close(),t.currentTransaction=null,t.collectCyclesAtEnd&&(Ut.collectCycles(),t.collectCyclesAtEnd=!1)),i}catch(e){throw null===n&&(t.currentTransaction.close(),t.currentTransaction=null),e}},t.currentTransaction=null,t.onStartHooks=[],t.runningOnStartHooks=!1,t.collectCyclesAtEnd=!1,t}(),Lt=0;var zt,Dt=function(){function t(t,e){if(this.registered=!1,this.deregister_=null,null===t)throw new Error("null origin!");this.origin=t,this.register_=e}return t.prototype.register=function(t){var e=this;this.registered||(this.registered=!0,null!==this.register_?this.deregister_=this.register_():(this.origin.increment(Ut.NULL),t.childrn.push(this.origin),this.deregister_=function(){e.origin.decrement(Ut.NULL);for(var n=t.childrn.length-1;n>=0;--n)if(t.childrn[n]===e.origin){t.childrn.splice(n,1);break}}))},t.prototype.deregister=function(t){this.registered&&(this.registered=!1,null!==this.deregister_&&this.deregister_())},t}();!function(t){t[t.black=0]="black",t[t.gray=1]="gray",t[t.white=2]="white",t[t.purple=3]="purple"}(zt||(zt={}));var qt=[],Pt=0,Ut=function(){function t(t,e,n){this.targets=[],this.childrn=[],this.visited=!1,this.color=zt.black,this.buffered=!1,this.refCountAdj=0,this.name=t,this.rank=e,this.sources=n,this.id=Pt++}return t.prototype.refCount=function(){return this.targets.length},t.prototype.register=function(t){return this.increment(t)},t.prototype.deregister=function(t){this.decrement(t),jt._collectCyclesAtEnd()},t.prototype.incRefCount=function(t){var e=!1;if(0==this.refCount())for(var n=0;n<this.sources.length;n++)this.sources[n].register(this);return this.targets.push(t),t.childrn.push(this),t.ensureBiggerThan(this.rank)&&(e=!0),Lt++,e},t.prototype.decRefCount=function(t){for(var e=!1,n=t.childrn.length-1;n>=0;n--)if(t.childrn[n]===this){t.childrn.splice(n,1);break}for(n=0;n<this.targets.length;n++)if(this.targets[n]===t){this.targets.splice(n,1),e=!0;break}if(e){if(0==this.refCount())for(n=0;n<this.sources.length;n++)this.sources[n].deregister(this);Lt--}},t.prototype.addSource=function(t){this.sources.push(t),this.refCount()>0&&t.register(this)},t.prototype.ensureBiggerThan=function(t){if(this.visited)return!1;if(this.rank>t)return!1;this.visited=!0,this.rank=t+1;for(var e=0;e<this.targets.length;e++)this.targets[e].ensureBiggerThan(this.rank);return this.visited=!1,!0},t.prototype.descr=function(){var t=null;switch(this.color){case zt.black:t="black";break;case zt.gray:t="gray";break;case zt.white:t="white";break;case zt.purple:t="purple"}for(var e=this.id+" "+this.name+" ["+this.refCount()+"/"+this.refCountAdj+"] "+t+" ->",n=this.children(),r=0;r<n.length;r++)e=e+" "+n[r].id;return e},t.prototype.children=function(){return this.childrn},t.prototype.increment=function(t){return this.incRefCount(t)},t.prototype.decrement=function(t){this.decRefCount(t),0==this.refCount()?this.release():this.possibleRoots()},t.prototype.release=function(){this.color=zt.black,this.buffered||this.free()},t.prototype.free=function(){for(;this.targets.length>0;)this.decRefCount(this.targets[0])},t.prototype.possibleRoots=function(){this.color!=zt.purple&&(this.color=zt.purple,this.buffered||(this.buffered=!0,qt.push(this)))},t.collectCycles=function(){if(!t.collectingCycles)try{t.collectingCycles=!0,t.markRoots(),t.scanRoots(),t.collectRoots();for(var e=t.toBeFreedList.length-1;e>=0;--e){t.toBeFreedList.splice(e,1)[0].free()}}finally{t.collectingCycles=!1}},t.markRoots=function(){for(var e=[],n=0;n<qt.length;n++)qt[n].color==zt.purple?(qt[n].markGray(),e.push(qt[n])):(qt[n].buffered=!1,qt[n].color==zt.black&&0==qt[n].refCount()&&t.toBeFreedList.push(qt[n]));qt=e},t.scanRoots=function(){for(var t=0;t<qt.length;t++)qt[t].scan()},t.collectRoots=function(){for(var t=0;t<qt.length;t++)qt[t].buffered=!1,qt[t].collectWhite();qt=[]},t.prototype.markGray=function(){if(this.color!=zt.gray){this.color=zt.gray;for(var t=this.children(),e=0;e<t.length;e++)t[e].refCountAdj--,t[e].markGray()}},t.prototype.scan=function(){if(this.color==zt.gray)if(this.refCount()+this.refCountAdj>0)this.scanBlack();else{this.color=zt.white;for(var t=this.children(),e=0;e<t.length;e++)t[e].scan()}},t.prototype.scanBlack=function(){this.refCountAdj=0,this.color=zt.black;for(var t=this.children(),e=0;e<t.length;e++)t[e].color!=zt.black&&t[e].scanBlack()},t.prototype.collectWhite=function(){if(this.color==zt.white&&!this.buffered){this.color=zt.black,this.refCountAdj=0;for(var e=this.children(),n=0;n<e.length;n++)e[n].collectWhite();t.toBeFreedList.push(this)}},t.NULL=new t("user",1e12,[]),t.collectingCycles=!1,t.toBeFreedList=[],t}(),Mt=function(t,e){this.f=t,this.deps=e};function Ft(t,e){return new Mt(t,e)}function Qt(t){return t instanceof Mt?t.deps:[]}function Bt(t){return t instanceof Mt?t.f:t}var $t=function(t,e){this.f=t,this.deps=e};function Ht(t){return t instanceof $t?t.deps:[]}function Wt(t){return t instanceof $t?t.f:t}var Gt=function(t,e){this.f=t,this.deps=e};function Kt(t){return t instanceof Gt?t.deps:[]}function Jt(t){return t instanceof Gt?t.f:t}var Yt=function(t,e){this.f=t,this.deps=e};function Xt(t){return t instanceof Yt?t.deps:[]}function Zt(t){return t instanceof Yt?t.f:t}var te=function(t,e){this.f=t,this.deps=e};function ee(t){return t instanceof te?t.deps:[]}function ne(t){return t instanceof te?t.f:t}var re=function(t,e){this.f=t,this.deps=e};function ie(t){return t instanceof re?t.deps:[]}function oe(t){return t instanceof re?t.f:t}function se(t){for(var e=[],n=0;n<t.length;n++){var r=t[n];e.push(new Dt(r.getVertex__(),null))}return e}
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 L